Prev: EBC8 Up: Map Next: ECDE
ECA4: Initialise Display and Set Border
Clears the display pixel area (4000-57FF) to black and fills the 768 attribute cells with the byte in A, then derives the border colour from A's paper bits and updates both BORDCR (5C48) and the ULA border port (FE).
Input
A Attribute byte for the display fill
Initialise_Display_And_Border ECA4 LD HL,$4000 Set up to clear the pixel area (4000-57FF 1800 bytes).
ECA7 LD DE,$4001
ECAA LD BC,$1800
ECAD LD (HL),$00 Clear the first pixel byte and fill the remaining display pixels to black via LDIR.
ECAF LDIR
ECB1 LD BC,$0300 Set the attribute fill count to 0300 cells.
ECB4 LD (HL),A Seed the first attribute cell with A and fill all 0300 attribute cells via LDIR.
ECB5 LDIR
ECB7 AND %00111000 Isolate the paper colour bits from the attribute.
ECB9 BIT 5,A Skip to Set_Border_Colour if the paper colour is in the upper range (04-07).
ECBB JR NZ,Set_Border_Colour
ECBD XOR %00000111 Complement the ink colour bits to contrast with dark paper.
Set_Border_Colour ECBF LD ($5C48),A Write the background colour to *BORDCR.
ECC2 AND %00111000 Re-isolate the paper colour bits.
ECC4 RRCA Shift the paper colour into the low 3 bits.
ECC5 RRCA
ECC6 RRCA
ECC7 OUT ($FE),A Write the paper colour to the ULA border port FE.
ECC9 RET Return.
This entry point is used by the routine at Display_High_Score_Entry_Screen.
Alternate entry: compute a score character position as A × 8 + B and highlight its attribute row via Calculate_Attr_Cell_Address and Highlight_Score_Entry_Row.
Render_Score_Character ECCA ADD A,A Compute the character position index as A × 8 + B.
ECCB ADD A,A
ECCC ADD A,A
ECCD ADD A,B
ECCE CALL Calculate_Attr_Cell_Address Calculate the attribute cell address for this position via Calculate_Attr_Cell_Address.
ECD1 CALL Highlight_Score_Entry_Row Highlight the score entry row with bright white via Highlight_Score_Entry_Row.
ECD4 RET Return.
This entry point is used by the routine at Display_High_Score_Entry_Screen.
Alternate entry: highlight a single score entry attribute cell on row 59 directly, using A × 2 + 1 as the cell offset.
Highlight_Score_Entry_Cell ECD5 ADD A,A Compute the attribute cell offset as A × 2 + 1.
ECD6 ADD A,$01
ECD8 LD L,A
ECD9 LD H,$59 Write INK: WHITE, PAPER: BLACK (BRIGHT) to attribute row 59 at the computed offset.
ECDB LD (HL),$47
ECDD RET Return.
Prev: EBC8 Up: Map Next: ECDE