Crossbow VM Binary File Format Data Types

About C-Sheep
About "The Meadow"
A number of utility data types have been defined for the binary file format:
typedef short          address_t;
typedef unsigned short word_t;
typedef unsigned long  dword_t;
typedef double         data_t;
typedef unsigned char  byte_t;

typedef unsigned char magic_number_t[4]; /* 4 byte magic number */
typedef unsigned char version_number_t;
A Crossbow Binary for execution with the Crossbow Virtual Machine begins with a file header that contains information of the makeup of the file itself:
#pragma pack(4)
struct crossbow_header
	magic_number_t   magic;        /* magic number (should be "CVBX") */
	version_number_t major;        /* major version number (should be "1") */
	version_number_t minor;        /* minor version number (should be "0") */
	word_t           reserved1;    /* reserved for future use */
	word_t           instructions; /* number of instructions (code allocation index) */
	dword_t          source_bytes; /* length of source code in bytes (for future use) */
	unsigned int     reserved2;    /* reserved for future use */
#pragma pack(8)
The header is followed by the actual list of instructions for the program. Each of these instructions is of the following type:
#pragma pack(4)
struct crossbow_body
	byte_t    oc;  /* opcode */
	byte_t    dl;  /* displacement level */
	address_t da;  /* displacement address */
	data_t    id;  /* instruction data */
#pragma pack(8)




developed at the NCCA

© 2006,2007 by Eike Anderson, Steffen Engel & Leigh McLoughlin, NCCA, Bournemouth University