Prev: 19FB Up: Map Next: 1A48
1A1B: THE 'REPORT AND LINE NUMBER PRINTING' SUBROUTINE
The entry point OUT_NUM_1, used by the routines at MAIN_EXEC and PRINT_FP, will lead to the number in the BC register pair being printed. Any value over 9,999 will not however be printed correctly.
Input
BC Number to print
OUT_NUM_1 1A1B PUSH DE Save the other registers throughout the subroutine.
1A1C PUSH HL
1A1D XOR A Clear the A register.
1A1E BIT 7,B Jump forward to print a zero rather than '-2' when reporting on the edit-line.
1A20 JR NZ,OUT_NUM_4
1A22 LD H,B Move the number to the HL register pair.
1A23 LD L,C
1A24 LD E,$FF Flag 'no leading spaces'.
1A26 JR OUT_NUM_3 Jump forward to print the number.
The entry point OUT_NUM_2, used by the routine at OUT_LINE, will lead to the number indirectly addressed by the HL register pair being printed. This time any necessary leading spaces will appear. Again the limit of correctly printed numbers is 9,999.
OUT_NUM_2 1A28 PUSH DE Save the DE register pair.
1A29 LD D,(HL) Fetch the number into the DE register pair and save the pointer (updated).
1A2A INC HL
1A2B LD E,(HL)
1A2C PUSH HL
1A2D EX DE,HL Move the number to the HL register pair and flag 'leading spaces are to be printed'.
1A2E LD E,$20
Now the integer form of the number in the HL register pair is printed.
OUT_NUM_3 1A30 LD BC,$FC18 This is '-1,000'.
1A33 CALL OUT_SP_NO Print a first digit.
1A36 LD BC,$FF9C This is '-100'.
1A39 CALL OUT_SP_NO Print the second digit.
1A3C LD C,$F6 This is '-10'.
1A3E CALL OUT_SP_NO Print the third digit.
1A41 LD A,L Move any remaining part of the number to the A register.
OUT_NUM_4 1A42 CALL OUT_CODE Print the digit.
1A45 POP HL Restore the registers before returning.
1A46 POP DE
1A47 RET
Prev: 19FB Up: Map Next: 1A48