Prev: 56395 Up: Map Next: 56529
56514: Calculate Screen Block Address
Input
B X co-ordinate
C Y co-ordinate
Output
HL Screen buffer address pointer
Calculate_ScreenBlockAddress 56514 LD A,B Load the X position into A.
56515 AND %11111000 Divide X by 8 to extract only the column number.
56517 ADD A,64 Add 64 to get the high byte of screen address and store the result in H.
56519 LD H,A
56520 LD A,B Load the X position into A again.
56521 AND %00000111 Extract only the pixel offset within the character block.
56523 RRCA Multiply A by 32.
56524 RRCA
56525 RRCA
56526 ADD A,C Add the Y co-ordinate store the result in L.
56527 LD L,A
56528 RET Return.
Prev: 56395 Up: Map Next: 56529