Prev: 9D97 Up: Map Next: 9DD9
9DBD: Index ID Table
Input
A Key ID
IX Address of table data
Output
IX The address in the table which matches the key ID
Searches through what is essentially key value data to find a key match.
IndexIdTable 9DBD EXX Exchange registers.
9DBE PUSH IX Point HL at the table in IX and keep the sought id in B.
9DC0 POP HL
9DC1 LD B,A
9DC2 LD E,$03 Each index entry is 03 bytes.
9DC4 LD D,$00 The index stride's high byte is zero.
Begin searching the table.
IndexIdTable_Loop 9DC6 LD A,(HL) Grab the next ID.
9DC7 CP B Jump to IndexIdTable_Found if this entry's id is the one sought.
9DC8 JR Z,IndexIdTable_Found
9DCA CP $FF Jump to IndexIdTable_Found at the end of the index.
9DCC JR Z,IndexIdTable_Found
9DCE ADD HL,DE Step 03 bytes to the next id.
9DCF JP IndexIdTable_Loop Jump back to IndexIdTable_Loop to begin searching the table.
Handle the output.
IndexIdTable_Found 9DD2 PUSH HL Set flags (checking if the key ID was not found).
9DD3 POP IX
9DD5 CP $FF
9DD7 EXX Exchange registers.
9DD8 RET Return.
View the equivalent code in;
Prev: 9D97 Up: Map Next: 9DD9