Prev: 8C00 Up: Map Next: 8DCC
8D80: 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 8D80 LD B,$45 Compute the column entry address in Column_Pixel_Lookup_Table.
8D82 LD C,H
8D83 SLA C
8D85 RL B
8D87 LD H,$46 Compute the row entry address in Screen_Row_Address_Lookup_Table.
8D89 SLA L
8D8B RL H
8D8D LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
8D8E INC HL
8D8F LD H,(HL)
8D90 LD L,A
8D91 LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
8D92 ADD A,L
8D93 LD L,A
8D94 INC BC
8D95 LD A,(BC) Set the pixel on screen by ORing the column mask.
8D96 OR (HL)
8D97 LD (HL),A
8D98 RET Return.
Alternate entry: erase the pixel by inverting the column mask and clearing the matching bits on screen.
PlotCharacterCell_Erase 8D99 LD B,$45 Compute the column entry address in Column_Pixel_Lookup_Table.
8D9B LD C,H
8D9C SLA C
8D9E RL B
8DA0 LD H,$46 Compute the row entry address in Screen_Row_Address_Lookup_Table.
8DA2 SLA L
8DA4 RL H
8DA6 LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
8DA7 INC HL
8DA8 LD H,(HL)
8DA9 LD L,A
8DAA LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
8DAB ADD A,L
8DAC LD L,A
8DAD INC BC
8DAE LD A,(BC) Invert the column mask and clear the matching bits on screen.
8DAF CPL
8DB0 AND (HL)
8DB1 LD (HL),A
8DB2 RET Return.
Alternate entry: toggle the pixel by flipping the matching bits using the column mask.
PlotCharacterCell_Toggle 8DB3 LD B,$45 Compute the column entry address in Column_Pixel_Lookup_Table.
8DB5 LD C,H
8DB6 SLA C
8DB8 RL B
8DBA LD H,$46 Compute the row entry address in Screen_Row_Address_Lookup_Table.
8DBC SLA L
8DBE RL H
8DC0 LD A,(HL) Read the scan-line base address from Screen_Row_Address_Lookup_Table.
8DC1 INC HL
8DC2 LD H,(HL)
8DC3 LD L,A
8DC4 LD A,(BC) Apply the column byte offset from Column_Pixel_Lookup_Table to the scan-line address and advance to the pixel mask.
8DC5 ADD A,L
8DC6 LD L,A
8DC7 INC BC
8DC8 LD A,(BC) Toggle the matching bits on screen using the column mask.
8DC9 XOR (HL)
8DCA LD (HL),A
8DCB RET Return.
Prev: 8C00 Up: Map Next: 8DCC