Spectrum ROM | Routines |
Prev: 06536 | Up: Map |
This subroutine has two distinct functions.
|
|||||||
EACH_STMT | 06539 | LD (23645),HL | Set CH-ADD to the current byte. | ||||
06542 | LD C,0 | Set a 'quotes off' flag. | |||||
Enter a loop to handle each statement in the BASIC line.
|
|||||||
EACH_S_1 | 06544 | DEC D | Decrease D and return if the required statement has been found. | ||||
06545 | RET Z | ||||||
06546 | RST 32 | Fetch the next character code and jump if it does not match the given token code. | |||||
06547 | CP E | ||||||
06548 | JR NZ,EACH_S_3 | ||||||
06550 | AND A | But should it match then return with the carry and the zero flags both reset. | |||||
06551 | RET | ||||||
Now enter another loop to consider the individual characters in the line to find where the statement ends.
|
|||||||
EACH_S_2 | 06552 | INC HL | Update the pointer and fetch the new code. | ||||
06553 | LD A,(HL) | ||||||
EACH_S_3 | 06554 | CALL NUMBER | Step over any number. | ||||
06557 | LD (23645),HL | Update CH-ADD. | |||||
06560 | CP "\"" | Jump forward if the character is not a '"'. | |||||
06562 | JR NZ,EACH_S_4 | ||||||
06564 | DEC C | Otherwise set the 'quotes flag'. | |||||
EACH_S_4 | 06565 | CP ":" | Jump forward if the character is a ':'. | ||||
06567 | JR Z,EACH_S_5 | ||||||
06569 | CP 203 | Jump forward unless the code is the token 'THEN'. | |||||
06571 | JR NZ,EACH_S_6 | ||||||
EACH_S_5 | 06573 | BIT 0,C | Read the 'quotes flag' and jump back at the end of each statement (including after 'THEN'). | ||||
06575 | JR Z,EACH_S_1 | ||||||
EACH_S_6 | 06577 | CP 13 | Jump back unless at the end of a BASIC line. | ||||
06579 | JR NZ,EACH_S_2 | ||||||
06581 | DEC D | Decrease the statement counter and set the carry flag before returning. | |||||
06582 | SCF | ||||||
06583 | RET |
Prev: 06536 | Up: Map |