![]() |
Routines |
| Prev: 49297 | Up: Map | Next: 49390 |
|
Skips to the next word and copies up to four letters. A comma after a word saves the rest of the line.
|
||||||||
|
Move to the next word. A comma after a word saves the rest of the line.
|
||||||||
| ParseWord | 49316 | CALL SkipToBreak | Call SkipToBreak to skip to a space, a comma or ENTER. | |||||
| 49319 | CP 13 | Jump to FinishParse to finish the command. | ||||||
| 49321 | JR NZ,ParseWord_NotEnter | |||||||
| 49323 | JP FinishParse | |||||||
| ParseWord_NotEnter | 49326 | CP 44 | Jump to ParseWord_Comma to keep the rest of the line. | |||||
| 49328 | JR Z,ParseWord_Comma | |||||||
|
This entry point is used by the routines at ReadCommand and ParseLine.
Copy up to four characters, padding with spaces, then look the word up.
|
||||||||
| ParseWord_Copy | 49330 | LD B,4 | Fill WordToken with four spaces. | |||||
| 49332 | LD DE,23419 | |||||||
| ParseWord_Pad | 49335 | LD A,32 | ||||||
| 49337 | LD (DE),A | |||||||
| 49338 | INC DE | |||||||
| 49339 | DJNZ ParseWord_Pad | |||||||
| 49341 | LD DE,23419 | The copy starts at the first character of WordToken. | ||||||
| 49344 | LD B,0 | |||||||
| ParseWord_Letter | 49346 | LD A,(HL) | Jump to ParseWord_Break to test for a space or ENTER. | |||||
| 49347 | CP 44 | |||||||
| 49349 | JR NZ,ParseWord_Break | |||||||
| 49351 | XOR A | Jump to LookupWord to look the word up. | ||||||
| 49352 | CP B | |||||||
| 49353 | JR NZ,LookupWord | |||||||
| 49355 | LD A,(23435) | Jump to ParseWord to keep scanning. | ||||||
| 49358 | OR A | |||||||
| 49359 | JR Z,ParseWord | |||||||
|
Save the rest of the line for the next turn.
|
||||||||
| ParseWord_Comma | 49361 | LD A,1 | Write 1 to *Continuation and store the pointer in *InputPointer. | |||||
| 49363 | LD (23429),A | |||||||
| 49366 | LD (23436),HL | |||||||
| 49369 | RET | Return. | ||||||
|
A space or ENTER ends the word; anything else is another letter.
|
||||||||
| ParseWord_Break | 49370 | CP 32 | Jump to LookupWord when a space or ENTER ends the word. | |||||
| 49372 | JR Z,LookupWord | |||||||
| 49374 | CP 13 | |||||||
| 49376 | JR Z,LookupWord | |||||||
| 49378 | LD A,4 | Jump to LookupWord if a fifth character is not stored. | ||||||
| 49380 | CP B | |||||||
| 49381 | JR Z,LookupWord | |||||||
| 49383 | LD A,(HL) | Store one character in WordToken. | ||||||
| 49384 | LD (DE),A | |||||||
| 49385 | INC HL | Advance both pointers and jump to ParseWord_Letter. | ||||||
| 49386 | INC DE | |||||||
| 49387 | INC B | |||||||
| 49388 | JR ParseWord_Letter | |||||||
| Prev: 49297 | Up: Map | Next: 49390 |