1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
|
The InfoTaskForce Guide to the Infocom Data File Structure
==========================================================
Copyright (c) 1992 InfoTaskForce
Type 3 (Standard) Data File.
----------------------------
From: start_of_data_file
To: size of header - 1
Data: Header.
From: size of header
To: common_word_ptr - 1
Data: Common Word Table.
From: common_word_ptr
To: common_word_ptr + ( 3 * 32 * 2 ) ~ ( object_list - 1 )
Data: Common Word Table Index.
This table consists of 3 banks of 32 entries - each entry consists
of a 2 byte page/offset combination giving the start of the "common
word" within the data file. This should be a location in the Common
Word Table.
From: object_list
To: object_list + global_prop_size - 1
Global Property Table.
From: object_list + global_prop_size
To: prop_ptr of Object 1 - 1
Object / Room List.
This starts with Object 0 which is all zeros. Object 1 is actually
the first object.
From: prop_ptr of Object 1
To: global_vars - 1
Data: Object's Property Lists.
Properties within each Object's Propertry List are arranged in
descending order. If a property cannot be found in this list, it is
assumed to be in the Global Property Table.
From: global_vars
To: input_word_buffer - 1
Global Variable Table.
Variable 0 = Current Stack Entry.
Variable 1 - 15 = Local Variables on Z-Machine's Stack.
Variable 16 - 255 = two byte entries in this table.
Note that there may be up to 255 variables. Thus
this table may contain upto 240 entries ($1E0
bytes).
Variable 16 = Current Location.
Variable 17 = Score / Hour.
Variable 18 = No. Moves / Minutes.
From: input_word_buffer
To: input_word_buffer + ( buffer_length * 2 ) - 1
~ ( input_character_buffer - 1 )
Data: Input Routine's Word Buffer.
First byte of the buffer contains the buffer length in words
(including this byte).
From: input_character_buffer
To: input_character_buffer + buffer_length - 1
Data: Input Routine's Character Buffer.
First byte of the buffer contains the buffer length in bytes
(including this byte).
From: input_character_buffer + buffer_length
To: save_bytes - 1
Data: ???
From: save_bytes
To: vocab_ptr - 1
Data: ???
From: vocab_ptr
To: vocab_ptr
Data: Size of "End Of Sentence" (EOS) Character Table.
From: vocab_ptr + 1
To:: vocab_ptr + EOS Table Size
Data: "End Of Sentence" Character Table.
From: vocab_ptr + EOS Table Size + 1
To: vocab_ptr + EOS Table Size + 1
Data: Size of each Vocabulary Table Entry.
From: vocab_ptr + EOS Table Size + 2
To: vocab_ptr + EOS Table Size + 3
Data: Number of Vocabulary Table Entries.
From: vocab_ptr + EOS Table Size + 4
To: resident_bytes - 1
Data: Vocabulary Table.
(vocab_ptr + EOS Table Size + 4 + ( Size of Vocab Entry * Number of
Entries )) * resident_bytes - 1.
From: resident_bytes
To: end of data file
Data: Z-Code.
Note:
-----
* For Type 1 Data Files, there is no Common Word Table or
Common Word Table Index. In this case, object_list * size of
header.
* For Type 2 Data Files, the Common Word Table and Common
Word Table Index are smaller than for Type 3 Data Files. There
is only one bank of 32 entries in the Common Word Table Index.
Here, ( common_word_ptr + ( 1 * 32 * 2 )) * ( object_list - 1 ).
* For Types 1 - 3, global_prop_size = $35.
For Types 4 - 5, global_prop_size = $70.
* The location of the input_word_buffer and the
input_character_buffer can only be found by examining parameters
passed to the input routine.
The Infocom Data File Header.
-----------------------------
/*
** Infocom Game Header Structure.
*/
struct header
{
byte z_code_version ; /* Game's Z-CODE Version Number */
byte mode_bits ; /* Status Bar display indicator */
word release ; /* Game Release Number */
word resident_bytes ; /* No. bytes in the Resident Area */
word start ; /* Offset to Start of Game */
word vocab ; /* Offset to VocabtList */
word object_list ; /* Offset to Object/Room List */
word globals ; /* Offset to Global Variables */
word save_bytes ; /* No. bytes in the Save Game Area */
word script_status ; /* Z-CODE printing modes */
char serial_no[6] ; /* Game's Serial Number */
word common_word ; /* Offset to Common Word List */
word verify_length ; /* No. words in the Game File */
word verify_checksum ; /* Game Checksum - used by Verify */
byte interpreter_number ; /* Number - Set by Interpreter */
byte interpreter_version ; /* ASCII Char - Set by Interpreter */
byte screen_height ; /* Screen Height - Set by Interpreter */
byte screen_width ; /* Screen Width - Set by Interpreter */
byte left ; /* Left Coord. - Set by Interpreter */
byte right ; /* Right Coord. - Set by Interpreter */
byte top ; /* Top Coordinate - Set by Interpreter*/
byte bottom ; /* Bottom Coord. - Set by Interpreter */
byte unknown1 ; /* Unknown - Set by Interpreter */
byte unknown2 ; /* Unknown - Set by Interpreter */
word padding1[2] ; /* Blank */
byte unknown3 ; /* Unknown - Set by Interpreter */
byte unknown4 ; /* Unknown - Set by Interpreter */
word unknown5 ; /* Unknown - Set in Data File */
word padding2[3] ; /* Blank */
word unknown6 ; /* Unknown - Set in Data File */
word padding3[4] ; /* Blank */
} ;
/*
** Header Information.
**
** The 'z_code_version' byte has the following meaning:
** $00 : Not Used
** $01 : Game compiled for an early version of the interpreter
** $02 : Game compiled for an early version of the interpreter
** $03 : Game compiled for the current 'Standard Series Interp'
** $04 : Game compiled for the current 'Plus Series Interpreter'
** $05 : Game compiled for the current 'Advanced Series Interp'
** $06 : Game compiled for the current 'Graphics Series Interp'
**
** The 'mode_bits' byte performs the following functions:
** Bit 0 : Clear - Game Header OK.
** Set - Game Header Error.
** Bit 1 : Clear - Status Bar displays the SCORE.
** Set - Status Bar displays the TIME.
** Bit 2 : Clear
** Set
** Bit 3 : Clear - Standard: Normal.
** Set - Standard: "Licensed to Tandy Corp" Flag.
** Clear - Plus: Capitalise instead of Underline.
** Set - Plus: Has Underline Capability.
** Bit 4 : Clear
** Set
** Bit 5 : Clear - No Special Screen Modes Available.
** Set - Special Screen Modes Available.
** Bit 6 : Clear
** Set
** Bit 7 : Clear
** Set
**
** The 'script_status' word is used by Z-CODE to set printing modes
** for use by the interpreter:
** Bit 00 : Clear - Script mode off.
** Set - Script mode on.
** Bit 01 : Clear - Use any type of Font.
** Set - Use a Non-Proportional Font only.
** Bit 10 : Clear - Printer OK.
** Set - Printer Error (e.g.: Not Connected).
*/
/*
** "mode_bits" Bit Definitions:
*/
#define GAME_HEADER_OK ((byte)0xFE)
#define GAME_HEADER_BAD ((byte)0x01)
#define USE_SCORE ((byte)0xFD)
#define USE_TIME ((byte)0x02)
#define NON_TANDY ((byte)0xF7)
#define TANDY ((byte)0x08)
#define CAPITALISE ((byte)0xF7)
#define UNDERLINE ((byte)0x08)
#define NO_SCREEN_MODES ((byte)0xDF)
#define SCREEN_MODES ((byte)0x20)
/*
** "script_status" Bit Definitions:
*/
#define SCRIPT_MODE_OFF ((word)0xFFFE)
#define SCRIPT_MODE_ON ((word)0x0001)
#define USE_ANY_FONT ((word)0xFFFD)
#define USE_NON_PROP_FONT ((word)0x0002)
#define SCRIPT_OK ((word)0xFBFF)
#define SCRIPT_ERROR ((word)0x0400)
/*
** "interpreter_number" Byte Definitions:
*/
#define XZIP ((byte)0x00)
#define DEC_20 ((byte)0x01)
#define APPLE_2E ((byte)0x02)
#define MACINTOSH ((byte)0x03)
#define AMIGA ((byte)0x04)
#define ATARI_ST ((byte)0x05)
#define IBM_MSDOS ((byte)0x06)
#define COMMODORE_128 ((byte)0x07)
#define C64 ((byte)0x08)
#define APPLE_2C ((byte)0x09)
#define APPLE_2GS ((byte)0x0A)
#define TANDY_COLOR ((byte)0x0B)
|