Prev: 59768 Up: Map Next: 59807
59790: Event Routing
Used by the routine at ChangeRoom.
Input
DE Pointer to a list of action routines
HL Pointer to a list of room IDs
BC The number of items in the lists (they match)
A Room ID for searching
EventRouting 59790 PUSH BC Stash the item count on the stack.
59791 CPIR Search for the room ID in the table.
At this point, if the room ID is found, BC contains the index in the table of where it is location.
59793 POP HL Restore the item count into HL from the stack.
59794 RET NZ Return if the room ID wasn't found in the table.
The room ID was found in the table, so jump to the appropriate action.
59795 PUSH DE Load the actions table into IX (using the stack).
59796 POP IX
59798 INC BC Adjust the room index for the sum.
59799 AND A Subtract the room index from the item count.
59800 SBC HL,BC
59802 LD E,L Load the index into E to find the appropriate action routine.
59803 CALL GetTableEntry Call GetTableEntry.
59806 JP (HL) Jump to the action routine held in *HL.
Prev: 59768 Up: Map Next: 59807