Prev: A9FE Up: Map Next: AA3C
AA25: Get Attribute Address
Used by the routine at FillScratchRectangle.
Finds the address in the attribute file of a position in pixels.
Input
H The y position in pixels from the top of the screen
L The x position in pixels from the left of the screen
Output
HL The attribute address
GetAttributeAddress AA25 SRL H Divide the y position by two...
AA27 SRL H ...four...
AA29 SRL H ...and eight, to make the character row.
AA2B SRL H Halve the row, moving its lowest bit into the carry flag.
AA2D RR L Move that bit into the top of L, halving the x position.
AA2F SRL H Halve the row again, moving its next bit into the carry flag.
AA31 RR L Move that bit into L.
AA33 SRL H Halve the row again, moving its top bit into the carry flag.
AA35 RR L Move that bit into L, which is now the offset within the section.
AA37 LD A,H Fetch the section of the screen.
AA38 ADD A,$58 Add the address of the attribute file.
AA3A LD H,A Store it in H.
AA3B RET Return.
Prev: A9FE Up: Map Next: AA3C