Prev: 9A9F Up: Map Next: 9ADB
9AC7: Call the routine at HL (if HL is not 0)
A general dispatcher used throughout the game for tables of routine addresses (the room-entry handlers, the timer table, the character table). All registers except AF are preserved, and a zero address means 'no routine', so tables can leave entries empty. The actual call is made by the JP (HL) at 9ADB.
Input
HL Routine address, or 0
9AC7 PUSH IX Save every register the routine we are about to call might disturb...
9AC9 PUSH IY
9ACB PUSH DE
9ACC PUSH BC
9ACD PUSH HL ...including HL itself, which holds the address to call
9ACE LD A,L Is that address 0, meaning "there is nothing to call"?
9ACF OR H
9AD0 CALL NZ,$9ADB If it is not 0, make the call
9AD3 POP HL Restore the registers, in the same order they were saved...
9AD4 POP BC
9AD5 POP DE
9AD6 POP IY
9AD8 POP IX
9ADA RET
Prev: 9A9F Up: Map Next: 9ADB