]> git.sur5r.net Git - cc65/blobdiff - libsrc/atari5200/bgcolor.s
atari5200: changes from discussions in #870
[cc65] / libsrc / atari5200 / bgcolor.s
index 127d26998639dc8966fbfdc7041fcd1346750d54..90db8892b98f7c1add5c5b3eae22674fefef2c69 100644 (file)
@@ -1,36 +1,26 @@
 ;
-; Christian Groessler, 05-Apr-2019
+; Greg King, 10-Apr-2019
 ;
 
         .export         _bgcolor
 
         .include        "atari5200.inc"
 
-        .constructor    init_old_bgcolor
+.data
 
-.bss
-
-old_bg_color:
-        .res    1
+old_bg_index:
+        .byte   COLOR_BLACK     ; see conioscreen.s for default palette
 
 .code
 
 _bgcolor:
-        and     #3
+        and     #$03
         tax
-        lda     COLOR0,x
-        ldx     old_bg_color
-        sta     COLOR4                  ; set new value
-        sta     old_bg_color
-        txa
-        ldx     #0                      ; fix X
-        rts
-
-.segment        "ONCE"
-
-init_old_bgcolor:
-        lda     COLOR0+3                ; see also conioscreen.s for initialization
-        sta     old_bg_color
+        ldy     COLOR0,x
+        lda     old_bg_index
+        sty     COLOR4          ; set new value
+        stx     old_bg_index
+        ldx     #0              ; fix high byte
         rts
 
-        .end
+.end