| Routines

06137: THE 'LIST' ENTRY POINT

The address of this routine is found in the parameter table. The 'main screen' channel will need to be opened.
LIST | 06137 | LD A,2 | Use stream 2.
This entry point is used by the routine at LLIST.
LIST_1 | 06139 | LD (IY+2),0 | Signal 'an ordinary listing in the main part of the screen' (reset bit 4 of TV-FLAG and all other bits).
| 06143 | CALL SYNTAX_Z | Open the channel unless checking syntax.
| 06146 | CALL NZ,CHAN_OPEN
| 06149 | RST 24 | With the present character in the A register see if the stream is to be changed.
| 06150 | CALL STR_ALTER
| 06153 | JR C,LIST_4 | Jump forward if unchanged.
| 06155 | RST 24 | Is the present character a ';'?
| 06156 | CP ";"
| 06158 | JR Z,LIST_2 | Jump if it is.
| 06160 | CP "," | Is it a ','?
| 06162 | JR NZ,LIST_3 | Jump if it is not.
LIST_2 | 06164 | RST 32 | A numeric expression must follow, e.g. LIST #5,20.
| 06165 | CALL CLASS_06
| 06168 | JR LIST_5 | Jump forward with it.
LIST_3 | 06170 | CALL USE_ZERO | Otherwise use zero and also jump forward.
| 06173 | JR LIST_5
Come here if the stream was unaltered.
LIST_4 | 06175 | CALL FETCH_NUM | Fetch any line or use zero if none supplied.
LIST_5 | 06178 | CALL CHECK_END | If checking the syntax of the edit-line move on to the next statement.
| 06181 | CALL FIND_INT2 | Line number to BC.
| 06184 | LD A,B | High byte to A.
| 06185 | AND 63 | Limit the high byte to the correct range and pass the whole line number to HL.
| 06187 | LD H,A
| 06188 | LD L,C
| 06189 | LD (23625),HL | Set E-PPC and find the address of the start of this line or the first line after it if the actual line does not exist.
| 06192 | CALL LINE_ADDR
This entry point is used by the routine at AUTO_LIST.
LIST_ALL | 06195 | LD E,1 | Flag 'before the current line'.
Now the controlling loop for printing a series of lines is entered.
LIST_ALL_1 | 06197 | CALL OUT_LINE | Print the whole of a BASIC line.
| 06200 | RST 16 | This will be a 'carriage return'.
| 06201 | BIT 4,(IY+2) | Jump back unless dealing with an automatic listing (bit 4 of TV-FLAG set).
| 06205 | JR Z,LIST_ALL_1
| 06207 | LD A,(23659) | Also jump back if there is still part of the main screen that can be used (DF-SZ <> S-POSN-hi).
| 06210 | SUB (IY+79)
| 06213 | JR NZ,LIST_ALL_1
| 06215 | XOR E | A return can be made at this point if the screen is full and the current line has been printed (E=0).
| 06216 | RET Z
| 06217 | PUSH HL | However if the current line is missing from the listing then S-TOP has to be updated and a further line printed (using scrolling).
| 06218 | PUSH DE
| 06219 | LD HL,23660
| 06222 | CALL LN_FETCH
| 06225 | POP DE
| 06226 | POP HL
| 06227 | JR LIST_ALL_1