Prev: D589 Up: Map Next: D599
D593: Jump to the routine a table gives for A
The second piece of the tape's protection. Every table of routines in the game is reached through here -- the main loop's update of each object record by its graphic (UPDATES), the depth sort's outcomes (DEPTH_TABLE), a monster struck by an antibody (MONSTER_HIT_TABLE), and three small tables by the knight's facing (COAST_TABLE, TURN_TO_KNIGHT_TABLE, MOVE_TABLE) -- and the jump is not made here: the routine's address goes into HL and the game jumps to NMIADD, the system variable NMIADD, which holds JP (HL) only because the tape loaded that one byte there.
The ROM leaves NMIADD at zero. Without the tape's byte the jump would run the system variables' own bytes as code, and the game would crash at the first update of its first turn: a copy that got past the check at START but left out the byte would still not play.
The routine returns to DISPATCH's caller, or, where DISPATCH was jumped to, to its caller's caller.
Input
A the index
BC the table
DISPATCH D593 CALL TABLE_WORD HL = the routine (TABLE_WORD)
D596 JP NMIADD JP (HL), by way of the tape's byte in NMIADD
Prev: D589 Up: Map Next: D599