Prev: 06651 Up: Map Next: 06728
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.
BC Number to print
OUT_NUM_1 06683 PUSH DE Save the other registers throughout the subroutine.
06684 PUSH HL
06685 XOR A Clear the A register.
06686 BIT 7,B Jump forward to print a zero rather than '-2' when reporting on the edit-line.
06688 JR NZ,OUT_NUM_4
06690 LD H,B Move the number to the HL register pair.
06691 LD L,C
06692 LD E,255 Flag 'no leading spaces'.
06694 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 06696 PUSH DE Save the DE register pair.
06697 LD D,(HL) Fetch the number into the DE register pair and save the pointer (updated).
06698 INC HL
06699 LD E,(HL)
06700 PUSH HL
06701 EX DE,HL Move the number to the HL register pair and flag 'leading spaces are to be printed'.
06702 LD E,32
Now the integer form of the number in the HL register pair is printed.
OUT_NUM_3 06704 LD BC,64536 This is '-1,000'.
06707 CALL OUT_SP_NO Print a first digit.
06710 LD BC,65436 This is '-100'.
06713 CALL OUT_SP_NO Print the second digit.
06716 LD C,246 This is '-10'.
06718 CALL OUT_SP_NO Print the third digit.
06721 LD A,L Move any remaining part of the number to the A register.
OUT_NUM_4 06722 CALL OUT_CODE Print the digit.
06725 POP HL Restore the registers before returning.
06726 POP DE
06727 RET
Prev: 06651 Up: Map Next: 06728