Add textcolor and bgcolor.s

This commit is contained in:
jede
2019-07-06 10:16:57 +02:00
committed by greg-king5
parent 14ac1a7ff6
commit 7f9e73a1ce
8 changed files with 129 additions and 14 deletions

View File

@@ -4,12 +4,43 @@
; void cputc (char c);
;
.export _cputc
.export _cputc, CHARCOLOR, CHARCOLOR_CHANGE, BGCOLOR, BGCOLOR_CHANGE
.include "telestrat.inc"
.proc _cputc
BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms)
ldx CHARCOLOR_CHANGE
beq do_not_change_color_foreground
pha
lda CHARCOLOR
BRK_TELEMON $4E ; Change color on the screen (foreground)
lda #$00
sta CHARCOLOR_CHANGE
pla
do_not_change_color_foreground:
ldx BGCOLOR_CHANGE
beq do_not_change_color
pha
lda BGCOLOR
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:
BRK_TELEMON XFWR ; Macro send char to screen (channel 0)
rts
.endproc
CHARCOLOR:
.res 1
CHARCOLOR_CHANGE:
.res 1
BGCOLOR:
.res 1
BGCOLOR_CHANGE:
.res 1