Prev: F56E Up: Map Next: F5FB
F5D2: Plot A Pixel
Used by the routines at DrawingFill and DrawingLine.
Sets the pixel under the pen and paints its attribute with the ink at F60B.
PlotPixel F5D2 PUSH HL Ask the ROM for this pixel's address and keep the mask.
F5D3 CALL PixelAddress
F5D6 PUSH AF
F5D7 PUSH HL
F5D8 LD A,H Take the high byte of the pixel address.
F5D9 AND $18 Keep the third of the screen it falls in.
F5DB RRCA Shift that third down to the low bits.
F5DC RRCA
F5DD RRCA
F5DE ADD A,$58 Add 58 to reach the attribute file.
F5E0 LD H,A Point at the attribute and clear its ink.
F5E1 LD A,(HL)
F5E2 AND $38
F5E4 LD (HL),A
F5E5 LD A,($F60B) Rotate the ink at F60B into the paper bits and skip the clash test when it already differs from the attribute.
F5E8 RLCA
F5E9 RLCA
F5EA RLCA
F5EB CP (HL)
F5EC JR NZ,PlotPixel_0
F5EE XOR $38 Flip the ink when it matches the paper colour already there, so it stays visible.
PlotPixel_0 F5F0 RRCA Shift the ink back into place and merge it into the attribute.
F5F1 RRCA
F5F2 RRCA
F5F3 OR (HL)
F5F4 LD (HL),A
F5F5 POP HL Restore the pixel address and the mask from the stack.
F5F6 POP AF
F5F7 OR (HL) Set the pixel in the display byte.
F5F8 LD (HL),A
F5F9 POP HL
F5FA RET Return.
View the equivalent code in;
Prev: F56E Up: Map Next: F5FB