| Routines

03739: THE 'CL-ADDR' SUBROUTINE

Used by the routines at PO_SCR, CL_SET, CL_SC_ALL and CL_LINE. For a given line number, in the B register, the appropriate display file address is formed in the HL register pair.
Input
B | Line number
Output
HL | Display file address
CL_ADDR | 03739 | LD A,24 | The line number has to be reversed.
| 03741 | SUB B
| 03742 | LD D,A | The result is saved in D.
| 03743 | RRCA | In effect '(A mod 8)*32'. In a 'third' of the display the low byte for the first line is 0, for the second line 32, etc.
| 03744 | RRCA
| 03745 | RRCA
| 03746 | AND 224
| 03748 | LD L,A | The low byte goes into L.
| 03749 | LD A,D | The true line number is fetched.
| 03750 | AND 24 | In effect '64+8*INT (A/8)'. For the upper 'third' of the display the high byte is 64, for the middle 'third' 72, and for the lower 'third' 80.
| 03752 | OR 64
| 03754 | LD H,A | The high byte goes to H.
| 03755 | RET | Finished.