Prev: 17F5 Up: Map Next: 1855
17F9: 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 17F9 LD A,$02 Use stream +02.
This entry point is used by the routine at LLIST.
LIST_1 17FB LD (IY+$02),$00 Signal 'an ordinary listing in the main part of the screen' (reset bit 4 of TV-FLAG and all other bits).
17FF CALL SYNTAX_Z Open the channel unless checking syntax.
1802 CALL NZ,CHAN_OPEN
1805 RST $18 With the present character in the A register see if the stream is to be changed.
1806 CALL STR_ALTER
1809 JR C,LIST_4 Jump forward if unchanged.
180B RST $18 Is the present character a ';'?
180C CP ";"
180E JR Z,LIST_2 Jump if it is.
1810 CP "," Is it a ','?
1812 JR NZ,LIST_3 Jump if it is not.
LIST_2 1814 RST $20 A numeric expression must follow, e.g. LIST #5,20.
1815 CALL CLASS_06
1818 JR LIST_5 Jump forward with it.
LIST_3 181A CALL USE_ZERO Otherwise use zero and also jump forward.
181D JR LIST_5
Come here if the stream was unaltered.
LIST_4 181F CALL FETCH_NUM Fetch any line or use zero if none supplied.
LIST_5 1822 CALL CHECK_END If checking the syntax of the edit-line move on to the next statement.
1825 CALL FIND_INT2 Line number to BC.
1828 LD A,B High byte to A.
1829 AND $3F Limit the high byte to the correct range and pass the whole line number to HL.
182B LD H,A
182C LD L,C
182D LD ($5C49),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.
1830 CALL LINE_ADDR
This entry point is used by the routine at AUTO_LIST.
LIST_ALL 1833 LD E,$01 Flag 'before the current line'.
Now the controlling loop for printing a series of lines is entered.
LIST_ALL_1 1835 CALL OUT_LINE Print the whole of a BASIC line.
1838 RST $10 This will be a 'carriage return'.
1839 BIT 4,(IY+$02) Jump back unless dealing with an automatic listing (bit 4 of TV-FLAG set).
183D JR Z,LIST_ALL_1
183F LD A,($5C6B) Also jump back if there is still part of the main screen that can be used (DF-SZ <> S-POSN-hi).
1842 SUB (IY+$4F)
1845 JR NZ,LIST_ALL_1
1847 XOR E A return can be made at this point if the screen is full and the current line has been printed (E=+00).
1848 RET Z
1849 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).
184A PUSH DE
184B LD HL,$5C6C
184E CALL LN_FETCH
1851 POP DE
1852 POP HL
1853 JR LIST_ALL_1
Prev: 17F5 Up: Map Next: 1855