2 ; Ullrich von Bassewitz, 06.08.1998
4 ; unsigned char __fastcall__ textcolor (unsigned char color);
5 ; unsigned char __fastcall__ bgcolor (unsigned char color);
6 ; unsigned char __fastcall__ bordercolor (unsigned char color);
9 .export _textcolor, _bgcolor, _bordercolor
16 bit MODE ; Check 80/40 column mode
17 bmi @L1 ; Jump if 80 columns
21 ldx CHARCOLOR ; Get the old color
22 sta CHARCOLOR ; Set the new color
24 ldx #$00 ; Load high byte
29 @L1: tax ; Move new color to X
30 lda CHARCOLOR ; Get old color + attributes
31 and #$F0 ; Keep old attributes
32 ora $CE5C,x ; Translate VIC color -> VDC color
33 ldx CHARCOLOR ; Get the old color
34 sta CHARCOLOR ; Set the new color + old attributes
36 and #$0F ; Mask out attributes
37 ldx #$00 ; Load high byte
39 ; translate vdc->vic colour
57 ldx VIC_BG_COLOR0 ; get old value
58 sta VIC_BG_COLOR0 ; set new value
65 @L1: tax ; Move new color to X
66 lda $CE5C,x ; Translate VIC color -> VDC color
69 jsr $CDDA ; Read vdc register 26
74 jsr $CDCC ; Write vdc register 26
86 ldx VIC_BORDERCOLOR ; get old value
87 sta VIC_BORDERCOLOR ; set new value