Prev: 55894 Up: Map Next: 56028
56013: Calculate Screen Block Address
Input
B X co-ordinate
C Y co-ordinate
Output
HL Screen buffer address pointer
Calculate_ScreenBlockAddress 56013 LD A,B Load the X position into A.
56014 AND %11111000 Divide X by 8 to extract only the column number.
56016 ADD A,64 Add 64 to get the high byte of screen address and store the result in H.
56018 LD H,A
56019 LD A,B Load the X position into A again.
56020 AND %00000111 Extract only the pixel offset within the character block.
56022 RRCA Multiply A by 32.
56023 RRCA
56024 RRCA
56025 ADD A,C Add the Y co-ordinate store the result in L.
56026 LD L,A
56027 RET Return.
Prev: 55894 Up: Map Next: 56028