1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
cc65/libsrc/atari7800/textcolor.s

54 lines
1.1 KiB
ArmAsm
Raw Normal View History

2022-04-16 18:13:51 +00:00
;
; Karri Kaksonen, 2022-04-16
;
;
.export _textcolor
.export txtcolor
.include "atari7800.inc"
.data
;-----------------------------------------------------------------------------
; Holder of the text colour offset
; 0 = red, 42 = green, 84 = white
;
txtcolor:
.byte 0
.code
;-----------------------------------------------------------------------------
; Change the text colour
;
; Logical colour names are
; 0 = red
; 1 = green
; 2 = white
;
; The routine will also return the previous textcolor
;
.proc _textcolor
beq @L2
sec
sbc #1
beq @L1
lda #84
jmp @L2
@L1: lda #42
@L2: ldy txtcolor
sta txtcolor ; Store new textcolor
2022-04-16 18:32:22 +00:00
ldx #0
2022-04-16 18:13:51 +00:00
tya
bne @L3
rts ; Old colour was 0
@L3: sec
sbc #42
bne @L4
lda #1
rts ; Old colour was 1
@L4: lda #2
rts ; Old colour was 2
.endproc