![]() |
Routines |
| Prev: 8D16 | Up: Map | Next: 8D85 |
|
Used by the routines at Handler_DispatchVerb and GameStart.
One turn: turn-based threats, scenic checks, a command, then the matching verb.
|
||||
|
Run any turn-based threats.
|
||||
| GameLoop | 8D2A | CALL HandlerTurnBasedEvents | Call HandlerTurnBasedEvents. | |
|
Walk the scenic-event rooms for the plasma-shell warning.
|
||||
| 8D2D | LD HL,$6224 | HL=Table_ScenicEventLocations. | ||
| 8D30 | LD BC,$0008 | BC=0008. | ||
|
Test whether the player is standing in this scenic room.
|
||||
| GameLoop_Loop1 | 8D33 | LD A,($6223) | Fetch the current room. | |
| 8D36 | CPIR | Search the scenic-event rooms for it. | ||
| 8D38 | JR NZ,GameLoop_Step1 | Jump to GameLoop_Step1 if the player is not in a scenic room. | ||
| 8D3A | PUSH HL | Keep the scenic search while the warning is printed. | ||
| 8D3B | PUSH BC | |||
|
Print "
An alien soldier has appeared.
He fires a plasma gun at you.".
|
||||
| 8D3C | LD HL,$7851 | HL=Messaging_AnAlienSoldierHasAppearedHeFiresAPlasma. | ||
| 8D3F | CALL PrintStringAndANewline | Call PrintStringAndANewline. | ||
|
Give the plasma shell one chance in 14 of hitting.
|
||||
| 8D42 | LD A,$14 | A=14. | ||
| 8D44 | CALL GenerateRandomNumber | Call GenerateRandomNumber. | ||
| 8D47 | JR Z,HandlerPlasmaShell | Jump to HandlerPlasmaShell if the shell hits. | ||
|
Print "But he missed.".
|
||||
| 8D49 | LD HL,$788F | HL=Messaging_ButHeMissed. | ||
| 8D4C | CALL PrintStringAndANewline | Call PrintStringAndANewline. | ||
| 8D4F | POP BC | Restore the scenic-room search. | ||
| 8D50 | POP HL | |||
| 8D51 | XOR A | See whether another scenic room is still to be checked. | ||
| 8D52 | OR C | |||
| 8D53 | JR NZ,GameLoop_Loop1 | Jump to GameLoop_Loop1 to check the next scenic room. | ||
|
Read a command and turn it into vocabulary tokens.
|
||||
| GameLoop_Step1 | 8D55 | CALL Handler_UserInput | Call Handler_UserInput. | |
|
Continue with Action: Type when the first word is "Y".
|
||||
| 8D58 | LD A,($6291) | Fetch the first word of the command. | ||
| 8D5B | CP $59 | Jump to GameLoop_Step3 when Y (59) was not pressed. | ||
| 8D5D | JR NZ,GameLoop_Step3 | |||
| GameLoop_Step2 | 8D5F | LD HL,$997F | Continue at VerbMatched_Run to run Action: Type. | |
| 8D62 | JP VerbMatched_Run | |||
|
Ensure every named object is present here.
|
||||
| GameLoop_Step3 | 8D65 | XOR A | Start the synonym scan with a clear result. | |
| 8D66 | LD HL,$6291 | Point at the command's word tokens. | ||
| 8D69 | LD B,$0A | A command has at most 0A word tokens. | ||
| GameLoop_Loop2 | 8D6B | LD A,(HL) | Read the next word token. | |
| 8D6C | CP $FF | Jump to Handler_DispatchVerb when the command has no more words (FF). | ||
| 8D6E | JR Z,Handler_DispatchVerb | |||
| 8D70 | EXX | Look that token up in the noun list without losing the token pointer. | ||
| 8D71 | LD HL,$8868 | |||
| 8D74 | LD BC,($62C8) | |||
| 8D78 | CPIR | |||
| 8D7A | JR NZ,GameLoop_Step4 | Jump to GameLoop_Step4 if this token is not a noun. | ||
| 8D7C | CALL Parser_ResolvePhrase | Call Parser_ResolvePhrase. | ||
| 8D7F | JR C,GameLoop | Jump back to GameLoop when the carry flag is set. | ||
| GameLoop_Step4 | 8D81 | EXX | Bring the token pointer back. | |
| 8D82 | INC HL | Move on to the next word token. | ||
| 8D83 | DJNZ GameLoop_Loop2 | Jump to GameLoop_Loop2 for the remaining words of the command. | ||
|
View the equivalent code in;
|
||||
| Prev: 8D16 | Up: Map | Next: 8D85 |