Prev: DACD Up: Map Next: DAE7
DADC: Calculate Attribute Address
Used by the routines at D609, D8CA, D989, D9F0, DA56, DAE7, DC74 and Draw_Cursor.
Input
HL Screen buffer address
Output
DE Attribute buffer address
Calculate_AttributeAddress DADC LD A,H A=high byte of the screen address.
Isolate the screen third area.
DADD RRCA Move the relevant bits to positions 0-1.
DADE RRCA
DADF RRCA
DAE0 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.
DAE2 OR %01011000 Set bits 3-4 and 6.
DAE4 LD D,A Store the result in D, this is the high byte of the attribute buffer address.
DAE5 LD E,L E=low byte of the screen address.
DAE6 RET Return.
Prev: DACD Up: Map Next: DAE7