Routines
| Prev: B39C | Up: Map | Next: B405 |
B39D: Look the typed verb up in the verb table ($8259)
|
Addresses named in the title: 8259.
Takes the verb's two word references from IY (bit 7 of the first kept in B39C), clears and fills a match pattern at $B186-B18D (B483), then walks the 8-byte verb records from 8259 comparing each (A4CD) until one matches - then B405 and NZ - or the zero record that ends the table (Z).
How it works:
1. Take the verb's word reference from the parse node. Bit 7 of it says ALL was typed with the verb; keep that in B39C and clear it.
2. Build the pattern to match at $B186-B18D: the verb word, the particle at node +2 (CLOSELY, FURIOUSLY, a direction), and up to two more words from the node's other slots (B483).
4. On a match, fill the object slots (B405) and return NZ. If the zero record that ends the table is reached, return Z.
|
||||||||||||
| B39D | PUSH IY | Save IY on the stack | ||||||||||
| B39F | LD L,(IY+$00) | Read the first byte of the record at IY into L - The verb word, from the node's +0 | ||||||||||
| B3A2 | LD H,(IY+$01) | Read byte +1 of the record at IY into H | ||||||||||
| B3A5 | LD A,H | Copy H into A - Its bit 7 (ALL was typed with it) goes to B39C | ||||||||||
| B3A6 | AND $80 | Isolate bit 7 of A (mask $80) | ||||||||||
| B3A8 | LD ($B39C),A | Store A in "B39D: bit 7 of the verb's first word reference" (B39C) | ||||||||||
| B3AB | RES 7,H | Clear bit 7 of H | ||||||||||
| B3AD | LD ($B186),HL | Pattern word 1 ($B186) | ||||||||||
| B3B0 | LD L,(IY+$02) | Read byte +2 of the record at IY into L - The node's +2 (CLOSELY, FURIOUSLY, GO...) is pattern word 4 ($B18C) | ||||||||||
| B3B3 | LD H,(IY+$03) | Read byte +3 of the record at IY into H | ||||||||||
| B3B6 | LD ($B18C),HL | Store HL in $B18C in "Parser variables" | ||||||||||
| B3B9 | LD HL,$B188 | Point HL at $B188 in "Parser variables" - Clear pattern words 2 and 3 ($B188, $B18A) | ||||||||||
| B3BC | PUSH HL | Save HL on the stack | ||||||||||
| B3BD | LD B,$04 | Load B with $04 | ||||||||||
| B3BF | CALL $A2AB | Call the routine "Fill B bytes at HL with zero (or, from A2AC, with A)" (A2AB) | ||||||||||
| B3C2 | POP HL | Restore HL from the stack | ||||||||||
| B3C3 | LD B,$02 | Load B with $02 - Fill them with the first two of the node's words at +4, +14, +6 and +16 that are there (B483) | ||||||||||
| B3C5 | LD E,$04 | Load E with $04 | ||||||||||
| B3C7 | CALL $B483 | Call the routine "Copy the word pair at IY + E to HL, if B is not 0" (B483) | ||||||||||
| B3CA | LD E,$0E | Load E with $0E | ||||||||||
| B3CC | CALL $B483 | Call the routine "Copy the word pair at IY + E to HL, if B is not 0" (B483) | ||||||||||
| B3CF | LD E,$06 | Load E with $06 | ||||||||||
| B3D1 | CALL $B483 | Call the routine "Copy the word pair at IY + E to HL, if B is not 0" (B483) | ||||||||||
| B3D4 | LD E,$10 | Load E with $10 | ||||||||||
| B3D6 | CALL $B483 | Call the routine "Copy the word pair at IY + E to HL, if B is not 0" (B483) | ||||||||||
| B3D9 | XOR A | Clear A to zero (and the carry flag) - $A02E = 0 | ||||||||||
| B3DA | LD ($A02E),A | Store A in $A02E in "Game variables" | ||||||||||
| B3DD | LD HL,$B186 | Point HL at $B186 in "Parser variables" - Try each 8-byte verb record from 8259 | ||||||||||
| B3E0 | LD DE,$0008 | Load DE with $0008 | ||||||||||
| B3E3 | LD IX,$8259 | Point IX at "Verb patterns: the verb number is the position in..." (8259) | ||||||||||
| B3E7 | PUSH IX | Save IX on the stack | ||||||||||
| B3E9 | POP IY | Restore IY from the stack | ||||||||||
| B3EB | CALL $A4CD | Call the routine "Do the pattern words at IY name the words at HL?..." (A4CD) - Does it match the pattern (A4CD)? | ||||||||||
| B3EE | JR Z,$B3FD | If the zero flag is set, skip ahead to B3FD | ||||||||||
| B3F0 | ADD IX,DE | Add DE to IX - No: next record, until the zero one at the end | ||||||||||
| B3F2 | LD A,(IX+$01) | Read byte +1 of the record at IX into A | ||||||||||
| B3F5 | OR (IX+$00) | Set in A the bits that are set in the first byte of the record at IX | ||||||||||
| B3F8 | JR NZ,$B3E7 | If the result is not zero, go back to B3E7 | ||||||||||
| B3FA | POP IY | Restore IY from the stack - None matched: Z | ||||||||||
| B3FC | RET | Return to the caller | ||||||||||
| B3FD | POP IY | Restore IY from the stack - Matched: fill the object slots (B405) and return NZ | ||||||||||
| B3FF | CALL $B405 | Call the routine "Copy the typed objects into the two object slots, in..." (B405) | ||||||||||
| B402 | OR $01 | Make A non-zero, which clears the zero flag, and hand that back to the caller | ||||||||||
| B404 | RET | Return to the caller | ||||||||||
| Prev: B39C | Up: Map | Next: B405 |