Prev: 820B Up: Map Next: 8271
8251: Command: Match A Special Key
Matches a special key such as save, load or inventory. Reached through the jump table at JumpTable, dispatched from 75D0.
Command_MatchASpecialKey 8251 LD HL,$8271 Point at the special-key table.
8254 PUSH DE Thirteen entries.
8255 LD D,$0D
Command_MatchASpecialKey_Loop 8257 LD A,(HL) Jump to Command_MatchASpecialKey_Next if this entry's first byte is not the key.
8258 INC HL
8259 CP C
825A JR NZ,Command_MatchASpecialKey_Next
825C LD A,(HL) Jump to Command_MatchASpecialKey_JumpToTheHandler if the second byte matches as well.
825D CP B
825E JR Z,Command_MatchASpecialKey_JumpToTheHandler
Command_MatchASpecialKey_Next 8260 INC HL Step to the next pair, and loop back to Command_MatchASpecialKey_Loop until all 0D entries have been tried.
8261 DEC D
8262 JR NZ,Command_MatchASpecialKey_Loop
8264 JP InglishPrepareTheClause_2 Jump to InglishPrepareTheClause_2 when no special key matched.
Command_MatchASpecialKey_JumpToTheHandler 8267 LD DE,$0019 The handler word sits 19 bytes after the matched pair.
826A ADD HL,DE
826B LD E,(HL) Read the low byte of that handler.
826C INC HL Step on to its high byte.
826D LD D,(HL) Read the high byte of the handler.
826E EX DE,HL Take the handler address.
826F POP DE Jump to the handler this key selected.
8270 JP (HL)
View the equivalent code in;
Prev: 820B Up: Map Next: 8271