![]() |
Routines |
Prev: B0A9 | Up: Map | Next: B10B |
Used by the routines at Action_Examine, Action_Get, Action_Take, Action_Drop, Action_Give, ActionJoint_GiveThrow, Action_Throw, Action_Free, Action_Drink, Action_Jump, Action_Climb, Action_Enter, Action_Wear, Action_Go, Action_Eat, Action_Capture, Action_Place, Action_Buy, Action_Step, Action_Kill and Action_Swim.
|
||||||||||||
ActionRouting | B0DE | PUSH HL | Load the item group table into IX (using the stack). | |||||||||
B0DF | POP IX | |||||||||||
Keep looping until a match is found.
|
||||||||||||
ActionRouting_Loop | B0E1 | LD L,(IX+$00) | Fetch the phrase tokens from the item group and store the pointer in HL. | |||||||||
B0E4 | LD H,(IX+$01) | |||||||||||
B0E7 | PUSH IX | Stash the item group table, the pointer to the jump table and the table items counter on the stack. | ||||||||||
B0E9 | PUSH DE | |||||||||||
B0EA | PUSH BC | |||||||||||
B0EB | CALL MatchPhraseTokens | Call MatchPhraseTokens. | ||||||||||
B0EE | POP BC | Restore the table items counter, the pointer to the jump table and the item group table from the stack. | ||||||||||
B0EF | POP DE | |||||||||||
B0F0 | POP IX | |||||||||||
Skip to the next set of phrase tokens if nothing matched...
|
||||||||||||
B0F2 | 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.
|
||||||||||||
B0F4 | PUSH DE | Load the action table into IX (using the stack). | ||||||||||
B0F5 | POP IX | |||||||||||
B0F7 | LD L,(IX+$00) | Fetch the action routine from the table and store it in HL. | ||||||||||
B0FA | LD H,(IX+$01) | |||||||||||
B0FD | POP DE | Discard the return address on the stack. | ||||||||||
B0FE | JP (HL) | Jump to the action routine pointed to by *HL. | ||||||||||
Nothing matched, so move to the next set of pointers.
|
||||||||||||
ActionRouting_Next | B0FF | INC IX | Move to the next pointer in the item group table. | |||||||||
B101 | INC IX | |||||||||||
B103 | INC DE | Move to the next pointer in the action pointers table. | ||||||||||
B104 | INC DE | |||||||||||
B105 | DEC BC | Decrease the table items counter by one. | ||||||||||
B106 | LD A,B | Jump back to ActionRouting_Loop until all the item groups have been processed. | ||||||||||
B107 | OR C | |||||||||||
B108 | JR NZ,ActionRouting_Loop | |||||||||||
B10A | RET | Return. |
Prev: B0A9 | Up: Map | Next: B10B |