Prev: B79E Up: Map Next: B800
B7D3: Handler: Dispatch Matching Phrase
Find the phrase pattern that matches the command and jump to its handler.
Handler_DispatchPhrase B7D3 PUSH HL Copy the phrase table from HL into IX.
B7D4 POP IX
Handler_DispatchPhrase_Loop B7D6 LD L,(IX+$00) Call MatchPhraseTokens to match the phrase tokens.
B7D9 LD H,(IX+$01)
B7DC PUSH IX
B7DE PUSH DE
B7DF PUSH BC
B7E0 CALL MatchPhraseTokens
B7E3 POP BC Restore the phrase count and the handler and phrase table pointers from the stack.
B7E4 POP DE
B7E5 POP IX
B7E7 JR NZ,Handler_DispatchPhrase_Next Try the next phrase when this one does not match.
B7E9 PUSH DE Copy the handler address from DE into IX.
B7EA POP IX
B7EC LD L,(IX+$00) Read the handler for this phrase.
B7EF LD H,(IX+$01)
B7F2 POP DE Drop the return address into the action routine, so the phrase handler returns straight to its caller.
B7F3 JP (HL) Jump to the handler address now in HL.
Handler_DispatchPhrase_Next B7F4 INC IX Step to the next phrase entry.
B7F6 INC IX
B7F8 INC DE Advance DE to the next byte.
B7F9 INC DE Advance DE to the next byte.
B7FA DEC BC Move BC back one byte.
B7FB LD A,B See whether another phrase remains.
B7FC OR C
B7FD JR NZ,Handler_DispatchPhrase_Loop Match the next phrase.
B7FF RET Return.
Prev: B79E Up: Map Next: B800