Routines
| Prev: C4B2 | Up: Map | Next: C542 |
C4D1: Carry out the command in $A033-$A035 for the current actor
|
How it works:
1. A verb number with bit 7 set is a script-only verb: use the numbered record (C583).
2. Otherwise find the verb's pattern record (A2B1), gather its flags (A2BD), and set the two objects' requirement codes (C493, C4B2).
3. If a number is required, the object must be $FE. If a required direct object is still $FF, ask for it.
4.
|
||||||||||||||||
| C4D1 | LD A,($A033) | The verb number ($A033): bit 7 set means a script-only verb (C583) | ||||||||||||||
| C4D4 | BIT 7,A | A script-only verb (128 and up)? | ||||||||||||||
| C4D6 | JP NZ,$C583 | Yes: C583 | ||||||||||||||
| C4D9 | CALL $A2B1 | Call the routine "HL = verb A's record in the verb table" (A2B1) - Its pattern record (A2B1) into IX; set the verb flags (A2BD) | ||||||||||||||
| C4DC | PUSH HL | Save HL on the stack | ||||||||||||||
| C4DD | POP IX | Restore IX from the stack | ||||||||||||||
| C4DF | CALL $A2BD | Call the routine "Gather a verb record's flag nibbles into $A01D and..." (A2BD) | ||||||||||||||
| C4E2 | CALL $C493 | Requirement codes of the two objects (C493, C4B2) | ||||||||||||||
| C4E5 | CALL $C4B2 | ...and the indirect object | ||||||||||||||
| C4E8 | XOR A | Clear A to zero (and the carry flag) - $A00B = 0 | ||||||||||||||
| C4E9 | LD ($A00B),A | Store A in $A00B in "Game variables" | ||||||||||||||
| C4EC | LD A,($A01D) | Read $A01D in "Game variables" into A - Verb takes no objects ($A01D bits 2-3 clear)? | ||||||||||||||
| C4EF | AND $0C | Keep only bits 2, 3 of A (mask $0C) | ||||||||||||||
| C4F1 | JR Z,$C53A | Yes: run it as it is (C53A) | ||||||||||||||
| C4F3 | LD A,($A00F) | Read $A00F in "Game variables" into A - Direct object a number (code 5)? Then $A034 must be $FE... | ||||||||||||||
| C4F6 | CP $05 | Compare A with $05 | ||||||||||||||
| C4F8 | JR NZ,$C502 | If A differs from $05, skip ahead to C502 | ||||||||||||||
| C4FA | LD A,($A034) | Read $A034 in "Game variables" into A | ||||||||||||||
| C4FD | CP $FE | Compare A with $FE | ||||||||||||||
| C4FF | JP NZ,$CB41 | ...else refuse (Z) | ||||||||||||||
| C502 | LD A,($A010) | Read $A010 in "Game variables" into A - Same for the indirect object and $A035 | ||||||||||||||
| C505 | CP $05 | Compare A with $05 | ||||||||||||||
| C507 | JR NZ,$C511 | If A differs from $05, skip ahead to C511 | ||||||||||||||
| C509 | LD A,($A035) | Read $A035 in "Game variables" into A | ||||||||||||||
| C50C | CP $FE | Compare A with $FE | ||||||||||||||
| C50E | JP NZ,$CB41 | If A differs from $FE, jump on to the routine "Return Z (does nothing)" (CB41) | ||||||||||||||
| C511 | LD A,($A00F) | Read $A00F in "Game variables" into A - Does the verb want a direct object, and is $A034 still $FF? | ||||||||||||||
| C514 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||||
| C515 | JR Z,$C531 | If A is zero, skip ahead to C531 | ||||||||||||||
| C517 | LD A,($A034) | Read $A034 in "Game variables" into A - Needs an object but none given? | ||||||||||||||
| C51A | CP $FF | Compare A with $FF | ||||||||||||||
| C51C | JR NZ,$C531 | If A differs from $FF, skip ahead to C531 | ||||||||||||||
| C51E | LD B,$FF | (C463 ends the loop) | ||||||||||||||
| C520 | INC B | Add one to B - Try the next candidate | ||||||||||||||
| C521 | CALL $C463 | Call C463 (inside "Is B below the last number for this object...") | ||||||||||||||
| C524 | RET Z | If the zero flag is set, return | ||||||||||||||
| C525 | LD ($A034),A | Store A in $A034 in "Game variables" - Try the candidate as the direct object | ||||||||||||||
| C528 | PUSH BC | Save BC on the stack | ||||||||||||||
| C529 | CALL $C55A | |||||||||||||||
| C52C | POP BC | Restore BC from the stack | ||||||||||||||
| C52D | JR NZ,$C53A | Worked: run it (C53A) | ||||||||||||||
| C52F | JR $C520 | Else the next candidate | ||||||||||||||
| C531 | CALL $C542 | |||||||||||||||
| C534 | JR Z,$C53A | If the zero flag is set, skip ahead to C53A | ||||||||||||||
| C536 | CALL $C560 | |||||||||||||||
| C539 | RET Z | If the zero flag is set, return | ||||||||||||||
| C53A | LD A,$01 | Load A with $01 - $A00B = 1, then find and run the action record (C929) | ||||||||||||||
| C53C | LD ($A00B),A | Store A in $A00B in "Game variables" | ||||||||||||||
| C53F | JP $C929 | Jump on to the routine "Check the action record against the command's..." (C929) | ||||||||||||||
| Prev: C4B2 | Up: Map | Next: C542 |