Prev: 56514 Up: Map Next: 56540
56529: Calculate Attribute Address
Used by the routines at Handler_Bonus, 55999, 56190, 56293, 56395, MoveTile_Up, Draw_Tile and Draw_Cursor.
Input
HL Screen buffer address
Output
DE Attribute buffer address
Calculate_AttributeAddress 56529 LD A,H A=high byte of the screen address.
Isolate the screen third area.
56530 RRCA Move the relevant bits to positions 0-1.
56531 RRCA
56532 RRCA
56533 AND %00000011 Keep only those bits.
This sets 88 on top of the result, which is the base address for the attribute buffer. Will result in either: 88, 89 or 90.
56535 OR %01011000 Set bits 3-4 and 6.
56537 LD D,A Store the result in D, this is the high byte of the attribute buffer address.
56538 LD E,L E=low byte of the screen address.
56539 RET Return.
Prev: 56514 Up: Map Next: 56540