Sherlock: annotated disassembly

Data

Prev: 8220 Up: Map Next: 840B
8259: Verb patterns: the verb number is the position in this table
54 eight-byte records, one per verb phrase the parser accepts, ended by $0000. Bytes 0-5 are up to three word slots: the low 12 bits are a dictionary offset (see the dictionary at 5DC0), the high 4 bits are flags (see below). Bytes 6-7 are a fourth word slot, laid out the same way: GO for the ten directions (so GO NORTH works), CLOSELY for verb 20 (EXAMINE CLOSELY) and FURIOUSLY for verb 30 (GO FURIOUSLY TO); the narrator prints this word first ('Furiously go to the old mill road'). The high nibbles of the four slots are the record's flags, gathered by A2BD into $A01D/$A01E.
The verb number is not stored anywhere: B1AB computes it from which record the parser matched, as (record - 8259) / 8 + 1, and stores it in $A033. DOWN=10, CARRY=11, CLOSE=14, DROP=16, ENTER=18, EXAMINE=19, FOLLOW=21, GET=23, GIVE TO=26, HAIL=31, INVENTORY=33, LOOK=34, SIT IN=40, TAKE=41, TELL=47, WAIT=49, WEAR=51, KILL=52, LOCK=53, UNLOCK=54).
GO NORTH works like NORTH, and EXAMINE CLOSELY LAMP is narrated 'You closely examine the oil lamp.' - the fourth word first - and takes five minutes; EXAMINE LAMP CAREFULLY (the adverb after the object) gets 'WHAT ?'.
The flag nibbles, as far as the code and the 54 records show. A2BD packs the first two slots' nibbles into $A01D and the last two into $A01E. $A01D bit 3 (first word, nibble bit 3): the verb takes a direct object - set for every transitive verb and for none of the directions, LOOK, INVENTORY, HELLO or WAIT HERE; the narrator prints a direct object only then (A3A5), and it is also bit 7 of the first word's reference, which is what B39C/$A01C copy, so ALL can only be used with such verbs. $A01D bit 2: the verb takes an indirect object - DROP IN, GIVE TO, PAY TO, PUT IN, PUT ON, TAKE FROM, TAKE OUT OF, TAKE TO, TELL, TELL ABOUT (A3E9). $A01D bit 5 (second word, nibble bit 1): the phrase's second word goes before the direct object - CLIMB INTO, GET OUT OF, GO TO, LOOK THROUGH, SIT IN, TALK TO, WAIT UNTIL and others (A3A9). $A01E bit 7 (fourth word, nibble bit 3, only CLIMB OUT OF and GET OUT OF): one more word before the object in the narration (A3AE). $A01D bit 0: the object need not be here - FOLLOW, COME WITH, the GO TOs, HAIL, TAKE OFF, TAKE TO, TELL - copied to $A038, which lets the thing search D36A skip its is-it-here test (B4DA, B581). $A01D bit 4: no 'You ...' narration at all (A326 jumps over it) - LOOK, INVENTORY, HELLO, ENTER, FOLLOW, COME WITH, GO INTO, the GO TOs, TAKE TO, TELL and WAIT UNTIL, whose own code says what happens. $A01E bits 2-3 both set (third word's nibble 12 or 13: WAIT UNTIL, PAY TO): the direct object is a number, requirement code 5 rather than 7 (C4A1); $A01E bits 0-1 both set do the same for the indirect object (C4C0), though no verb sets them. $A01E bit 4 (HAIL, CLIMB INTO): try every candidate for the second object rather than the first that fits ($B190, B2DF), and no ALL. $A01E bit 5 (GIVE TO, PAY TO): with no preposition typed, the second noun phrase is the direct object (B421) - so GIVE WATSON LAMP gives the lamp to Watson.
The indirect object is the same with bit 2, bit 6 and $A01E bits 0-1. So bit 7 (ENTER, GO INTO, the GO TOs) and bit 6 (TAKE TO) make that object's requirement code 4 - the code C6BE treats after the room codes - instead of an ordinary thing (7). Only bit 6 of $A01E is still unread.
8259 DEFB $C3,$05,$00,$00,$00,$00,$8D,$03 Verb 1: NORTH
8261 DEFB $1A,$08,$00,$00,$00,$00,$8D,$03 Verb 2: SOUTH
8269 DEFB $84,$02,$00,$00,$00,$00,$8D,$03 Verb 3: EAST
8271 DEFB $92,$09,$00,$00,$00,$00,$8D,$03 Verb 4: WEST
8279 DEFB $C7,$05,$00,$00,$00,$00,$8D,$03 Verb 5: NORTHEAST
8281 DEFB $D0,$05,$00,$00,$00,$00,$8D,$03 Verb 6: NORTHWEST
8289 DEFB $1E,$08,$00,$00,$00,$00,$8D,$03 Verb 7: SOUTHEAST
8291 DEFB $27,$08,$00,$00,$00,$00,$8D,$03 Verb 8: SOUTHWEST
8299 DEFB $3C,$09,$00,$00,$00,$00,$8D,$03 Verb 9: UP
82A1 DEFB $72,$02,$00,$00,$00,$00,$8D,$03 Verb 10: DOWN
82A9 DEFB $8B,$81,$00,$00,$00,$80,$00,$40 Verb 11: CARRY
82B1 DEFB $B2,$81,$77,$24,$00,$00,$00,$50 Verb 12: CLIMB INTO
82B9 DEFB $B2,$81,$20,$26,$EC,$05,$00,$C0 Verb 13: CLIMB OUT OF
82C1 DEFB $B7,$81,$00,$00,$00,$00,$00,$40 Verb 14: CLOSE
82C9 DEFB $F7,$81,$00,$00,$00,$00,$00,$40 Verb 15: COUNT
82D1 DEFB $7C,$82,$00,$00,$00,$80,$00,$00 Verb 16: DROP
82D9 DEFB $7C,$C2,$50,$04,$00,$00,$00,$40 Verb 17: DROP IN
82E1 DEFB $98,$82,$00,$90,$00,$00,$00,$00 Verb 18: ENTER
82E9 DEFB $CA,$82,$00,$00,$00,$00,$00,$40 Verb 19: EXAMINE
82F1 DEFB $CA,$82,$00,$00,$00,$00,$BE,$41 Verb 20: EXAMINE CLOSELY
82F9 DEFB $33,$93,$00,$10,$00,$40,$00,$00 Verb 21: FOLLOW
8301 DEFB $D4,$91,$BF,$39,$00,$40,$00,$00 Verb 22: COME WITH
8309 DEFB $81,$83,$00,$00,$00,$00,$00,$40 Verb 23: GET
8311 DEFB $81,$83,$77,$24,$00,$00,$00,$40 Verb 24: GET INTO
8319 DEFB $81,$83,$20,$26,$EC,$05,$00,$C0 Verb 25: GET OUT OF
8321 DEFB $89,$C3,$DB,$08,$00,$10,$00,$60 Verb 26: GIVE TO
8329 DEFB $8D,$83,$77,$B4,$00,$00,$00,$00 Verb 27: GO INTO
8331 DEFB $8D,$83,$CE,$28,$00,$00,$00,$00 Verb 28: GO THROUGH
8339 DEFB $8D,$93,$DB,$B8,$00,$00,$00,$40 Verb 29: GO TO
8341 DEFB $8D,$93,$DB,$B8,$00,$00,$63,$43 Verb 30: GO FURIOUSLY TO
8349 DEFB $BE,$93,$00,$00,$00,$00,$00,$10 Verb 31: HAIL
8351 DEFB $F5,$03,$00,$10,$00,$00,$00,$00 Verb 32: HELLO
8359 DEFB $7A,$04,$00,$10,$00,$00,$00,$40 Verb 33: INVENTORY
8361 DEFB $23,$05,$00,$10,$00,$00,$00,$00 Verb 34: LOOK
8369 DEFB $23,$85,$CE,$28,$00,$00,$00,$00 Verb 35: LOOK THROUGH
8371 DEFB $0B,$86,$00,$00,$00,$00,$00,$40 Verb 36: OPEN
8379 DEFB $64,$C6,$DB,$08,$00,$D0,$00,$20 Verb 37: PAY TO
8381 DEFB $E8,$C6,$50,$04,$00,$00,$00,$40 Verb 38: PUT IN
8389 DEFB $E8,$C6,$FF,$05,$00,$00,$00,$40 Verb 39: PUT ON
8391 DEFB $DD,$87,$50,$24,$00,$00,$00,$40 Verb 40: SIT IN
8399 DEFB $87,$88,$00,$00,$00,$00,$00,$40 Verb 41: TAKE
83A1 DEFB $87,$C8,$51,$03,$00,$00,$00,$40 Verb 42: TAKE FROM
83A9 DEFB $87,$98,$EF,$25,$00,$00,$00,$40 Verb 43: TAKE OFF
83B1 DEFB $87,$C8,$20,$06,$EC,$05,$00,$40 Verb 44: TAKE OUT OF
83B9 DEFB $87,$D8,$DB,$58,$00,$40,$00,$00 Verb 45: TAKE TO
83C1 DEFB $8B,$88,$DB,$28,$00,$40,$00,$00 Verb 46: TALK TO
83C9 DEFB $8F,$D8,$00,$10,$00,$40,$00,$00 Verb 47: TELL
83D1 DEFB $8F,$D8,$05,$10,$00,$40,$00,$00 Verb 48: TELL ABOUT
83D9 DEFB $5E,$09,$FF,$03,$00,$00,$00,$00 Verb 49: WAIT HERE
83E1 DEFB $5E,$89,$38,$39,$00,$C0,$00,$00 Verb 50: WAIT UNTIL
83E9 DEFB $83,$89,$00,$00,$00,$00,$00,$40 Verb 51: WEAR
83F1 DEFB $94,$04,$00,$00,$00,$00,$00,$00 Verb 52: KILL
83F9 DEFB $14,$85,$00,$00,$00,$00,$00,$40 Verb 53: LOCK
8401 DEFB $2B,$89,$00,$00,$00,$00,$00,$40 Verb 54: UNLOCK
8409 DEFB $00,$00 End marker
Prev: 8220 Up: Map Next: 840B