| Routines

03545: 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 | 03545 | LD HL,23296 | The start of the printer buffer.
| 03548 | BIT 1,(IY+1) | Jump forward if handling the printer buffer (bit 1 of FLAGS set).
| 03552 | JR NZ,CL_SET_2
| 03554 | LD A,B | Transfer the line number.
| 03555 | BIT 0,(IY+2) | Jump forward if handling the main part of the display (bit 0 of TV-FLAG reset).
| 03559 | JR Z,CL_SET_1
| 03561 | ADD A,(IY+49) | The top line of the lower part of the display is called 'line 24' and this has to be converted (see DF-SZ).
| 03564 | SUB 24
CL_SET_1 | 03566 | PUSH BC | The line and column numbers are saved.
| 03567 | LD B,A | The line number is moved.
| 03568 | CALL CL_ADDR | The address for the start of the line is formed in HL.
| 03571 | POP BC | The line and column numbers are fetched back.
CL_SET_2 | 03572 | LD A,33 | The column number is now reversed and transferred to the DE register pair.
| 03574 | SUB C
| 03575 | LD E,A
| 03576 | LD D,0
| 03578 | 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.
| 03579 | JP PO_STORE