Prev: D0BD Up: Map Next: D135
D120: Buffer address of a pixel position
The buffer is plain rows of 32 bytes, the bottom line first, so the address is y * 32 + x / 8 from its start: BC shifted right three times. HL is kept. As Knight Lore's calc_vidbuf_addr.
Input
C the pixel x
B the pixel y, counted up from the bottom of the screen
Output
BC the address in BUFFER
CALC_VIDBUF_ADDR D120 PUSH HL
D121 SRL B BC / 8 = y * 32 + x / 8
D123 RR C
D125 SRL B
D127 RR C
D129 SRL B
D12B RR C
D12D LD HL,BUFFER Plus the start of the buffer
D130 ADD HL,BC
D131 LD C,L
D132 LD B,H
D133 POP HL
D134 RET
Prev: D0BD Up: Map Next: D135