![]() |
Routines |
| Prev: 28299 | Up: Map | Next: 28464 |
|
Used by the routine at TurnReadAndTokeniseTheCommand.
Skips spaces, stores the start of the next word, and classifies it.
|
||||
| Input_TakeTheNextWord | 28311 | PUSH DE | Jump back to Input_TakeTheNextWord_SkipSpaces if the line being typed is a space. | |
| Input_TakeTheNextWord_SkipSpaces | 28312 | LD A,(HL) | ||
| 28313 | INC HL | |||
| 28314 | CP 32 | |||
| 28316 | JR Z,Input_TakeTheNextWord_SkipSpaces | |||
| 28318 | DEC HL | Step back one byte through 28665. | ||
| 28319 | LD (46810),HL | Update *46810. | ||
| 28322 | CP 13 | Jump to Input_TakeTheNextWord_MarkTheEndOfTheCommand if the line being typed is ENTER. | ||
| 28324 | JR Z,Input_TakeTheNextWord_MarkTheEndOfTheCommand | |||
| 28326 | CALL Input_ClassifyPunctuation | Call Input_ClassifyPunctuation to classify punctuation. | ||
| 28329 | JR Z,Input_TakeTheNextWord_ReturnTheClass | Jump to Input_TakeTheNextWord_ReturnTheClass if Input_ClassifyPunctuation classified this character as punctuation. | ||
| 28331 | CALL Input_CopyADictionaryWord | Call Input_CopyADictionaryWord to copy a dictionary word. | ||
| 28334 | JR NZ,Input_TakeTheNextWord_MarkThisTokenAsAnUnknownWord | Jump to Input_TakeTheNextWord_MarkThisTokenAsAnUnknownWord if Input_CopyADictionaryWord found no dictionary word starting with the typed word's first letter. | ||
| 28336 | PUSH HL | |||
| Input_TakeTheNextWord_CompareTheDictionaryWord | 28337 | CALL Input_CompareTheDictionaryWord | Call Input_CompareTheDictionaryWord to compare the dictionary word. | |
| 28340 | JR Z,Input_TakeTheNextWord_CompareTheWordLengths | Jump to Input_TakeTheNextWord_CompareTheWordLengths if Input_CompareTheDictionaryWord found the words match. | ||
| Input_TakeTheNextWord_CopyADictionaryWord | 28342 | CALL Input_CopyADictionaryWord_0 | Call Input_CopyADictionaryWord_0 to copy a dictionary word. | |
| 28345 | JR Z,Input_TakeTheNextWord_CompareTheDictionaryWord | Jump back to Input_TakeTheNextWord_CompareTheDictionaryWord while Input_CopyADictionaryWord_0 finds another dictionary word with the same first letter. | ||
| 28347 | POP HL | |||
| Input_TakeTheNextWord_MarkThisTokenAsAnUnknownWord | 28348 | LD A,208 | Mark this token as an unknown word. | |
| 28350 | JR Input_TakeTheNextWord_FinishTheUnknownWord | Jump to Input_TakeTheNextWord_FinishTheUnknownWord to finish this unknown-word token. | ||
| Input_TakeTheNextWord_CompareTheWordLengths | 28352 | LD A,(28810) | Read *28810. | |
| 28355 | LD B,A | Copy the result into B. | ||
| 28356 | LD A,(28827) | Read *28827. | ||
| 28359 | CP B | Jump to Input_TakeTheNextWord_LoadTheDictionaryPointer if the length of the dictionary word is not below the length of the typed word. | ||
| 28360 | JR NC,Input_TakeTheNextWord_LoadTheDictionaryPointer | |||
| 28362 | CP 4 | Jump back to Input_TakeTheNextWord_CopyADictionaryWord if the length of the dictionary word is below 4. | ||
| 28364 | JR C,Input_TakeTheNextWord_CopyADictionaryWord | |||
| 28366 | PUSH IX | Call Input_CopyADictionaryWord_1 to unpack the dictionary word when its length matches the typed word. | ||
| 28368 | CALL Input_CopyADictionaryWord_1 | |||
| 28371 | JR NZ,Input_TakeTheNextWord_PopTheSavedPointer | Jump to Input_TakeTheNextWord_PopTheSavedPointer if Input_CopyADictionaryWord_1 found a mismatch. | ||
| 28373 | CALL Input_CompareTheDictionaryWord | Call Input_CompareTheDictionaryWord to compare the dictionary word. | ||
| 28376 | JR NZ,Input_TakeTheNextWord_PopTheSavedPointer | Jump to Input_TakeTheNextWord_PopTheSavedPointer if Input_CompareTheDictionaryWord found the words differ. | ||
| 28378 | POP IX | Jump back to Input_TakeTheNextWord_CopyADictionaryWord to read the input line. | ||
| 28380 | JR Input_TakeTheNextWord_CopyADictionaryWord | |||
| Input_TakeTheNextWord_MarkTheEndOfTheCommand | 28382 | LD A,192 | Mark this token as the end of a command. | |
| Input_TakeTheNextWord_FinishTheUnknownWord | 28384 | LD BC,0 | Start from a clear pointer. | |
| Input_TakeTheNextWord_ReturnTheClass | 28387 | POP DE | Keep the low byte of the saved pointer and put the class in D. | |
| 28388 | LD D,A | |||
| 28389 | ADD A,B | Add the length of the typed word to the class in A. | ||
| 28390 | LD B,A | Copy the result into B. | ||
| 28391 | LD A,D | Restore the end-of-command class 192. | ||
| 28392 | RET | Return. | ||
| Input_TakeTheNextWord_PopTheSavedPointer | 28393 | POP IX | Read *46871. | |
| Input_TakeTheNextWord_LoadTheDictionaryPointer | 28395 | LD IX,(46871) | ||
| 28399 | PUSH IX | Save the dictionary pointer and start the length at zero. | ||
| 28401 | XOR A | |||
| Input_TakeTheNextWord_StepThroughTheDictionaryWord | 28402 | INC IX | Step to the next dictionary byte and loop back to Input_TakeTheNextWord_StepThroughTheDictionaryWord while bit 7 of that byte is clear. | |
| 28404 | INC A | |||
| 28405 | BIT 7,(IX-1) | |||
| 28409 | JR Z,Input_TakeTheNextWord_StepThroughTheDictionaryWord | |||
| 28411 | CP 2 | Jump back to Input_TakeTheNextWord_StepThroughTheDictionaryWord if the dictionary byte count is 2. | ||
| 28413 | JR Z,Input_TakeTheNextWord_StepThroughTheDictionaryWord | |||
| 28415 | CP 3 | Jump to Input_TakeTheNextWord_TestForAnOffset unless the byte is 3. | ||
| 28417 | JR NZ,Input_TakeTheNextWord_TestForAnOffset | |||
| 28419 | BIT 7,(IX-2) | Jump back to Input_TakeTheNextWord_StepThroughTheDictionaryWord if bit 7 of the earlier dictionary byte is set. | ||
| 28423 | JR NZ,Input_TakeTheNextWord_StepThroughTheDictionaryWord | |||
| Input_TakeTheNextWord_TestForAnOffset | 28425 | BIT 6,(IX-1) | Jump to Input_TakeTheNextWord_PackTheClassBits if bit 6 of this dictionary byte is clear. | |
| 28429 | JR Z,Input_TakeTheNextWord_PackTheClassBits | |||
| 28431 | LD L,(IX+0) | Read the low byte of this dictionary offset. | ||
| 28434 | LD H,(IX+1) | Read the high byte of this dictionary offset. | ||
| 28437 | LD DE,24576 | Add the dictionary base at WordIndex. | ||
| 28440 | ADD HL,DE | |||
| 28441 | EX (SP),HL | Exchange the dictionary address with the pointer saved on the stack. | ||
| Input_TakeTheNextWord_PackTheClassBits | 28442 | POP HL | Pack the top two bits of this letter into the class. | |
| 28443 | LD A,(HL) | |||
| 28444 | RLCA | |||
| 28445 | AND 192 | |||
| 28447 | LD B,A | |||
| 28448 | INC HL | Step to the next byte of the input buffer. | ||
| 28449 | LD A,(HL) | Pack the next two bits of the following letter into the class. | ||
| 28450 | RRCA | |||
| 28451 | AND 48 | |||
| 28453 | ADD A,B | Combine the two pairs of class bits. | ||
| 28454 | DEC HL | Step back one byte through 28665. | ||
| 28455 | LD DE,40960 | Add the 40960 token base onto the token pointer. | ||
| 28458 | ADD HL,DE | Add the token base to 28665. | ||
| 28459 | PUSH HL | Keep the token address in BC and jump to Input_TakeTheNextWord_ReturnTheClass to return the class. | ||
| 28460 | POP BC | |||
| 28461 | POP HL | |||
| 28462 | JR Input_TakeTheNextWord_ReturnTheClass | |||
| Prev: 28299 | Up: Map | Next: 28464 |