Prev: 43518 Up: Map Next: 43580
43557: 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 43557 SRL H Divide the y position by two...
43559 SRL H ...four...
43561 SRL H ...and eight, to make the character row.
43563 SRL H Halve the row, moving its lowest bit into the carry flag.
43565 RR L Move that bit into the top of L, halving the x position.
43567 SRL H Halve the row again, moving its next bit into the carry flag.
43569 RR L Move that bit into L.
43571 SRL H Halve the row again, moving its top bit into the carry flag.
43573 RR L Move that bit into L, which is now the offset within the section.
43575 LD A,H Fetch the section of the screen.
43576 ADD A,88 Add the address of the attribute file.
43578 LD H,A Store it in H.
43579 RET Return.
Prev: 43518 Up: Map Next: 43580