Prev: 35840 Up: Map Next: 36300
36224: Plot Screen Pixel
Renders one pixel at screen position (H = pixel column, L = pixel row). Derives the column byte offset and pixel mask by indexing into Column_Pixel_Lookup_Table, and reads the screen scan-line address from Screen_Row_Address_Lookup_Table. Three entry points: PlotCharacterCell_Draw draws by setting bits, PlotCharacterCell_Erase erases by clearing bits, PlotCharacterCell_Toggle toggles bits.
Input
H Pixel column
L Pixel row
PlotCharacterCell_Draw 36224 LD B,69 Compute the column entry address in Column_Pixel_Lookup_Table.
36226 LD C,H
36227 SLA C
36229 RL B
36231 LD H,70 Compute the row entry address in Screen_Row_Address_Lookup_Table.
36233 SLA L
36235 RL H
36237 LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
36238 INC HL
36239 LD H,(HL)
36240 LD L,A
36241 LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
36242 ADD A,L
36243 LD L,A
36244 INC BC
36245 LD A,(BC) Set the pixel on screen by ORing the column mask.
36246 OR (HL)
36247 LD (HL),A
36248 RET Return.
Alternate entry: erase the pixel by inverting the column mask and clearing the matching bits on screen.
PlotCharacterCell_Erase 36249 LD B,69 Compute the column entry address in Column_Pixel_Lookup_Table.
36251 LD C,H
36252 SLA C
36254 RL B
36256 LD H,70 Compute the row entry address in Screen_Row_Address_Lookup_Table.
36258 SLA L
36260 RL H
36262 LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
36263 INC HL
36264 LD H,(HL)
36265 LD L,A
36266 LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
36267 ADD A,L
36268 LD L,A
36269 INC BC
36270 LD A,(BC) Invert the column mask and clear the matching bits on screen.
36271 CPL
36272 AND (HL)
36273 LD (HL),A
36274 RET Return.
Alternate entry: toggle the pixel by flipping the matching bits using the column mask.
PlotCharacterCell_Toggle 36275 LD B,69 Compute the column entry address in Column_Pixel_Lookup_Table.
36277 LD C,H
36278 SLA C
36280 RL B
36282 LD H,70 Compute the row entry address in Screen_Row_Address_Lookup_Table.
36284 SLA L
36286 RL H
36288 LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
36289 INC HL
36290 LD H,(HL)
36291 LD L,A
36292 LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
36293 ADD A,L
36294 LD L,A
36295 INC BC
36296 LD A,(BC) Toggle the matching bits on screen using the column mask.
36297 XOR (HL)
36298 LD (HL),A
36299 RET Return.
Prev: 35840 Up: Map Next: 36300