| Routines

0DD9: THE 'CL-SET' SUBROUTINE

Used by the routines at PO_BACK_1, PO_ENTER, PO_TV_2, PO_SCR, CLS, CLEAR_PRB, ED_COPY and INPUT. The routine at CL_ALL continues here. This subroutine is entered with the BC register pair holding the line and column numbers of a character area, or the C register holding the column number within the printer buffer. The appropriate address of the first character bit is then found. The subroutine returns via PO_STORE so as to store all the values in the required system variables.
Input
B | Line number
C | Column number
CL_SET | 0DD9 | LD HL,$5B00 | The start of the printer buffer.
| 0DDC | BIT 1,(IY+$01) | Jump forward if handling the printer buffer (bit 1 of FLAGS set).
| 0DE0 | JR NZ,CL_SET_2
| 0DE2 | LD A,B | Transfer the line number.
| 0DE3 | BIT 0,(IY+$02) | Jump forward if handling the main part of the display (bit 0 of TV-FLAG reset).
| 0DE7 | JR Z,CL_SET_1
| 0DE9 | ADD A,(IY+$31) | The top line of the lower part of the display is called 'line +18' and this has to be converted (see DF-SZ).
| 0DEC | SUB $18
CL_SET_1 | 0DEE | PUSH BC | The line and column numbers are saved.
| 0DEF | LD B,A | The line number is moved.
| 0DF0 | CALL CL_ADDR | The address for the start of the line is formed in HL.
| 0DF3 | POP BC | The line and column numbers are fetched back.
CL_SET_2 | 0DF4 | LD A,$21 | The column number is now reversed and transferred to the DE register pair.
| 0DF6 | SUB C
| 0DF7 | LD E,A
| 0DF8 | LD D,$00
| 0DFA | ADD HL,DE | The required address is now formed, and the address and the line and column numbers are stored by jumping to PO_STORE.
| 0DFB | JP PO_STORE