Prev: D349 Up: Map Next: D36A
D34E: Search Three-Byte Length Table
Input
A Table ID to match
IX Table to search
Output
A Entry ID or FF for no entry found
IX Pointer to found entry
F The zero flag is set when no entry was found
SearchThreeByteTable D34E EXX Switch to the shadow registers.
D34F LD E,$03 Set the length of the data in E (03 bytes).
This entry point is used by the routine at SearchTwoByteTable.
SearchTable_Start D351 PUSH IX Copy the table for searching into HL (using the stack).
D353 POP HL
D354 LD B,A Copy the table ID into B.
D355 LD D,$00 Reset D to 00 for the length offset calculation.
SearchTable_Loop D357 LD A,(HL) Fetch a byte from the table.
D358 CP B Jump to SearchTable_Return if the byte is the table ID we're searching for or if the termination character has been reached (FF).
D359 JR Z,SearchTable_Return
D35B CP $FF
D35D JR Z,SearchTable_Return
D35F ADD HL,DE Move to the next table entry.
D360 JP SearchTable_Loop Jump back to SearchTable_Loop.
Either the table ID was matched, or the terminator was reached.
SearchTable_Return D363 PUSH HL Copy the table pointer into IX (using the stack).
D364 POP IX
D366 CP $FF Set the zero flag if the termination character was reached (FF).
D368 EXX Switch back to the normal registers.
D369 RET Return.
Prev: D349 Up: Map Next: D36A