File Format Definitions

General terms and definitions

Little Endian Format
Intel based CPU's use a method of storing numbers in memory called "Little Endian Format" In this way, the lease significant byte of the number is stored in a lower memory address than a more significant byte. E.g. the number 0xc0ffee would be stored as "EE FF c0" in memory.

LONG
A "Long" data item is an (unsigned) 32bit integer. DWORD in C, Cardinal in 32bit Delphi. (Little-Endian Format)

WORD
A "Word" data item is an (unsigned) 16bit Integer. WORD in C and Delphi. (Little-Endian Format)

BYTE
A "Byte" is an 8bit value, identical to a "Char".

STRING
Unless otherwise defined, a STRING is a Null terminated collection of "Chars". I.E. a set of chars terminated by a zero byte.

Arrays
Arrays of data are defined using square brackets ['s and ]'s. E.g. BYTE[] is an open ended array of Bytes, whereas BYTE[4] is an array of four bytes. Arrays are not limited to BYTEs you can also have arrays of WORDs LONGs and even record structures.

Record Structures
Record structures are defined with braces {'s and }'s. E.g. {BYTE X, STRING name}

CStrings
CStrings are strings which have length data linked with them. The format is flexible and they are read as follows READ BYTE Length If Length=255 then READ WORD Length READ Char[Length] into String