Prev: DCC2 Up: Map Next: DCDC
DCD1: Calculate Attribute Address
Input
HL Screen buffer address
Output
DE Attribute buffer address
Calculate_AttributeAddress DCD1 LD A,H A=high byte of the screen address.
Isolate the screen third area.
DCD2 RRCA Move the relevant bits to positions 0-1.
DCD3 RRCA
DCD4 RRCA
DCD5 AND %00000011 Keep only those bits.
This sets 58 on top of the result, which is the base address for the attribute buffer. Will result in either: 58, 59 or 5A.
DCD7 OR %01011000 Set bits 3-4 and 6.
DCD9 LD D,A Store the result in D, this is the high byte of the attribute buffer address.
DCDA LD E,L E=low byte of the screen address.
DCDB RET Return.
Prev: DCC2 Up: Map Next: DCDC