![]() |
Routines |
| Prev: D9C3 | Up: Map | Next: DA32 |
|
Used by the routine at ParseInput.
Skips blanks in the typed command and classifies the next character.
|
||||
| SkipSpaces | D9C5 | PUSH DE | Jump back to SkipSpaces_0 if this byte is 20 saving source. | |
| SkipSpaces_0 | D9C6 | LD A,(HL) | ||
| D9C7 | INC HL | |||
| D9C8 | CP $20 | |||
| D9CA | JR Z,SkipSpaces_0 | |||
| D9CC | DEC HL | Step back to this character and store the pointer at SavedTextPointer. | ||
| D9CD | LD ($A029),HL | |||
| D9D0 | CP $0D | Jump to SkipSpaces_EnterResult if the player pressed "ENTER". | ||
| D9D2 | JR Z,SkipSpaces_EnterResult | |||
| D9D4 | CALL TestCommonWord | Go to SkipSpaces_ReturnWithHighByte if the character is a full stop, a comma or a quote. | ||
| D9D7 | JR Z,SkipSpaces_ReturnWithHighByte | |||
| D9D9 | CALL FindTokenDictionaryEntry | Go to SkipSpaces_UnknownWord if the token has no dictionary entry. | ||
| D9DC | JR Z,SkipSpaces_UnknownWord | |||
| D9DE | PUSH IX | Save IX and clear the match length at DC14. | ||
| D9E0 | XOR A | |||
| D9E1 | LD ($DC14),A | |||
| SkipSpaces_SaveInputPointer | D9E4 | LD ($D9C3),DE | Remember the input pointer at D9C3. | |
| SkipSpaces_MeasureDictionary | D9E8 | LD DE,($DA32) | Read the dictionary address and measure the gap from it. | |
| D9EC | AND A | |||
| D9ED | PUSH HL | |||
| D9EE | SBC HL,DE | |||
| D9F0 | POP HL | Jump ahead to SkipSpaces_CheckSavedLength if the two pointers meet. | ||
| D9F1 | JR Z,SkipSpaces_CheckSavedLength | |||
| D9F3 | PUSH HL | Copy the pointer into DE and call A94D to handle the nested format. | ||
| D9F4 | POP DE | |||
| D9F5 | CALL $A94D | |||
| D9F8 | LD A,(DE) | Jump back to SkipSpaces_MeasureDictionary if the high nibble is D0. | ||
| D9F9 | AND $F0 | |||
| D9FB | CP $D0 | |||
| D9FD | JR Z,SkipSpaces_MeasureDictionary | |||
| D9FF | CALL MatchDictionaryWord | Go to SkipSpaces_CheckSavedLength if the typed word does not match. | ||
| DA02 | JR Z,SkipSpaces_CheckSavedLength | |||
| DA04 | JR SkipSpaces_SaveInputPointer | The word matched, so measure the next one from SkipSpaces_SaveInputPointer. | ||
|
ENTER selects the result C0.
|
||||
| SkipSpaces_EnterResult | DA06 | LD A,$C0 | ENTER uses the result C0 stored from SkipSpaces_1. | |
| DA08 | JR SkipSpaces_1 | |||
|
Use D0 when the word is not in the dictionary.
|
||||
| SkipSpaces_UnknownWord | DA0A | LD A,$D0 | Take D0 as the result for an unknown word. | |
| SkipSpaces_1 | DA0C | LD BC,$0000 | Clear BC (no time was given). | |
| DA0F | POP DE | Restore the saved source from the stack. | ||
| DA10 | LD D,A | Store the result in the high byte of the source. | ||
| DA11 | RET | Return. | ||
|
The saved length decides whether this character is kept.
|
||||
| SkipSpaces_CheckSavedLength | DA12 | POP HL | Jump to SkipSpaces_ReadInputPointer if the state byte at DC14 is at least 04. | |
| DA13 | LD A,($DC14) | |||
| DA16 | CP $04 | |||
| DA18 | JR NC,SkipSpaces_ReadInputPointer | |||
| DA1A | LD B,A | Go to SkipSpaces_UnknownWord if the matched-word length does not equal the saved count. | ||
| DA1B | LD A,($DC13) | |||
| DA1E | CP B | |||
| DA1F | JR NZ,SkipSpaces_UnknownWord | |||
| SkipSpaces_ReadInputPointer | DA21 | PUSH HL | Read the input pointer and keep the high digit of that character. | |
| DA22 | LD HL,($D9C3) | |||
| DA25 | LD A,(HL) | |||
| DA26 | AND $F0 | |||
| DA28 | LD BC,$5DBF | Take the dictionary index. | ||
| DA2B | SBC HL,BC | Swap in the saved pointer. | ||
| DA2D | EX (SP),HL | |||
| DA2E | POP BC | |||
| SkipSpaces_ReturnWithHighByte | DA2F | POP DE | Restore the saved source from the stack. | |
| DA30 | LD D,A | Store the result in the high byte of the source. | ||
| DA31 | RET | Return. | ||
| Prev: D9C3 | Up: Map | Next: DA32 |