Prev: A875 Up: Map Next: A8BD
A8AE: Calculate Screen Buffer
Input
D Source Y position
E Source X position
Output
HL Screen buffer location
CalculateScreenBuffer A8AE LD A,%00000111 Mask out the bottom 3 bits of the Y position.
A8B0 AND D
A8B1 RRCA Rotate the bits right three positions.
A8B2 RRCA
A8B3 RRCA
A8B4 OR E Combine with the X position.
A8B5 LD L,A L=low byte of the screen buffer address.
A8B6 LD A,D Mask out bits 3-4 of the Y position.
A8B7 AND %00011000
A8B9 OR %01000000 Add the screen buffer memory base address (4000).
A8BB LD H,A H=high byte of the screen buffer address.
A8BC RET Return.
Prev: A875 Up: Map Next: A8BD