Prev: 55210 Up: Map Next: 55334
55313: Calculate Buffer Address
Finds the address in the screen buffer of the byte that holds a pixel. The buffer has the lines of the screen from the bottom, 32 bytes to a line.
Input
B Pixel Y coordinate
C Pixel X coordinate
Output
BC Address in the buffer
Divide the pixel position by eight and add it to ScreenBuffer.
CalculateBufferAddress 55313 PUSH HL Stash HL on the stack.
55314 SRL B Divide BC by two.
55316 RR C
55318 SRL B Divide BC by four.
55320 RR C
55322 SRL B Divide BC by eight, to make the number of the byte.
55324 RR C
55326 LD HL,55539 Point HL at ScreenBuffer.
55329 ADD HL,BC Add the two.
55330 LD C,L Copy HL to BC.
55331 LD B,H
55332 POP HL Restore HL from the stack and return.
55333 RET
View the equivalent code in;
Prev: 55210 Up: Map Next: 55334