Prev: 55747 Up: Map Next: 55858
55749: Skip Spaces In The Input
Used by the routine at ParseInput.
Skips blanks in the typed command and classifies the next character.
SkipSpaces 55749 PUSH DE Jump back to SkipSpaces_0 if this byte is 32 saving source.
SkipSpaces_0 55750 LD A,(HL)
55751 INC HL
55752 CP 32
55754 JR Z,SkipSpaces_0
55756 DEC HL Step back to this character and store the pointer at SavedTextPointer.
55757 LD (41001),HL
55760 CP 13 Jump to SkipSpaces_EnterResult if the player pressed "ENTER".
55762 JR Z,SkipSpaces_EnterResult
55764 CALL TestCommonWord Go to SkipSpaces_ReturnWithHighByte if the character is a full stop, a comma or a quote.
55767 JR Z,SkipSpaces_ReturnWithHighByte
55769 CALL FindTokenDictionaryEntry Go to SkipSpaces_UnknownWord if the token has no dictionary entry.
55772 JR Z,SkipSpaces_UnknownWord
55774 PUSH IX Save IX and clear the match length at 56340.
55776 XOR A
55777 LD (56340),A
SkipSpaces_SaveInputPointer 55780 LD (55747),DE Remember the input pointer at 55747.
SkipSpaces_MeasureDictionary 55784 LD DE,(55858) Read the dictionary address and measure the gap from it.
55788 AND A
55789 PUSH HL
55790 SBC HL,DE
55792 POP HL Jump ahead to SkipSpaces_CheckSavedLength if the two pointers meet.
55793 JR Z,SkipSpaces_CheckSavedLength
55795 PUSH HL Copy the pointer into DE and call 43341 to handle the nested format.
55796 POP DE
55797 CALL 43341
55800 LD A,(DE) Jump back to SkipSpaces_MeasureDictionary if the high nibble is 208.
55801 AND 240
55803 CP 208
55805 JR Z,SkipSpaces_MeasureDictionary
55807 CALL MatchDictionaryWord Go to SkipSpaces_CheckSavedLength if the typed word does not match.
55810 JR Z,SkipSpaces_CheckSavedLength
55812 JR SkipSpaces_SaveInputPointer The word matched, so measure the next one from SkipSpaces_SaveInputPointer.
ENTER selects the result 192.
SkipSpaces_EnterResult 55814 LD A,192 ENTER uses the result 192 stored from SkipSpaces_1.
55816 JR SkipSpaces_1
Use 208 when the word is not in the dictionary.
SkipSpaces_UnknownWord 55818 LD A,208 Take 208 as the result for an unknown word.
SkipSpaces_1 55820 LD BC,0 Clear BC (no time was given).
55823 POP DE Restore the saved source from the stack.
55824 LD D,A Store the result in the high byte of the source.
55825 RET Return.
The saved length decides whether this character is kept.
SkipSpaces_CheckSavedLength 55826 POP HL Jump to SkipSpaces_ReadInputPointer if the state byte at 56340 is at least 4.
55827 LD A,(56340)
55830 CP 4
55832 JR NC,SkipSpaces_ReadInputPointer
55834 LD B,A Go to SkipSpaces_UnknownWord if the matched-word length does not equal the saved count.
55835 LD A,(56339)
55838 CP B
55839 JR NZ,SkipSpaces_UnknownWord
SkipSpaces_ReadInputPointer 55841 PUSH HL Read the input pointer and keep the high digit of that character.
55842 LD HL,(55747)
55845 LD A,(HL)
55846 AND 240
55848 LD BC,23999 Take the dictionary index.
55851 SBC HL,BC Swap in the saved pointer.
55853 EX (SP),HL
55854 POP BC
SkipSpaces_ReturnWithHighByte 55855 POP DE Restore the saved source from the stack.
55856 LD D,A Store the result in the high byte of the source.
55857 RET Return.
Prev: 55747 Up: Map Next: 55858