| Routines

0E88: THE 'CL-ATTR' SUBROUTINE

Used by the routines at CL_SC_ALL and CL_LINE. This subroutine has two separate functions. For a given display area address the appropriate attribute address is returned in the DE register pair. Note that the value on entry points to the 'ninth' line of a character. For a given line number, in the B register, the number of character areas in the display from the start of that line onwards is returned in the BC register pair.
Input
B | Line number
C | +00
HL | Display file address
Output
BC | Number of spaces from the given line number (B) downwards
DE | Corresponding attribute file address
CL_ATTR | 0E88 | LD A,H | Fetch the high byte.
| 0E89 | RRCA | Multiply this value by thirty two.
| 0E8A | RRCA
| 0E8B | RRCA
| 0E8C | DEC A | Go back to the 'eight' line.
| 0E8D | OR $50 | Address the attribute area.
| 0E8F | LD H,A | Restore to the high byte and transfer the address to DE.
| 0E90 | EX DE,HL
| 0E91 | LD H,C | This is always zero.
| 0E92 | LD L,B | The line number.
| 0E93 | ADD HL,HL | Multiply by thirty two.
| 0E94 | ADD HL,HL
| 0E95 | ADD HL,HL
| 0E96 | ADD HL,HL
| 0E97 | ADD HL,HL
| 0E98 | LD B,H | Move the result to the BC register pair before returning.
| 0E99 | LD C,L
| 0E9A | RET