Roger Firth's IF pages

Home

InfLight -- Inform debugging

Email
Back up

Before we look at what we can discover while running a game, we should mention other techniques for examining Inform files from the outside.

infodump

Part of the Ztools package, infodump reads a compiled Inform program file and reports on the contents of its low memory -- the various data tables such as the header, the globals and the dictionary. Like the compiler, it's not a Windows application, so you can either type in an MS-DOS window, or use a batch file (say CLOAKINFO.BAT):

 
infodump -f Cloak.z5 >CloakInfo.txt

Double-click on the CLOAKINFO.BAT icon BAT icon to dump the information to a file (it's really too long to display in the window). Various command-line switches control the output: -i for the header (that's the default anyhow), -m for the memory map, -a for any abbreviations, -o for the objects, -t for the object tree, -g for grammar information, -d for the dictionary, or -f for all of them.

 
Story file is Cloak.z5

    **** Story file header ****

Z-code version:           5
Interpreter flags:        None
Release number:           1
Size of resident memory:  2608
Start PC:                 2609
Dictionary address:       1a67
Object table address:     010a
Global variables address: 0823
Size of dynamic memory:   126f
Game flags:               Supports undo
Serial number:            000326
Abbreviations address:    0042
File size:                13750
Checksum:                 37a7
Terminating keys address: 126e
    Keys used:
Header extension address: 0102
Inform Version:           6.21
Header extension length:  0003
Unicode table address:    0000

    **** Story file map ****

 Base    End   Size
    0     3f     40  Story file header
   40     41      2  Abbreviation data
   42    101     c0  Abbreviation pointer table
  102    109      8  Header extension table
  10a    31d    214  Object table
  31e    5fc    2df  Property data
  5fd    822    226
  823    a02    1e0  Global variables
  a03   126e    86c
 126f   1342     d4  Grammar pointer table
 1343   1970    62e  Grammar data
 1971   1a64     f4  Action routine table
 1a65   1a66      2
 1a67   2607    ba1  Dictionary
 2608  1374f  11148  Paged memory

    **** Abbreviations ****

[ 0] "   "
dots
[95] "   "

    **** Objects ****

  Object count = 29

  1. Attributes: None
     Parent object:   0  Sibling object:   0  Child object:   5
     Property address: 031e
         Description: "Class"
          Properties:
dots
 29. Attributes: 17
     Parent object:  27  Sibling object:   0  Child object:   0
     Property address: 05e1
         Description: "scrawled message"
          Properties:
              [41] 00 00
              [35] 42 a7
              [ 1] 1f 87 21 e2 1d bc

    **** Object tree ****

[  1] "Class"
 . [  5] "CompassDirection"
[  2] "Object"
dots
[ 27] "Foyer bar"
 . [ 29] "scrawled message"
[ 28] "velvet cloak"

    **** Parse tables ****

  Verb entries = 106

255. 1 entry, verb = "score"
    [00 0c 0f]                "score"

254. 2 entries, verb = "full", synonyms = "fullscore"
    [00 0d 0f]                "full"
    [00 0d 42 22 06 0f]       "full score"
dots
151. 2 entries, verb = "dig"
    [00 38 01 00 00 0f]       "dig noun"
    [00 38 01 00 00 42 25 d2 01 00 01 0f] "dig noun with held"

150. 1 entry, verb = "hang"
    [00 12 01 00 01 42 20 68 01 00 00 0f] "hang held on noun"

    **** Verb action routines ****

  Action table entries = 122

action# action-routine "verb..."

  0.  9714  "nouns"
  1.  d66c  "die"
dots
120.  da78  "i wide"
121.  ed08  "cross"
            "in"

    **** Prepositions ****

  Table entries = 0

    **** Dictionary ****

  Word separators = ".,""
  Word count = 330, word size = 9

[   1] .         [   2] ,         [   3] a         [   4] about
[   5] abstract  [   6] actions   [   7] adjust    [   8] again
dots
[ 325] with      [ 326] wreck     [ 327] x         [ 328] y
[ 329] yes       [ 330] z 

txd

txd is the other major component in the Ztools package. It too reads a compiled Inform program file and reports on the contents of its high memory -- the routines and strings. Again, it's not a Windows application, so you can either type in an MS-DOS window, or use a batch file (say CLOAKTXD.BAT):

 
txd -agn Cloak.z5 >CloakTxd.txt

Double-click on the CLOAKTXD.BAT icon BAT icon to dump the information to a file (it's far far too long to display in the window):

 
[Start of code at 2608]

Main routine 2608, 0 locals

 2609:  call_vs         2610 -> gef
 260e:  quit

Routine 2610, 0 locals

 2611:  call_vn         10c88 #0016 #0049
 2619:  rtrue

Routine 261c, 0 locals

 261d:  rtrue

Routine 2620, 1 local

 2621:  call_vs         11bd8 local0 #00 -> sp
 2628:  pull            gef
 262b:  je              gef #61 #65 #69 2644
 2632:  je              gef #6f #75 #41 2644
 2639:  je              gef #45 #49 #4f 2644
 2640:  je              gef #55 ~2645
 2644:  rtrue
 2645:  rfalse
dots
Routine 11d5c, 1 local

11d5d:  call_2s         11794 local0 -> sp
11d63:  je              sp #03 11d6e
11d67:  call_2s         11310 #23 -> sp
11d6d:  ret_popped
11d6e:  print_paddr     local0
11d70:  rtrue

Routine 11d74, 2 locals

11d75:  rfalse

[End of code at 11d76]

[Start of text at 11d78]

11d78: S001 "Cloak of Darkness"
11d88: S002 "^A basic IF demonstration.^"
11da0: S003 "991113"
dots
13730: S410 "StorageForShortName"
13740: S411 "task_scores"
13748: S412 "task_done"

[End of text at 13750]

[End of file]

Definitely not an easy or friendly read, but this (or the compiler's a and t switches) are just about the only way of discovering the structure of the Z-machine's high memory -- as we said before, you've no direct access to this area from a running program.

disinform

Just for completeness, we should mention disinform (or uninform, or deinform; the nomenclature seems confused), which maps the output from infodump and txd into something closer to Inform syntax. Development of this seems to have stopped some way short of completeness; what you get looks like this:

 
![Main routine]
![_______________________________________________________________________];

[rn_2608 ;
gef=rn_2610();
@quit            ;
];

![_______________________________________________________________________];

[rn_2610 ;
rn_10c88(16,49);
rtrue;
];

![_______________________________________________________________________];

[rn_261c ;
rtrue;
];

![_______________________________________________________________________];

[rn_2620 local0 ;
gef=rn_11bd8(local0,00);
if (gef~=61 or 65 or 69)&&(gef~=6f or 75 or 41)&&(gef==45 or 49 or 4f) ||(gef==55)
 {
 rtrue;
 }
rfalse;
];
dots
[rn_11d5c local0 ;
if (rn_11794(local0)~=03)
 {
 return (rn_11310(23));
 }
print (string) local0;
rtrue;
];

![_______________________________________________________________________];

[rn_11d74 local0 local1 ;
rfalse;
];

Realistically, this isn't a useful tool as it currently stands.


Having inspected a game from the outside, the obvious next step to to take it for a test drive.