home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
GAMES
/
infocom_src.lha
/
datafile.txt
< prev
next >
Wrap
Text File
|
1993-03-03
|
8KB
|
253 lines
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)