Fix bug with bgcolor and textcolor
This commit is contained in:
@@ -4,34 +4,39 @@
|
||||
; void cputc (char c);
|
||||
;
|
||||
|
||||
.export _cputc, CHARCOLOR, CHARCOLOR_CHANGE, BGCOLOR, BGCOLOR_CHANGE
|
||||
.export _cputc, CHARCOLOR, OLD_CHARCOLOR, BGCOLOR, OLD_BGCOLOR
|
||||
|
||||
.include "telestrat.inc"
|
||||
|
||||
.proc _cputc
|
||||
ldx CHARCOLOR_CHANGE
|
||||
ldx CHARCOLOR
|
||||
cpx OLD_CHARCOLOR
|
||||
beq do_not_change_color_foreground
|
||||
|
||||
stx OLD_CHARCOLOR ; Store CHARCOLOR into OLD_CHARCOLOR
|
||||
|
||||
dec SCRX
|
||||
dec SCRX
|
||||
|
||||
pha
|
||||
lda CHARCOLOR
|
||||
txa ; Swap X to A because, X contains CHARCOLOR
|
||||
BRK_TELEMON XFWR ; Change color on the screen (foreground)
|
||||
lda #$00
|
||||
sta CHARCOLOR_CHANGE
|
||||
inc SCRX
|
||||
pla
|
||||
|
||||
do_not_change_color_foreground:
|
||||
ldx BGCOLOR_CHANGE
|
||||
ldx BGCOLOR
|
||||
cpx OLD_BGCOLOR
|
||||
beq do_not_change_color
|
||||
|
||||
stx OLD_BGCOLOR
|
||||
|
||||
dec SCRX ; Dec SCRX in order to place attribute before the right position
|
||||
|
||||
pha
|
||||
lda BGCOLOR
|
||||
txa ; Swap X to A because, X contains CHARCOLOR
|
||||
ORA #%00010000 ; Add 16 because background color is an attribute between 16 and 23. 17 is red background for example
|
||||
BRK_TELEMON XFWR ; Change color on the screen (background)
|
||||
lda #$00
|
||||
sta BGCOLOR_CHANGE
|
||||
|
||||
pla
|
||||
|
||||
do_not_change_color:
|
||||
@@ -41,9 +46,9 @@ do_not_change_color:
|
||||
.bss
|
||||
CHARCOLOR:
|
||||
.res 1
|
||||
CHARCOLOR_CHANGE:
|
||||
OLD_CHARCOLOR:
|
||||
.res 1
|
||||
BGCOLOR:
|
||||
.res 1
|
||||
BGCOLOR_CHANGE:
|
||||
.res 1
|
||||
OLD_BGCOLOR:
|
||||
.res 1
|
||||
|
||||
Reference in New Issue
Block a user