Prev: 9BEA Up: Map Next: 9C79
9C61: Plot Pixel
Used by the routine at DrawLine.
Sets one pixel in the screen buffer.
Before After
plot-pixel-before plot-pixel-after
Input
H The Y position
L The X position
PlotPixel 9C61 LD A,L Fetch the X position.
9C62 AND %00000111 Keep only bits 0-2.
9C64 INC A Add one, to get the number of shifts.
9C65 LD B,A Keep the number of shifts in B.
9C66 XOR A Clear A, ready to make the mask for the pixel.
9C67 SCF Set the carry flag.
PlotPixel_Mask 9C68 RRA Rotate the carry flag into A.
9C69 DJNZ PlotPixel_Mask Decrease the shift counter by one and loop back to PlotPixel_Mask until the pixel is in position.
9C6B PUSH HL Stash the position on the stack.
9C6C PUSH AF Stash the pixel on the stack.
9C6D EX AF,AF' Switch to the shadow AF register.
9C6E PUSH AF Stash it on the stack.
9C6F CALL ScreenAddress Call ScreenAddress to get the screen buffer address.
9C72 POP AF Restore the shadow AF register from the stack.
9C73 EX AF,AF' Switch back to the main AF register.
9C74 POP AF Restore the pixel from the stack.
9C75 OR (HL) Combine it with the byte in the screen buffer.
9C76 LD (HL),A Write it back.
9C77 POP HL Restore the position from the stack.
9C78 RET Return.
Prev: 9BEA Up: Map Next: 9C79