Prev: 33105 Up: Map Next: 33246
33205: Drawing: Address The Pixel
Used by the routines at DrawingSetup and Drawing_PlotTheSelectedPixel.
Turns the pixel coordinate into a screen address and sets the bit in that screen byte.
Drawing_AddressThePixel 33205 PUSH HL Call Drawing_ScreenAddressFromTheRow to turn the pen into a screen address.
33206 CALL Drawing_ScreenAddressFromTheRow
33209 PUSH AF Keep the screen address and split out its row bits.
33210 PUSH HL
33211 LD A,H
33212 AND %00011000 Move the row bits of the screen address into the attribute address.
33214 RRCA Rotate right.
33215 RRCA Rotate right.
33216 RRCA Rotate right.
33217 ADD A,88 Add it on.
33219 LD H,A Point H at that attribute.
33220 LD A,(HL) Read the attribute byte.
33221 AND %00111000 Keep only the paper bits (3-5) of this attribute, and jump to Drawing_AddressThePixel_RestoreTheInkBits unless they match the colour in 33358 shifted into bits 3-5.
33223 LD (HL),A
33224 LD A,(33358)
33227 RLCA
33228 RLCA
33229 RLCA
33230 CP (HL)
33231 JR NZ,Drawing_AddressThePixel_RestoreTheInkBits
33233 XOR 56 Flip the bits selected by 56.
Drawing_AddressThePixel_RestoreTheInkBits 33235 RRCA Shift the replacement ink back into the ink bits.
33236 RRCA
33237 RRCA
33238 OR (HL) Combine it with the attribute on screen.
33239 LD (HL),A Store the attribute.
33240 POP HL Plot the pixel into the screen byte.
33241 POP AF
33242 OR (HL)
33243 LD (HL),A Store the screen byte.
33244 POP HL Restore HL from the stack.
33245 RET Return.
View the equivalent code in;
Prev: 33105 Up: Map Next: 33246