Prev: DC4B Up: Map Next: DCD1
DCC2: Calculate Screen Block Address
Input
B X co-ordinate
C Y co-ordinate
Output
HL Screen buffer address pointer
Calculate_ScreenBlockAddress DCC2 LD A,B Load the X position into A.
DCC3 AND %11111000 Divide X by 08 to extract only the column number.
DCC5 ADD A,$40 Add 40 to get the high byte of screen address and store the result in H.
DCC7 LD H,A
DCC8 LD A,B Load the X position into A again.
DCC9 AND %00000111 Extract only the pixel offset within the character block.
DCCB RRCA Multiply A by 20.
DCCC RRCA
DCCD RRCA
DCCE ADD A,C Add the Y co-ordinate store the result in L.
DCCF LD L,A
DCD0 RET Return.
Prev: DC4B Up: Map Next: DCD1