2018-04-14 19:52:11 +00:00
|
|
|
; 2018-04-13, Jede (jede@oric.org)
|
|
|
|
;
|
|
|
|
|
|
|
|
; void cputc (char c);
|
|
|
|
;
|
|
|
|
|
2020-11-15 16:44:12 +00:00
|
|
|
.export _cputc, cputdirect
|
|
|
|
.export CHARCOLOR, OLD_CHARCOLOR, BGCOLOR, OLD_BGCOLOR
|
2018-04-14 19:52:11 +00:00
|
|
|
|
|
|
|
.include "telestrat.inc"
|
|
|
|
|
2020-11-15 16:44:12 +00:00
|
|
|
cputdirect:
|
2018-04-14 19:52:11 +00:00
|
|
|
.proc _cputc
|
2019-07-17 19:48:53 +00:00
|
|
|
ldx CHARCOLOR
|
|
|
|
cpx OLD_CHARCOLOR
|
2019-07-06 08:16:57 +00:00
|
|
|
beq do_not_change_color_foreground
|
2020-11-15 16:44:12 +00:00
|
|
|
|
2019-07-17 19:48:53 +00:00
|
|
|
stx OLD_CHARCOLOR ; Store CHARCOLOR into OLD_CHARCOLOR
|
|
|
|
|
2019-07-07 20:02:48 +00:00
|
|
|
dec SCRX
|
|
|
|
dec SCRX
|
2019-07-17 19:48:53 +00:00
|
|
|
|
2019-07-06 08:16:57 +00:00
|
|
|
pha
|
2019-07-17 19:48:53 +00:00
|
|
|
txa ; Swap X to A because, X contains CHARCOLOR
|
2019-07-10 19:44:07 +00:00
|
|
|
BRK_TELEMON XFWR ; Change color on the screen (foreground)
|
2019-07-07 20:02:48 +00:00
|
|
|
inc SCRX
|
2019-07-06 08:16:57 +00:00
|
|
|
pla
|
|
|
|
|
|
|
|
do_not_change_color_foreground:
|
2019-07-17 19:48:53 +00:00
|
|
|
ldx BGCOLOR
|
|
|
|
cpx OLD_BGCOLOR
|
2019-07-06 08:16:57 +00:00
|
|
|
beq do_not_change_color
|
2019-07-17 19:48:53 +00:00
|
|
|
|
|
|
|
stx OLD_BGCOLOR
|
|
|
|
|
2019-07-07 20:02:48 +00:00
|
|
|
dec SCRX ; Dec SCRX in order to place attribute before the right position
|
2019-07-17 19:48:53 +00:00
|
|
|
|
2019-07-06 08:16:57 +00:00
|
|
|
pha
|
2019-07-21 09:01:14 +00:00
|
|
|
txa ; Swap X to A because, X contains BGCOLOR
|
2019-07-06 08:16:57 +00:00
|
|
|
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)
|
|
|
|
pla
|
|
|
|
|
|
|
|
do_not_change_color:
|
|
|
|
BRK_TELEMON XFWR ; Macro send char to screen (channel 0)
|
2018-04-14 19:52:11 +00:00
|
|
|
rts
|
|
|
|
.endproc
|
2019-07-07 20:02:48 +00:00
|
|
|
.bss
|
2019-07-06 08:16:57 +00:00
|
|
|
CHARCOLOR:
|
|
|
|
.res 1
|
2019-07-17 19:48:53 +00:00
|
|
|
OLD_CHARCOLOR:
|
2020-11-15 16:44:12 +00:00
|
|
|
.res 1
|
2019-07-06 08:16:57 +00:00
|
|
|
BGCOLOR:
|
2020-11-15 16:44:12 +00:00
|
|
|
.res 1
|
2019-07-17 19:48:53 +00:00
|
|
|
OLD_BGCOLOR:
|
|
|
|
.res 1
|