I am trying to understand the Z-Machine specification and I have been going through the chapter 12 of the Z-Machine specification which talks about objects and properties. I have come across the PUT_PROP command that I have been trying to work out. I have been using the Zork 1 game file. According to the spec, the defaults table is located at $0a:
00000000 03 00 00 77 4b 54 50 d5 38 99 03 e6 02 b0 2c 12
So in the case of the Zork 1 game file, the defaults table is found at address $03e6. The PUT_PROP command in question is:
510a: put_prop #d0 #06 #04
Going to the defaults table, adding 31 words (62 bytes) to the start of the address of the defaults table gives me $424 as the start of the objects. Doing the following, $424 + ($d08*9) + 7 to get me to the address for the start of the properties of $d0 gives me address $0b7b:
00000b70 00 b4 1f b9 02 40 10 00 27 89 00 1f d9 00 07 00
Which contains address $1fd9. Going to address $1fd9 to find the properties:
00001fd0 00 14 2a 00 64 26 00 04 00 05 13 14 6b 2d 00 2a
00001fe0 11 b4 eb 0a 3f a0 aa 1e 55 1d 40 1c dd 1b 55 1a
00001ff0 40 2b a4 1a 65 d5 4d 41 01 00 02 1e 91 e4 a5 72
The first byte of the object properties gives the size in words of the text description so skipping 10 bytes gets me to address $1fe4 which contains the byte $3f.
Referencing the put_prop command, I am looking for property number 6. As I understand the process, I multiple the number of bytes that are contained in the property by 32, subtract 1 and then adding the property number. Hoping that there won’t be more than 7 bytes length for a property (even though the spec says that there can be 8), I peel off the 3 left most bits as the number that represents the number of bytes in the property and work my way through the object’s property hoping that there exists a number 5 (property number 6 minus 1). I end up at address $1ff3 which has value $1a at which point I am dead in the water.
I know that I am doing something wrong given the huge number of interpreters working out there. I am hoping that one of you can tell me what it is that I am doing wrong.