Prev: 59253 Up: Map Next: 59813
59794: Calculate Position To Attribute Address
Used by the routine at 59253.
Input
B Horizontal position
C Vertical position
Output
HL Attribute buffer location
Start with the horizontal position.
Calculate_PositionToAttributeAddress 59794 LD A,B A=X position.
59795 SRA A Divide the X position by 8 to find the character column.
59797 SRA A
59799 SRA A
59801 ADD A,88 Add 88 for the high byte of the attribute buffer and store the result in H.
59803 LD H,A
Now the vertical position.
59804 LD A,B A=X position (again).
59805 AND %00000111 Get the pixel position within the character block.
59807 RRCA Multiply by 32.
59808 RRCA
59809 RRCA
59810 ADD A,C Add the Y co-ordinate and store the result in L.
59811 LD L,A
59812 RET Return.
Prev: 59253 Up: Map Next: 59813