2 ; Groepaz/Hitmen, 12.10.2015
4 ; high level implementation for the soft80 implementation
6 ; unsigned char __fastcall__ textcolor (unsigned char color);
7 ; unsigned char __fastcall__ bgcolor (unsigned char color);
10 .export soft80_textcolor, soft80_bgcolor
11 .import soft80_internal_cellcolor, soft80_internal_bgcolor
12 .import soft80_internal_cursorxlsb
13 .import soft80_kplot, soft80_checkchar
21 ldx CHARCOLOR ; get old value
22 sta CHARCOLOR ; set new value
25 lda soft80_internal_bgcolor
30 sta tmp1 ; remember new bg color (high nibble)
32 sta soft80_internal_cellcolor ; text/bg combo for new chars
38 ldx soft80_internal_bgcolor ; get old value
39 stx tmp2 ; save old value
40 sta soft80_internal_bgcolor ; set new value
69 .if SOFT80COLORVOODOO = 1
70 ; if the old bg color is equal to color ram of that cell, then also
71 ; update the color ram to the new value.
74 lda (CRAM_PTR),y ; colram
78 cmp tmp2 ; old bg color
81 ; if the left character in the cell is not a space, then dont update
84 sta soft80_internal_cursorxlsb
87 lda soft80_internal_bgcolor ; new bg color
90 sta (CRAM_PTR),y ; colram
94 ; if the old bg color is equal to text color in this cell, then also
95 ; update the text color to the new value.
97 lda (CRAM_PTR),y ; vram
99 cmp tmp2 ; old bg color
102 ; if there are non space characters in the cell, do not update the
106 sta soft80_internal_cursorxlsb
112 inc soft80_internal_cursorxlsb
117 lda soft80_internal_bgcolor ; new bg color
119 ora tmp1 ; new bg color (high nibble)
120 sta (CRAM_PTR),y ; vram
152 lda tmp2 ; get old value
155 ;-------------------------------------------------------------------------------
156 ; force the init constructor to be imported
159 conio_init = soft80_init