Prev: DA56 Up: Map Next: DADC
DACD: Calculate Screen Block Address
Input
B X co-ordinate
C Y co-ordinate
Output
HL Screen buffer address pointer
Calculate_ScreenBlockAddress DACD LD A,B Load the X position into A.
DACE AND %11111000 Divide X by 08 to extract only the column number.
DAD0 ADD A,$40 Add 40 to get the high byte of screen address and store the result in H.
DAD2 LD H,A
DAD3 LD A,B Load the X position into A again.
DAD4 AND %00000111 Extract only the pixel offset within the character block.
DAD6 RRCA Multiply A by 20.
DAD7 RRCA
DAD8 RRCA
DAD9 ADD A,C Add the Y co-ordinate store the result in L.
DADA LD L,A
DADB RET Return.
Prev: DA56 Up: Map Next: DADC