| Routines

15EF: THE 'MAIN PRINTING' SUBROUTINE

Used by the routines at MAIN_EXEC, OUT_SP_2, OUT_NUM_1 and PRINT_FP.
Input
A | Value from +00 to +09 (for digits) or +11 to +22 (for the letters A-R)
OUT_CODE | 15EF | LD E,$30 | Increase the value in the A register by +30.
| 15F1 | ADD A,E
This entry point is used by the routine at PRINT_A_1 with A holding the code of the character to be printed.
PRINT_A_2 | 15F2 | EXX | Save the registers.
| 15F3 | PUSH HL
| 15F4 | LD HL,($5C51) | Fetch the base address for the current channel (CURCHL). This will point to an output address.
This entry point is used by the routine at INPUT_AD with A holding the code of the character to be printed. Now call the actual subroutine. HL points to the output or the input address as directed.
CALL_SUB | 15F7 | LD E,(HL) | Fetch the low byte.
| 15F8 | INC HL | Fetch the high byte.
| 15F9 | LD D,(HL)
| 15FA | EX DE,HL | Move the address to the HL register pair.
| 15FB | CALL CALL_JUMP | Call the actual subroutine.
| 15FE | POP HL | Restore the registers.
| 15FF | EXX
| 1600 | RET | Return will be from here unless an error occurred.