home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d975 / itf.lha / ITF / DataFile.txt < prev    next >
Text File  |  1993-09-21  |  8KB  |  253 lines

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