![]() |
Routines |
Prev: 1988 | Up: Map |
This subroutine has two distinct functions.
|
|||||||||||||||||||
EACH_STMT | 198B | LD ($5C5D),HL | Set CH-ADD to the current byte. | ||||||||||||||||
198E | LD C,$00 | Set a 'quotes off' flag. | |||||||||||||||||
Enter a loop to handle each statement in the BASIC line.
|
|||||||||||||||||||
EACH_S_1 | 1990 | DEC D | Decrease D and return if the required statement has been found. | ||||||||||||||||
1991 | RET Z | ||||||||||||||||||
1992 | RST $20 | Fetch the next character code and jump if it does not match the given token code. | |||||||||||||||||
1993 | CP E | ||||||||||||||||||
1994 | JR NZ,EACH_S_3 | ||||||||||||||||||
1996 | AND A | But should it match then return with the carry and the zero flags both reset. | |||||||||||||||||
1997 | RET | ||||||||||||||||||
Now enter another loop to consider the individual characters in the line to find where the statement ends.
|
|||||||||||||||||||
EACH_S_2 | 1998 | INC HL | Update the pointer and fetch the new code. | ||||||||||||||||
1999 | LD A,(HL) | ||||||||||||||||||
EACH_S_3 | 199A | CALL NUMBER | Step over any number. | ||||||||||||||||
199D | LD ($5C5D),HL | Update CH-ADD. | |||||||||||||||||
19A0 | CP "\"" | Jump forward if the character is not a '"'. | |||||||||||||||||
19A2 | JR NZ,EACH_S_4 | ||||||||||||||||||
19A4 | DEC C | Otherwise set the 'quotes flag'. | |||||||||||||||||
EACH_S_4 | 19A5 | CP ":" | Jump forward if the character is a ':'. | ||||||||||||||||
19A7 | JR Z,EACH_S_5 | ||||||||||||||||||
19A9 | CP $CB | Jump forward unless the code is the token 'THEN'. | |||||||||||||||||
19AB | JR NZ,EACH_S_6 | ||||||||||||||||||
EACH_S_5 | 19AD | BIT 0,C | Read the 'quotes flag' and jump back at the end of each statement (including after 'THEN'). | ||||||||||||||||
19AF | JR Z,EACH_S_1 | ||||||||||||||||||
EACH_S_6 | 19B1 | CP $0D | Jump back unless at the end of a BASIC line. | ||||||||||||||||
19B3 | JR NZ,EACH_S_2 | ||||||||||||||||||
19B5 | DEC D | Decrease the statement counter and set the carry flag before returning. | |||||||||||||||||
19B6 | SCF | ||||||||||||||||||
19B7 | RET |
Prev: 1988 | Up: Map |