![]() |
Routines |
| Prev: 68E0 | Up: Map | Next: 692F |
|
Used by the routines at ActionExamine, ActionTake, Validate_Take_Knife, Validate_Take_LaserPistol, Validate_Take_Coin, Validate_Take_CrystalRod, Validate_Take_Detonator, Validate_Take_MetalBar, Validate_Take_GlowingSphere, Validate_Take_PoisonFungus, Validate_Take_RoundStones, Validate_Take_Key, Validate_Take_SpaceAxe, Validate_Take_Explosives, Validate_Take_PairOfGloves, Validate_Take_Ship, ActionDrop, HandlerResolveSynonym, ActionEnter, ActionLeave, ActionGive, ActionSwim, ActionCut, ActionKill, ActionRead, ActionLand, ActionOpen, ActionClose, ActionShoot, ActionWear, ActionTurn, ActionType, ActionTouch and ActionUse.
Match phrase patterns with multiple wordings against the typed tokens after the verb.
|
||||||||||||
| Parser_AdvanceToSeparator | 6900 | EX DE,HL | Switch the phrase token pointer to DE. | |||||||||
| 6901 | JR Parser_AdvanceToSeparator_Step1 | Jump to Parser_AdvanceToSeparator_Step1. | ||||||||||
|
Skip the separator.
|
||||||||||||
| Parser_AdvanceToSeparator_Loop1 | 6903 | INC DE | Advance to the next byte of the phrase. | |||||||||
|
Fetch the second user input token (not the verb).
For example; "TAKE" (verb) "KEY" (direct object).
|
||||||||||||
| Parser_AdvanceToSeparator_Step1 | 6904 | LD HL,$6292 | HL=UserInput_SecondToken. | |||||||||
| 6907 | JR Parser_AdvanceToSeparator_Step2 | Jump to Parser_AdvanceToSeparator_Step2. | ||||||||||
|
The tokens matched, so advance both pointers.
|
||||||||||||
| Parser_AdvanceToSeparator_Loop2 | 6909 | INC HL | Advance the input token pointer. | |||||||||
| 690A | INC DE | Advance the phrase token pointer. | ||||||||||
|
Keep looping while the tokens match.
|
||||||||||||
| Parser_AdvanceToSeparator_Step2 | 690B | LD A,(DE) | Read the next byte of the phrase. | |||||||||
| 690C | CP (HL) | Jump to Parser_AdvanceToSeparator_Loop2 while this token agrees with the phrase. | ||||||||||
| 690D | JR Z,Parser_AdvanceToSeparator_Loop2 | |||||||||||
|
The tokens differ. Is this the end of the wording (FE)?
|
||||||||||||
| 690F | CP $FE | Jump to Parser_AdvanceToSeparator_Step3 unless this is the terminator (FE). | ||||||||||
| 6911 | JR NZ,Parser_AdvanceToSeparator_Step3 | |||||||||||
|
The input matched this wording.
|
||||||||||||
| 6913 | LD A,(HL) | Fetch the next input token. | ||||||||||
| 6914 | CP $FF | Return with the Z flag set when the command has also ended (FF). | ||||||||||
| 6916 | RET | Return. | ||||||||||
|
Is this an alternative separator (FD)?
|
||||||||||||
| Parser_AdvanceToSeparator_Step3 | 6917 | CP $FD | Jump to Parser_AdvanceToSeparator_Loop3 unless this is the separator (FD). | |||||||||
| 6919 | JR NZ,Parser_AdvanceToSeparator_Loop3 | |||||||||||
| 691B | LD A,(HL) | Fetch the next input token. | ||||||||||
| 691C | CP $FF | Jump back to Parser_AdvanceToSeparator_Loop1 when more input remains. | ||||||||||
| 691E | JR NZ,Parser_AdvanceToSeparator_Loop1 | |||||||||||
| 6920 | RET | Return. | ||||||||||
|
This wording failed; skip to the next alternative.
|
||||||||||||
| Parser_AdvanceToSeparator_Loop3 | 6921 | INC DE | Skip ahead to the next separator or terminator. | |||||||||
| 6922 | LD A,(DE) | |||||||||||
| 6923 | CP $FE | |||||||||||
| 6925 | JR Z,Parser_AdvanceToSeparator_Step4 | |||||||||||
| 6927 | CP $FD | |||||||||||
| 6929 | JR NZ,Parser_AdvanceToSeparator_Loop3 | |||||||||||
| 692B | JR Parser_AdvanceToSeparator_Loop1 | Jump back to Parser_AdvanceToSeparator_Loop1 to try the next wording. | ||||||||||
|
No wording matched.
|
||||||||||||
| Parser_AdvanceToSeparator_Step4 | 692D | OR A | Clear the Z flag. | |||||||||
| 692E | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 68E0 | Up: Map | Next: 692F |