Prev: 7E13 Up: Map Next: 7E93
7E7E: Jump to the handler for whatever this actor is
Used by the routine at MAIN_LOOP.
Looks the actor's +$00 byte up in ACTOR_HANDLERS and jumps to the address it finds. This is why so many of the per-creature routines have nothing referencing them anywhere in the disassembly -- they are only ever reached from that table, which to a disassembler is just data.
The jump itself is worth a look. Rather than an equivalent sequence ending in JP (HL), the routine jumps to $5CB0 -- an address in the system variables, well outside the game. What lives there is a single $E9 byte, which is the opcode for JP (HL), and it got there because one of the five blocks on the tape is one byte long and loads to exactly that address. So the dispatch runs through an instruction the loader poked into spare ROM-variable space, and a loader that skips that block leaves the game jumping into whatever happened to be at $5CB0.
Input
IX The actor
DISPATCH_ACTOR 7E7E PUSH HL The caller left the address to come back to in HL, and this puts it on the stack -- so the handler's own RET returns into MAIN_LOOP, and the dispatch itself costs a jump rather than a call.
This entry point is used by the routine at FRAME_TICK.
DISPATCH_PUSHED 7E7F LD HL,ACTOR_HANDLERS The table.
This entry point is used by the routine at DISPATCH_FROM_LIST.
DISPATCH_IN_TABLE 7E82 LD C,(IX+$00) The actor's sprite byte doubles as its type.
This entry point is used by the routine at DRAW_SPRITE_PIXELS.
DISPATCH_TYPE_C 7E85 LD B,$00 Two bytes per entry, so double the index -- through B as well, since types run past $7F.
7E87 SLA C
7E89 RL B
7E8B ADD HL,BC
7E8C LD A,(HL) Fetch the handler address into HL.
7E8D INC HL
7E8E LD H,(HL)
7E8F LD L,A
7E90 JP $5CB0 The poked JP (HL).
Prev: 7E13 Up: Map Next: 7E93