Routines
| Prev: A4BC | Up: Map | Next: A51B |
A4CD: Do the pattern words at IY name the words at HL? ($A4CD, $A4E0)
|
Addresses named in the title: A4E0.
NZ means no match. A4CD first requires the fourth pair (six bytes on) to match, and is used by the verb lookup ($B3EC); A4E0 by the thing and room searches ($D37B, $D3B8) and the scenery check ($B764).
How it works:
1. A4CD tries the fourth pair of the pattern first, six bytes on; if it fails, the whole match fails.
2. A4E0 then needs the first pair to match (A51B; an empty pattern word matches anything) and notes that in $A02E.
3.
4.
|
||||||||||||||||||
| A4CD | PUSH DE | Save DE on the stack | ||||||||||||||||
| A4CE | PUSH HL | Save HL on the stack | ||||||||||||||||
| A4CF | PUSH IY | Save IY on the stack | ||||||||||||||||
| A4D1 | LD DE,$0006 | Load DE with $0006, the amount that is added next - The fourth pair first (six bytes on) | ||||||||||||||||
| A4D4 | ADD HL,DE | Add DE to HL | ||||||||||||||||
| A4D5 | ADD IY,DE | Add DE to IY | ||||||||||||||||
| A4D7 | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) | ||||||||||||||||
| A4DA | JR NZ,$A516 | If the zero flag is clear, jump on to A516 - (no match: NZ) | ||||||||||||||||
| A4DC | POP IY | Restore IY from the stack | ||||||||||||||||
| A4DE | POP HL | Restore HL from the stack | ||||||||||||||||
| A4DF | POP DE | Restore DE from the stack | ||||||||||||||||
|
This entry point is used by the routines at B6FD, D36A and D39B.
|
||||||||||||||||||
| A4E0 | PUSH DE | Save DE on the stack | ||||||||||||||||
| A4E1 | PUSH HL | Save HL on the stack | ||||||||||||||||
| A4E2 | PUSH IY | Save IY on the stack | ||||||||||||||||
| A4E4 | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) - A4E0: the first pair must match | ||||||||||||||||
| A4E7 | JR NZ,$A516 | If the zero flag is clear, jump on to A516 | ||||||||||||||||
| A4E9 | LD A,$01 | Load A with $01 - ($A02E = 1: the first word matched) | ||||||||||||||||
| A4EB | LD ($A02E),A | Store A in $A02E in "Game variables" | ||||||||||||||||
| A4EE | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) - Second and third pairs as they are: A = 0 | ||||||||||||||||
| A4F1 | JR NZ,$A4FA | If the zero flag is clear, skip ahead to A4FA | ||||||||||||||||
| A4F3 | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) | ||||||||||||||||
| A4F6 | LD A,$00 | Load A with $00 | ||||||||||||||||
| A4F8 | JR Z,$A516 | If the zero flag is set, skip ahead to A516 | ||||||||||||||||
| A4FA | POP IY | Restore IY from the stack - Or swapped: the pattern's third against the words' second... | ||||||||||||||||
| A4FC | POP HL | Restore HL from the stack | ||||||||||||||||
| A4FD | PUSH HL | Save HL on the stack | ||||||||||||||||
| A4FE | PUSH IY | Save IY on the stack | ||||||||||||||||
| A500 | LD DE,$0004 | Load DE with $0004, the amount that is added next | ||||||||||||||||
| A503 | ADD IY,DE | Add DE to IY | ||||||||||||||||
| A505 | INC HL | Step HL on to the next byte | ||||||||||||||||
| A506 | INC HL | Step HL on to the next byte | ||||||||||||||||
| A507 | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) | ||||||||||||||||
| A50A | JR NZ,$A516 | If the zero flag is clear, skip ahead to A516 | ||||||||||||||||
| A50C | LD DE,$FFFC | Load DE with $FFFC (-4 as a signed offset), the amount that is added next - ...and its second against their third: A = 1 | ||||||||||||||||
| A50F | ADD IY,DE | Add DE to IY | ||||||||||||||||
| A511 | CALL $A51B | Call the routine "Does the word reference at HL match the one at IY? (Z)" (A51B) | ||||||||||||||||
| A514 | LD A,$01 | Load A with $01 | ||||||||||||||||
| A516 | POP IY | Restore IY from the stack | ||||||||||||||||
| A518 | POP HL | Restore HL from the stack | ||||||||||||||||
| A519 | POP DE | Restore DE from the stack | ||||||||||||||||
| A51A | RET | Return to the caller | ||||||||||||||||
| Prev: A4BC | Up: Map | Next: A51B |