and if there is no carry, D >= (19h - L) and there is no need to scroll - (the lower screen must be scrolled) negate the result;giving (19h - L) - D, the number of scrolls needed - save the position values and the temporary colour svs from 5C8F ATTR T/MASK T and P FLAG - call OD4D TEMPS so as to use the permanent colours; always used in the lower screen - make a counter of the number of scrolls needed; this is the scroll counter, not to be confused with the line counter,which is still to be calculated. The routine scrolls X lines up Y times, where X is the line counter and Y the scroll counter. _0D1C_PO_SCR_4A: increment 5C6B DF SZ, but keep the old value - check the new value with the print position line number in the upper screen from 5C89 S POSN hi - if 5C89 S POSN hi is larger jump on to PO SCR 4B; there is still room between the end of the upper screen and the new top of the lower, so no need to scroll the upper screen yet - (the whole screen must be scrolled) increment 5C89 S POSN hi; the upper screen print position will move up one - make a line counter 18h/24d; all the lines will be scrolled, right down to the last line of the lower screen. _0D2D_PO_SCR_4B: call 0E00 CL SCROLL to scroll up one as many lines as indicated by the line counter, counted from the bottom of the screen; this will either be the old value of 5C6B DF SZ, or 18h for the whole screen - decrement the scroll counter - if it isn't zero yet loop back to PO SCR 4A - (scrolling is finished) recover the temporary attribute svs from the stack and put them back - zero bit zero of TV FLAG; "upper screen" - call 0DD9 CL SET with the new upper screen print position to set the print position svs - set bit zero of TV FLAG; "lower screen" - recover the lower screen print position and return. Exit: RET from PO SCR; output is to printer - indirect jumps to 0DD9 CL SET from PO SCR; no need for scroll PO SCR 3A; upper screen scroll completed PO SCR 4; no need for scroll PO SCR 4B; lower screen scrolls completed - multiple return from PO SCR; end of LISTing routine. Output parameters: BC' holds the corrected print position. Called from: 0A4F PO ENTER 0B93 PR ALL 1 Exit from: 0AAC PO AT ERR Rems: 1795 AUTO LIST loads LIST SP for ret after auto listing PO SCR 2 0C88 (0C55 PO SCR) Jumps from: 0C55 PO SCR PO SCR 3 0CD2 (0C55 PO SCR) Jumps from: 0C55 PO SCR 0C88 PO SCR 2 PO SCR 3A 0CF0 (0C55 PO SCR) Exit from: 0CD2 PO SCR 3 (0C55 PO SCR) Jumps from: auto PO SCR 4 0D02 (0C55 PO SCR) Exit from: 0C55 PO SCR PO SCR 4A 0D1C (0C55 PO SCR) Jumps from: 0D2D PO SCR 4B PO SCR 4B 0D2D (0C55 PO SCR) Exit from: 0D1C PO SCR 4A (0C55 PO SCR) PO SEARCH subroutine 0C41 Finds an indexed entry in a message table. Called only from 0C14 PO TABLE in 0C0A PO MSG. Can be useful in m/c programs. The start of the table is marked by a byte with the hi bit set, and the last character of each message in it is similarly marked. Returns with the carry flag set to signal "no leading space". Input parameters: A holds the message number of the required message in the table; the first message is number zero - DE holds the pointer to the table to be searched; an earlier address would work, provided message number zero starts after the first byte with hi bit set to be encountered. Action: increment the index; now it counts from one. _0C44_PO_STEP: check the hi bit of the byte at the pointer - increment the pointer - if the hi bit is zero loop back to PO STEP - (hi bit set) decrement the message number - if it isn't zero yet loop back to PO STEP - (the pointer is on the first byte of the required message) if the index was less than 20h/32d return with carry; no leading space - if the first code of the message is below 41h "A", return with carry. Exit: two RETs, from 0C44 PO STEP. Output parameters: DE holds the address of the first byteof the message - "no carry" signifies "leading space may be required"; see 0C0A PO MSG. Called from: 0C14 PO TABLE position see DISPLAY AREA position control characters see control characters POSITION FETCH SUBROUTINE see 0B03 PO FETCH POSITION STORE SUBROUTINE see 0ADC PO STORE position value see DISPLAY AREA PO SPACE 0AD0 (09F4 PRINT OUT) Exit from: 0AC2 PO TAB (0A7A PO 1 OPER) Jumps from: auto PO ST E 0AF0 (09F4 PRINT OUT) Exit from: 0ADC PO STORE PO STEP 0C44 (0C41 PO SEARCH) Exit from: 0C41 PO SEARCH Jumps from: auto (twice) PO STORE 0ADC (09F4 PRINT OUT) Exit from: 0AD9 PO ABLE 0DD9 CL SET/0DF4 CL SET 2 PO ST PR 0AFC (0ADC PO STORE) Exit from: 0ADC PO STORE PO T 0B5F (09F4 PRINT OUT) Jumps from: 0B52 PO T&UDG PO TAB 0AC2 (09F4 PRINT OUT) Jumps from: 0AB7 PO CONT PO TABLE 0C14 (0C0A PO MSG) Jumps from: 0C0A PO MSG PO TOKENS subroutine 0C10 (0C0A PO MSG) Entry point to 0C0A PO MSG used when printing tokens. Called from: 0B5F PO T PO TRSP 0C35 (0C0A PO MSG) Exit from: 0C22 PO EACH (0C0A PO MSG) PO TV 1 0A7D (09F4 PRINT OUT) Jumps from: 0A75 PO 2 OPER PO TV 2 0A6D (09F4 PRINT OUT) Made output routine by 0A75 PO 2 OPER in PO 1 OPER. PO T&UDG 0B52 (09F4 PRINT OUT) Exit from: 0B24 PO ANY P OUT 1AF1 P OVER 1AF0 see 1A7A syntax offset table PO 1 OPER subroutine 0A7A See 09F4 PRINT OUT. PO 2 OPER subroutine 0A75 See 09F4 PRINT OUT. P PAPER 1AEC P PAUSE 1AC5 see 1A7A syntax offset table PPC system variable 5C45 Bytes: 2 The BASIC line number of the statement currently being executed. When execution reaches a new BASIC line, or jumps to one, the line number is read into PPC by 1BBF LINE USE. If the line has no number - a direct command - it is given the number FFFEh/65534d (-2) by 1B8A LINE RUN. PPC is read by 133C MAIN 5 after BASIC execution is completed, so that the line number can be printed by 1A1B OUT NUM 1 in the report message; if the number is -2, it gets printed as zero. 5C47 SUBPPC and PPC are copied together into 5C70 OSPCC and OLDPPC by 1376 MAIN 7 to mark the line and statement from which execution is to start after CONTINUE, unless bit 7 of 5C44NSPPC indicates that a jump is due. PPC is also read and included as part of the control variable of a FOR ... NEXT loop (1D34 F L&S) and to be put on the GO SUB stack in executing a GO SUB command (1EED GO SUB). Written by: 1B8A LINE RUN 1BBF LINE USE Read by: 1376 MAIN 7 133C MAIN 5 1D34 F L&S (twice) 1EED GO SUB P PLOT 1AC1 P POKE 1AB1 see 1A7A syntax offset table P POSN system variable 5C7F Bytes: 1. The "column number", ie the byte reached in the print buffer, when printing out on the ZX printer. It is written by 0ADC PO STORE, just like the print position system variables when printing is done on screen, and similarly fetched by 0B1D PO F PR. Written by: 0AFC PO ST PR Read by: 0B1D PO F PR P PRINT 1A9C see 1A7A syntax offset table PR ALL 0B7F (09F4 PRINT OUT) Exit from: 0B24 PO ANY, direct and through 0B76 PO CHAR 3 PR ALL 1 0B93 (09F4 PRINT OUT) Jumps from: 0B7F PR ALL PR ALL 2 0BA4 (09F4 PRINT OUT) Jumps from: 0B93 PR ALL 1 PR ALL 3 0BB6 (09F4 PRINT OUT) Jumps from: 0BA4 PR ALL 2 PR ALL 4 0BB7 (09F4 PRINT OUT) Jumps from: 0BC1 PR ALL 5 PR ALL 5 0BC1 (09F4 PRINT OUT) Exit from: 0BD3 PR ALL 6 (0B24 PO ANY) PR ALL 6 0BD3 (09F4 PRINT OUT) (misprinted PO ALL 6 in the listing) Jumps from: 0BB7 PR ALL 4 P RAMT system variable 5CB4 Bytes: 2. Holds FFFFh/65535d in the 48K Spectrum, 7FFFh/32767d in the 16K model - ie the address of the last available byte in RAM. POKing it with 7FFFh will cause a 48K to simulate the 16K. Loaded on start-up by 11EF RAM DONE with the last usableRAM address; the second write, about 1200. It is not changed by the NEW command - it is saved in 11B7 NEW and restored in 11EF RAM DONE. Otherwise read by ROM only to check that RAM TOP is not being set too high, in 1EB7 CLEAR 1. Written by: 11EF RAM DONE (twice) Read by: 11B7 NEW 1EB7 CLEAR 1 Rems: 0000 START loads FFFFh for P RAMT P RANDOM 1AB5 see 1A7A syntax offset table PR AT TAB 201E (1FC9 PRINT) Exit from: 1FC9 PRINT through 1FFC PR ITEM 1 200E PR ITEM 2 PRB BYTES OEE7 (0EDF CLEAR PRB) Jumps from: auto PR CC system variable 5C80 Bytes: 2. [Actually only the lo byte is used, and in the Spectrum handbooks 5C81 is marked "not used". However it is written to by 0AFC PO ST PR in both bytes; rather pointlessly, since the hi byte is irrelevant, LD (IY+70),L would be no longer, and indeed this is used at 0EDF CLEAR PRB. So it is safeto use the spare system variable 5CB1 provided it is protected from channel 3 outputs.] The print position, column number only, for the ZX printer. PR CC is written by 0AFC PO ST PR each time a characteris printed or the print position is changed, and set to zero by 0EDF CLEAR PRB whenever the print buffer is cleared. It is read by 0B1D PO F PR whenever a character is to be printed.