Routines |
Prev: 9D97 | Up: Map | Next: 9DD9 |
Used by the routines at Start, Drawing, DisplayLocHlpMsg, Action_Dir, Action_Examine, 9A85, 9B81, LocateObject and ActionClimbOut.
|
||||||||||||||
Searches through what is essentially key value data to find a key match.
|
||||||||||||||
IndexIdTable | 9DBD | EXX | Exchange registers. | |||||||||||
9DBE | PUSH IX | HL=IX (using the stack to do so). | ||||||||||||
9DC0 | POP HL | |||||||||||||
9DC1 | LD B,A | B=key ID | ||||||||||||
9DC2 | LD E,$03 | DE=$0003 as each record is 3 bytes of data. | ||||||||||||
9DC4 | LD D,$00 | |||||||||||||
Begin searching the table.
|
||||||||||||||
IndexIdTable_Loop | 9DC6 | LD A,(HL) | Grab the next ID. | |||||||||||
9DC7 | CP B | If the key ID is the one we want, jump to IndexIdTable_Found. | ||||||||||||
9DC8 | JR Z,IndexIdTable_Found | |||||||||||||
9DCA | CP $FF | If we've reached the termination character (key ID not found), jump to IndexIdTable_Found. | ||||||||||||
9DCC | JR Z,IndexIdTable_Found | |||||||||||||
9DCE | ADD HL,DE | Add DE to HL to check the next row, and jump back to IndexIdTable_Loop to continue checking. | ||||||||||||
9DCF | JP IndexIdTable_Loop | |||||||||||||
Handle the output.
|
||||||||||||||
IndexIdTable_Found | 9DD2 | PUSH HL | IX=HL (using the stack to do so). | |||||||||||
9DD3 | POP IX | |||||||||||||
9DD5 | CP $FF | Set flags (checking if the key ID was not found). | ||||||||||||
9DD7 | EXX | Exchange registers. | ||||||||||||
9DD8 | RET | Return. |
Prev: 9D97 | Up: Map | Next: 9DD9 |