Prev: 06137 Up: Map Next: 06326
06229: THE 'PRINT A WHOLE BASIC LINE' SUBROUTINE
Used by the routines at ED_EDIT and LIST.
The HL register pair points to the start of the line - the location holding the high byte of the line number.
Before the line number is printed it is tested to determine whether it comes before the 'current' line, is the 'current' line, or comes after.
Input
HL Address of the start of the BASIC line
OUT_LINE 06229 LD BC,(23625) Fetch the 'current' line number from E-PPC and compare it.
06233 CALL CP_LINES
06236 LD D,">" Pre-load the D register with the current line cursor.
06238 JR Z,OUT_LINE1 Jump forward if printing the 'current' line.
06240 LD DE,0 Load the D register with zero (it is not the cursor) and set E to hold 1 if the line is before the 'current' line and 0 if after. (The carry flag comes from CP_LINES.)
06243 RL E
OUT_LINE1 06245 LD (IY+45),E Save the line marker in BREG.
06248 LD A,(HL) Fetch the high byte of the line number and make a full return if the listing has been finished.
06249 CP 64
06251 POP BC
06252 RET NC
06253 PUSH BC
06254 CALL OUT_NUM_2 The line number can now be printed - with leading spaces.
06257 INC HL Move the pointer on to address the first command code in the line.
06258 INC HL
06259 INC HL
06260 RES 0,(IY+1) Signal 'leading space allowed' (reset bit 0 of FLAGS).
06264 LD A,D Fetch the cursor code and jump forward unless the cursor is to be printed.
06265 AND A
06266 JR Z,OUT_LINE3
06268 RST 16 So print the cursor now.
This entry point is used by the routine at ED_COPY.
OUT_LINE2 06269 SET 0,(IY+1) Signal 'no leading space now' (set bit 0 of FLAGS).
OUT_LINE3 06273 PUSH DE Save the registers.
06274 EX DE,HL Move the pointer to DE.
06275 RES 2,(IY+48) Signal 'not in quotes' (reset bit 2 of FLAGS2).
06279 LD HL,23611 This is FLAGS.
06282 RES 2,(HL) Signal 'print in K-mode'.
06284 BIT 5,(IY+55) Jump forward unless in INPUT mode (bit 5 of FLAGX set).
06288 JR Z,OUT_LINE4
06290 SET 2,(HL) Signal 'print in L-mode'.
Now enter a loop to print all the codes in the rest of the BASIC line - jumping over floating-point forms as necessary.
OUT_LINE4 06292 LD HL,(23647) Fetch the syntax error pointer (X-PTR) and jump forward unless it is time to print the error marker.
06295 AND A
06296 SBC HL,DE
06298 JR NZ,OUT_LINE5
06300 LD A,"?" Print the error marker now. It is a flashing '?'.
06302 CALL OUT_FLASH
OUT_LINE5 06305 CALL OUT_CURS Consider whether to print the cursor.
06308 EX DE,HL Move the pointer to HL now.
06309 LD A,(HL) Fetch each character in turn.
06310 CALL NUMBER If the character is a 'number marker' then the hidden floating-point form is not to be printed.
06313 INC HL Update the pointer for the next pass.
06314 CP 13 Is the character a 'carriage return'?
06316 JR Z,OUT_LINE6 Jump if it is.
06318 EX DE,HL Switch the pointer to DE.
06319 CALL OUT_CHAR Print the character.
06322 JR OUT_LINE4 Go around the loop for at least one further pass.
The line has now been printed.
OUT_LINE6 06324 POP DE Restore the DE register pair and return.
06325 RET
Prev: 06137 Up: Map Next: 06326