Prev: B2EE Up: Map Next: B394
B37F: 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. The same as Knight Lore's.
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 B37F PUSH HL BC / 8 = y * 32 + x / 8
B380 SRL B
B382 RR C
B384 SRL B
B386 RR C
B388 SRL B
B38A RR C
B38C LD HL,BUFFER Plus the start of the buffer
B38F ADD HL,BC
B390 LD C,L
B391 LD B,H
B392 POP HL
B393 RET
Prev: B2EE Up: Map Next: B394