MAIN HEADER FIELDS Offset Size Description ====== ==== ========================== 00 3 Identifier string ("GBS") 03 1 Version (1) 04 1 Number of songs (1-255) 05 1 First song (usually 1) 06 2 Load address ($400-$7fff) 08 2 Init address ($400-$7fff) 0a 2 Play address ($400-$7fff) 0c 2 Stack pointer 0e 1 Timer modulo (see TIMING) 0f 1 Timer control (see TIMING) 10 32 Game Title string 30 32 Author string 50 30 Copyright string 6e 2 Length of Code/Data section (1 = 16 Bytes) 70 n Code and Data (see RST VECTORS) n+70 x Extended Header (see EXTENDED HEADER) If the word at offset 0x6e is not zero, the extended header is considered valid if both the magic is present and the extended header crc is ok. If the extended header is not valid, the copyright string is assumed to be 32 characters. EXTENDED HEADER The extended header was designed with the following in mind: - Backwards compatible extension - Reliable to detect - Easy read support even on the native hardware - Selfsufficient - Can be a separate file Offset Size Description ====== ==== ========================== 00 4 Magic 'GBSX' 04 4 Size of Extended Header - 8 08 4 Extended Header CRC 0c 4 Original File Size 10 4 Original File CRC 14 2 Offset to Extended Title string 16 2 Offset to Extended Author string 18 2 Offset to Extended Copyright string 1a 2 Offset to (multiline) Comment string 1c 1 Number of Entries in Subsong Info Table 1d 3 Reserved (0) 20 a Subsong Info Table (see SUBSONG INFO TABLE) a+20 b String area Reserved bits shall be zero. The Offsets refer to the beginning of the String area. If the Offset is -1 (FFFF) the String is not set. The Extended String Offsets shall be -1 except when the String does not fit into the main header. Strings in the String area are zero terminated. The file CRC is calculated over the (original) length of the gbs without the extended header and padding. The extended header CRC is calculated after the file CRC has been set, with the extended header CRC field set to zero. If the extended header is stored in a separate file, an IFF header with the ID 'GBSI' (GBS Info) is added and the Title, Author and Copyright strings are included unconditionally to meet the selfsufficient requirement. FORM-IFFs may include a 'FILE' chunk containing the filename of the GBS, CAT- and LIST-IFFs have to include it. SUBSONG INFO TABLE Offset Size Description ====== ==== ========================== 00 4 Length of Subsong (1024 == 1 second, 0 == unlimited) 04 2 Offset to Subsong Title 06 2 Reserved (0) FILE CHUNK Offset Size Description ====== ==== ========================== 00 4 'FILE' 04 4 Length of filename 08 x Filename (zeroterminated)