Spectrum ROM | Routines |
Prev: 07427 | Up: Map |
This subroutine is used to find occurrences of either DATA, DEF FN or NEXT. On entry the appropriate token code is in the E register and the HL register pair points to the start of the search area.
|
|||||||
LOOK_PROG | 07558 | LD A,(HL) | Fetch the present character. | ||||
07559 | CP ":" | Jump forward if it is a ':', which will indicate there are more statements in the present line. | |||||
07561 | JR Z,LOOK_P_2 | ||||||
Now a loop is entered to examine each further line in the program.
|
|||||||
LOOK_P_1 | 07563 | INC HL | Fetch the high byte of the line number and return with carry set if there are no further lines in the program. | ||||
07564 | LD A,(HL) | ||||||
07565 | AND 192 | ||||||
07567 | SCF | ||||||
07568 | RET NZ | ||||||
07569 | LD B,(HL) | The line number is fetched and passed to NEWPPC. | |||||
07570 | INC HL | ||||||
07571 | LD C,(HL) | ||||||
07572 | LD (23618),BC | ||||||
07576 | INC HL | Then the length is collected. | |||||
07577 | LD C,(HL) | ||||||
07578 | INC HL | ||||||
07579 | LD B,(HL) | ||||||
07580 | PUSH HL | The pointer is saved whilst the address of the end of the line is formed in the BC register pair. | |||||
07581 | ADD HL,BC | ||||||
07582 | LD B,H | ||||||
07583 | LD C,L | ||||||
07584 | POP HL | The pointer is restored. | |||||
07585 | LD D,0 | Set the statement counter to zero. | |||||
LOOK_P_2 | 07587 | PUSH BC | The end-of-line pointer is saved whilst the statements of the line are examined. | ||||
07588 | CALL EACH_STMT | ||||||
07591 | POP BC | ||||||
07592 | RET NC | Make a return if there was an 'occurrence'; otherwise consider the next line. | |||||
07593 | JR LOOK_P_1 |
Prev: 07427 | Up: Map |