home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0975.lha / ITF / ZCode.txt < prev    next >
Text File  |  1993-09-21  |  12KB  |  303 lines

  1. The InfoTaskForce Guide to Z-Code Versions
  2. ==========================================
  3. Copyright (c) 1992 InfoTaskForce
  4.  
  5.  
  6. Introduction
  7. ------------
  8.  
  9. Infocom have produced several different Z-Code Interpreters, each one
  10. providing more features than the previous ones. The first byte of each
  11. game's data file indicates which interpreter version it was compiled to use.
  12. This file describes some of the differences between Z-Code versions.
  13.  
  14.  
  15. Z-Code Version 1.
  16. -----------------
  17.  
  18. The initial Infocom games produced for the Apple ][ series of 
  19. personal computers running Apple DOS 3.2 used Z-Code Version 1. The 
  20. Z-Machine's stack was 512 bytes. The resident portion of a data file 
  21. was limited to less than 48 Kbytes (the limit of the Apple ][+ main 
  22. memory).
  23.  
  24. Features of the Version 1 interpreter included:
  25.  
  26. *    The global property table was $35 bytes.
  27. *    The maximum number of properties per object is 32.
  28. *    The maximum length of any property is 8 bytes.
  29. *    Any address given in Page/Offset form represents a data 
  30.     file offset in words, not bytes.
  31.  
  32. The Version 1 object structure was as follows:
  33.  
  34. typedef struct
  35. {
  36.     byte    attributes[4] ;
  37.     byte    location[1] ;
  38.     byte    link[1] ;
  39.     byte    holds[1] ;
  40.     byte    prop_ptr[2] ;
  41. } std_object ;
  42.  
  43. The Version 1 data file header has the following structure:
  44.  
  45. struct    header
  46. {
  47.     byte    z_code_version ;    /* Game's Z-CODE Version Number    */
  48.     byte    mode_bits ;        /* Status Bar display indicator    */
  49.     word    release ;        /* Game Release Number             */
  50.     word    resident_bytes ;    /* No. bytes in the Resident Area  */
  51.     word    start ;            /* Offset to Start of Game         */
  52.     word    vocab ;            /* Offset to VocabtList            */
  53.     word    object_list ;        /* Offset to Object/Room List      */
  54.     word    globals ;        /* Offset to Global Variables      */
  55.     word    save_bytes ;        /* No. bytes in the Save Game Area */
  56.     word    padding[24] ;        /* Blank                           */
  57. } ;
  58.  
  59.  
  60.  
  61. Z-Code Version 2.
  62. -----------------
  63.  
  64. Infocom games produced for the Apple ][ running DOS 3.3 
  65. initially used Z-Code Version 2 (and later Z-Code Version 3). Version 2 
  66. introduced several minor enhancements:
  67.  
  68. *    The character table used in the encoding of the game's 
  69.     vocabulary and text was changed.
  70. *    The method of encoding a carriage return/line feed was 
  71.     changed.
  72. *    The concept of a common word list was introduced.
  73.  
  74. The Version 2 data file header has the following structure:
  75.  
  76. struct    header
  77. {
  78.     byte    z_code_version ;    /* Game's Z-CODE Version Number    */
  79.     byte    mode_bits ;        /* Status Bar display indicator    */
  80.     word    release ;        /* Game Release Number             */
  81.     word    resident_bytes ;    /* No. bytes in the Resident Area  */
  82.     word    start ;            /* Offset to Start of Game         */
  83.     word    vocab ;            /* Offset to VocabtList            */
  84.     word    object_list ;        /* Offset to Object/Room List      */
  85.     word    globals ;        /* Offset to Global Variables      */
  86.     word    save_bytes ;        /* No. bytes in the Save Game Area */
  87.     word    script_status ;        /* Z-CODE printing modes           */
  88.     char    serial_no[6] ;        /* Game's Serial Number            */
  89.     word    common_word ;        /* Offset to Common Word List      */
  90.     word    padding[19] ;        /* Blank                           */
  91. } ;
  92.  
  93.  
  94.  
  95. Z-Code Version 3. ("Standard")
  96. -----------------
  97.  
  98. The most common game format is Z-Code Version 3, which includes games
  99. such as:
  100.     Ballyhoo    Cutthroats        Deadline
  101.     Enchanter    Hitchhiker        Hollywood Hijinx
  102.     Infidel        Leather Goddesses    Lurking Horror
  103.     Moonmist    Planetfall        Plundered Hearts
  104.     Seastalker    Sorceror        Spellbreaker
  105.     Starcross    Stationfall        Suspect
  106.     Suspended    Wishbringer        Witness    
  107.     Zork I        Zork II            Zork III
  108.  
  109. Version 3 introduced the following enhancements:
  110.  
  111. *    The common word list was expanded from one bank of 64 
  112.     words to 3 banks of 64 words.
  113. *    The way of encoding capital letters and punctuation 
  114.     symbols was changed.
  115. *    Two new opcodes: "prt_status" (Opcode 0xBC) and 
  116.     "verify" (Opcode 0xBD). Neither opcode takes any 
  117.     arguements. The "verify" opcode is used to verify the 
  118.     integrity of the game's data file and the "prt_status" opcode 
  119.     prints the status bar at the top of the screen. In previous 
  120.     versions, the status bar was printed solely by a subroutine 
  121.     of the "input" opcode.
  122. *    Some Version 3 interpreters included two additional 
  123.     opcodes for use on machines with control over the cursor 
  124.     and CRT being used. These are "split_screen" (Opcode 
  125.     0xEA) and "set_current_window" (Opcode 0xEB). If an 
  126.     interpreter includes these opcodes, it should set bit 5 of 
  127.     the "mode_bits" byte in the data file's header before 
  128.     running the game. The data file contains opcodes which 
  129.     examine this byte on the fly and only execute these opcodes 
  130.     if bit 5 is set. Each take a single arguement. The only 
  131.     game that I have found that uses these opcodes is 
  132.     Seastalker (Revision: 15) - when in the scimitar submarine,
  133.     type "set sonar to auto" invokes a splitting of the display
  134.     into two windows. Typing "set sonar to manual" restores the
  135.     screen to normal. This data file also makes use of the TANDY
  136.     flag in the game header's "mode_bits" field and the
  137.     USE_NON_PROP_FONT flag in the game header's "script_status" field.
  138.  
  139. The Version 3 data file header has the following structure:
  140.  
  141. struct    header
  142. {
  143.     byte    z_code_version ;    /* Game's Z-CODE Version Number    */
  144.     byte    mode_bits ;        /* Status Bar display indicator    */
  145.     word    release ;        /* Game Release Number             */
  146.     word    resident_bytes ;    /* No. bytes in the Resident Area  */
  147.     word    start ;            /* Offset to Start of Game         */
  148.     word    vocab ;            /* Offset to VocabtList            */
  149.     word    object_list ;        /* Offset to Object/Room List      */
  150.     word    globals ;        /* Offset to Global Variables      */
  151.     word    save_bytes ;        /* No. bytes in the Save Game Area */
  152.     word    script_status ;        /* Z-CODE printing modes           */
  153.     char    serial_no[6] ;        /* Game's Serial Number            */
  154.     word    common_word ;        /* Offset to Common Word List      */
  155.     word    verify_length ;        /* No. words in the Game File      */
  156.     word    verify_checksum ;    /* Game Checksum - used by Verify  */
  157.     word    padding[17] ;        /* Blank                           */
  158. } ;
  159.  
  160.  
  161. Z-Code Version 4. ("Plus")
  162. -----------------
  163.  
  164. Z-Code was completely overhauled with the introduction of Version 
  165. 4, which lifted many of the memory size constraints imposed on the 
  166. earlier interpreter versions. This allowed games such as
  167.  
  168.     A Mind Forever Voyaging            Bureaucracy
  169.     Nord & Bert                Trinity
  170.  
  171. to be created.  The changes in Z-Code Version 4 included:
  172.  
  173. *    The Z-Machine's stack was increased from 512 bytes to 
  174.     1024 bytes.
  175. *    The memory limit of 48 Kbytes placed on the resident 
  176.     portion of a data file was changed to 128 Kbytes.
  177. *    The size of the vocabulary words was increased from 6 
  178.     characters to 9 characters.
  179. *    The size of the global property table was increased from 
  180.     $35 bytes to $70 bytes.
  181. *    The maximum number of properties per object was 
  182.     increased from 32 to 64.
  183. *    The maximum length of any property was increased from 8 
  184.     bytes to 64 bytes.
  185. *    Any address given in Page/Offset form represents a data 
  186.     file offset in longwords, not words as in previous versions.
  187. *    In order to increase the number of objects in a game 
  188.     above the 256 object limit imposed in earlier interpreter 
  189.     versions, the definition of an object was changed to the 
  190.     following:
  191.  
  192. typedef struct
  193. {
  194.     byte    attributes[6] ;
  195.     byte    location[2] ;
  196.     byte    link[2] ;
  197.     byte    holds[2] ;
  198.     byte    prop_ptr[2] ;
  199. } plus_object ;
  200.  
  201. *    This change in the definition of an object caused the 
  202.     following opcodes to be modified: "get_link", "get_holds", 
  203.     "get_loc", "get_p_len", "remove_obj", "p_obj", "check_loc", 
  204.     "test_attr", "set_attr", "clr_attr", "transfer", "get_prop", 
  205.     "get_prop_addr", "get_next_prop" and "put_prop".
  206. *    The following opcodes were also modified: "print2", 
  207.     "gosub" and "random".
  208. *    The "prt_status" opcode was removed.
  209. *    The following new opcodes were introduced: "gosub2", 
  210.     "gosub3", "clear_screen", "erase_line", "set_cursor_posn", 
  211.     "null2", "set_text_mode", "io_buffer_mode", "io_mode", 
  212.     "null3", "beep", "get_key" and "compare2".
  213.  
  214. The Version 4 data file header has the following structure:
  215.  
  216. struct    header
  217. {
  218.     byte    z_code_version ;    /* Game's Z-CODE Version Number      */
  219.     byte    mode_bits ;        /* Status Bar display indicator      */
  220.     word    release ;        /* Game Release Number               */
  221.     word    resident_bytes ;    /* No. bytes in the Resident Area    */
  222.     word    start ;            /* Offset to Start of Game           */
  223.     word    vocab ;            /* Offset to VocabtList              */
  224.     word    object_list ;        /* Offset to Object/Room List        */
  225.     word    globals ;        /* Offset to Global Variables        */
  226.     word    save_bytes ;        /* No. bytes in the Save Game Area   */
  227.     word    script_status ;        /* Z-CODE printing modes             */
  228.     char    serial_no[6] ;        /* Game's Serial Number              */
  229.     word    common_word ;        /* Offset to Common Word List        */
  230.     word    verify_length ;        /* No. words in the Game File        */
  231.     word    verify_checksum ;    /* Game Checksum - used by Verify    */
  232.     byte    interpreter_number ;    /* Number - Set by Interpreter       */
  233.     byte    interpreter_version ;    /* ASCII Char - Set by Interpreter   */
  234.     byte    screen_height ;        /* Screen Height - Set by Interpreter*/
  235.     byte    screen_width ;        /* Screen Width - Set by Interpreter */
  236.     word    padding[15] ;        /* Blank                             */
  237. } ;
  238.  
  239.  
  240.  
  241. Z-Code Version 5. ("Advanced")
  242. -----------------
  243.  
  244. The screen handling facilities of Version 4 were enhanced with 
  245. the release of Version 5 allowing such games as:
  246.  
  247.     Beyond Zork    Border Zone        Sherlock
  248.  
  249. Enhancements included the addition of mouse support (for machines like the
  250. Macintosh and the IBM PC) and sound (the game Sherlock for the Macintosh
  251. initially contained no sound support. A sound data file was included in a
  252. later release). Support was also added for extended charcter sets (the game
  253. Beyond Zork on the IBM PC uses the extended IBM PC character set to print
  254. graphics symbols and on the Macintosh uses a custom font for the same purpose).
  255.  
  256. The following changes were made in Version 5:
  257.  
  258. *    The following opcodes were removed: "save_game" and "restore_game".
  259. *    The following opcodes were modified: "pop_stack","rtn","gosub" and
  260.     "compare2".
  261. *    The "not" opcode was moved.
  262. *    The following opcodes were added: "branch_true","gosub4", "gosub5",
  263.     "throw_away_stack_frame", "parse", "encrypt", "block_copy",
  264.     "print_text", "num_local_params", "logical_shift",
  265.     "arithmetic_shift", "clear_flag", "test_byte_array" and "set_flag".
  266.  
  267. The Version 5 data file header has the following structure:
  268.  
  269. struct    header
  270. {
  271.     byte    z_code_version ;    /* Game's Z-CODE Version Number      */
  272.     byte    mode_bits ;        /* Status Bar display indicator      */
  273.     word    release ;        /* Game Release Number               */
  274.     word    resident_bytes ;    /* No. bytes in the Resident Area    */
  275.     word    start ;            /* Offset to Start of Game           */
  276.     word    vocab ;            /* Offset to VocabtList              */
  277.     word    object_list ;        /* Offset to Object/Room List        */
  278.     word    globals ;        /* Offset to Global Variables        */
  279.     word    save_bytes ;        /* No. bytes in the Save Game Area   */
  280.     word    script_status ;        /* Z-CODE printing modes             */
  281.     char    serial_no[6] ;        /* Game's Serial Number              */
  282.     word    common_word ;        /* Offset to Common Word List        */
  283.     word    verify_length ;        /* No. words in the Game File        */
  284.     word    verify_checksum ;    /* Game Checksum - used by Verify    */
  285.     byte    interpreter_number ;    /* Number - Set by Interpreter       */
  286.     byte    interpreter_version ;    /* ASCII Char - Set by Interpreter   */
  287.     byte    screen_height ;        /* Screen Height - Set by Interpreter*/
  288.     byte    screen_width ;        /* Screen Width  - Set by Interpreter*/
  289.     byte    left ;            /* Left Coord. - Set by Interpreter  */
  290.     byte    right ;            /* Right Coord. - Set by Interpreter */
  291.     byte    top ;            /* Top Coord. - Set by Interpreter   */
  292.     byte    bottom ;        /* Bottom Coord. - Set by Interpreter*/
  293.     byte    unknown1 ;        /* Unknown - Set by Interpreter      */
  294.     byte    unknown2 ;        /* Unknown - Set by Interpreter      */
  295.     word    padding1[2] ;        /* Blank                             */
  296.     byte    unknown3 ;        /* Unknown - Set by Interpreter      */
  297.     byte    unknown4 ;        /* Unknown - Set by Interpreter      */
  298.     word    unknown5 ;        /* Unknown         - Set in Data File*/
  299.     word    padding2[3] ;        /* Blank                             */
  300.     word    unknown6 ;        /* Unknown         - Set in Data File*/
  301.     word    padding3[4] ;        /* Blank                             */
  302. } ;
  303.