Routines
| Prev: B4A3 | Up: Map | Next: B4FD |
B4C1: The next candidate for the direct object ($A034)
|
Addresses named in the title: $A034.
Requirement code 5 ($A00F) means a number: the first time, if the slot holds one (bit 7 of $B173), $A034 = $FE and the number goes to $A02F. Otherwise searches rooms (codes below 5, D39B) or things (D36A) for the next one the slot's words name, continuing from $B17E. A = $FF when there are no more.
How it works:
2. If the slot's first word has bit 7 set, there is nothing to search: return $FF.
|
||||||||||||
| B4C1 | LD A,($A00F) | Read $A00F in "Game variables" into A - Direct object a number (requirement code 5)? | ||||||||||
| B4C4 | CP $05 | Compare A with $05 | ||||||||||
| B4C6 | JR Z,$B4A3 | Yes: the number case at B4A3 | ||||||||||
| B4C8 | LD A,($B173) | Read $B173 in "Parser variables" into A - First word of the direct-object slot has bit 7 set? | ||||||||||
| B4CB | BIT 7,A | Test bit 7 of A | ||||||||||
| B4CD | JR Z,$B4D4 | No: search for things | ||||||||||
|
This entry point is used by the routine at B4A3.
|
||||||||||||
| B4CF | LD A,$FF | Load A with $FF - Yes: nothing to search, return A = $FF | ||||||||||
| B4D1 | CP $FF | Compare A with $FF | ||||||||||
| B4D3 | RET | Return to the caller | ||||||||||
| B4D4 | PUSH IY | Save IY on the stack - Save IY; IX = the search position ($B17E) | ||||||||||
| B4D6 | LD IX,($B17E) | Read $B17E in "Parser variables" into IX | ||||||||||
| B4DA | LD A,($A01D) | Read $A01D in "Game variables" into A - Verb flag $A01D bit 0 (the object need not be here) into $A038 | ||||||||||
| B4DD | AND $01 | Isolate bit 0 of A (mask $01) | ||||||||||
| B4DF | LD ($A038),A | Store A in $A038 in "Game variables" | ||||||||||
| B4E2 | LD A,($A00F) | Read $A00F in "Game variables" into A - Requirement code below 5: search rooms (D39B), otherwise things (D36A) | ||||||||||
| B4E5 | CP $05 | Compare A with $05 | ||||||||||
| B4E7 | LD IY,$D39B | Point IY at "Find the next room that matches a word slot of..." (D39B) - IY = the room search, or... | ||||||||||
| B4EB | JR C,$B4F1 | If A is below $05, skip ahead to B4F1 | ||||||||||
| B4ED | LD IY,$D36A | ...the thing search - IY is no longer the parse node, which B517 still assumes (the ALL BUT bug) | ||||||||||
| B4F1 | CALL $B4FD | Call the routine "Next thing or room the direct-object slot names,..." (B4FD) - Run the search for the next match (B4FD) | ||||||||||
| B4F4 | CP $FF | Compare A with $FF | ||||||||||
| B4F6 | LD ($B17E),IX | Store IX in $B17E in "Parser variables" - Save the new position; Z/NZ: found something or not | ||||||||||
| B4FA | POP IY | Restore IY from the stack | ||||||||||
| B4FC | RET | Return | ||||||||||
| Prev: B4A3 | Up: Map | Next: B4FD |