Prev: E775 Up: Map Next: E9A5
E992: Calculate Position To Attribute Address
Used by the routine at E775.
Input
B Horizontal position
C Vertical position
Output
HL Attribute buffer location
Start with the horizontal position.
Calculate_PositionToAttributeAddress E992 LD A,B A=X position.
E993 SRA A Divide the X position by 08 to find the character column.
E995 SRA A
E997 SRA A
E999 ADD A,$58 Add 58 for the high byte of the attribute buffer and store the result in H.
E99B LD H,A
Now the vertical position.
E99C LD A,B A=X position (again).
E99D AND %00000111 Get the pixel position within the character block.
E99F RRCA Multiply by 20.
E9A0 RRCA
E9A1 RRCA
E9A2 ADD A,C Add the Y co-ordinate and store the result in L.
E9A3 LD L,A
E9A4 RET Return.
Prev: E775 Up: Map Next: E9A5