Prev: 03652 Up: Map Next: 03739
03720: 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 0
HL Display file address
Output
BC Number of spaces from the given line number (B) downwards
DE Corresponding attribute file address
CL_ATTR 03720 LD A,H Fetch the high byte.
03721 RRCA Multiply this value by thirty two.
03722 RRCA
03723 RRCA
03724 DEC A Go back to the 'eight' line.
03725 OR 80 Address the attribute area.
03727 LD H,A Restore to the high byte and transfer the address to DE.
03728 EX DE,HL
03729 LD H,C This is always zero.
03730 LD L,B The line number.
03731 ADD HL,HL Multiply by thirty two.
03732 ADD HL,HL
03733 ADD HL,HL
03734 ADD HL,HL
03735 ADD HL,HL
03736 LD B,H Move the result to the BC register pair before returning.
03737 LD C,L
03738 RET
Prev: 03652 Up: Map Next: 03739