Prev: 45225 Up: Map Next: 45323
45278: Action Routing
Input
HL Table of pointers which reference item groups
DE Jump table of pointers which action each reference in HL
BC Count of the number of table items to process
ActionRouting 45278 PUSH HL Load the item group table into IX (using the stack).
45279 POP IX
Keep looping until a match is found.
ActionRouting_Loop 45281 LD L,(IX+0) Fetch the phrase tokens from the item group and store the pointer in HL.
45284 LD H,(IX+1)
45287 PUSH IX Stash the item group table, the pointer to the jump table and the table items counter on the stack.
45289 PUSH DE
45290 PUSH BC
45291 CALL MatchPhraseTokens Call MatchPhraseTokens.
45294 POP BC Restore the table items counter, the pointer to the jump table and the item group table from the stack.
45295 POP DE
45296 POP IX
Skip to the next set of phrase tokens if nothing matched...
45298 JR NZ,ActionRouting_Next Jump to ActionRouting_Next if none of the input matches this set of phrase tokens.
The phrase tokens matched! Handle jumping to the action routine.
45300 PUSH DE Load the action table into IX (using the stack).
45301 POP IX
45303 LD L,(IX+0) Fetch the action routine from the table and store it in HL.
45306 LD H,(IX+1)
45309 POP DE Discard the return address on the stack.
45310 JP (HL) Jump to the action routine pointed to by *HL.
Nothing matched, so move to the next set of pointers.
ActionRouting_Next 45311 INC IX Move to the next pointer in the item group table.
45313 INC IX
45315 INC DE Move to the next pointer in the action pointers table.
45316 INC DE
45317 DEC BC Decrease the table items counter by one.
45318 LD A,B Jump back to ActionRouting_Loop until all the item groups have been processed.
45319 OR C
45320 JR NZ,ActionRouting_Loop
45322 RET Return.
Prev: 45225 Up: Map Next: 45323