Blob Blame Raw
From 0fe98a7ca862d42456a5b9cdba4daf22b94de843 Mon Sep 17 00:00:00 2001
From: jede <jede@oric.org>
Date: Thu, 18 Jul 2019 20:48:10 +0200
Subject: [PATCH 25/29] Fix bgcolor and textcolor must return last color, jmp
 remove.

---
 libsrc/telestrat/bgcolor.s   | 2 ++
 libsrc/telestrat/clrscr.s    | 8 ++------
 libsrc/telestrat/gotoxy.s    | 6 +++---
 libsrc/telestrat/textcolor.s | 2 ++
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libsrc/telestrat/bgcolor.s b/libsrc/telestrat/bgcolor.s
index 2f602922..90a63e6d 100644
--- a/libsrc/telestrat/bgcolor.s
+++ b/libsrc/telestrat/bgcolor.s
@@ -7,6 +7,8 @@
         .include        "telestrat.inc"
 
 .proc _bgcolor
+    ldx     BGCOLOR     ; Get previous color
     sta     BGCOLOR
+    txa                 ; Return previous color
     rts
 .endproc
diff --git a/libsrc/telestrat/clrscr.s b/libsrc/telestrat/clrscr.s
index f44000d1..52f34dca 100644
--- a/libsrc/telestrat/clrscr.s
+++ b/libsrc/telestrat/clrscr.s
@@ -34,12 +34,8 @@
     dex
     stx     SCRX
     
-    ; X is equal to 0
-    stx     BGCOLOR
-    stx     OLD_BGCOLOR
-
-    lda     #$07
-    sta     CHARCOLOR
+    lda     #$FF
+    sta     OLD_BGCOLOR
     sta     OLD_CHARCOLOR
 
     rts
diff --git a/libsrc/telestrat/gotoxy.s b/libsrc/telestrat/gotoxy.s
index 890970eb..3387efe4 100644
--- a/libsrc/telestrat/gotoxy.s
+++ b/libsrc/telestrat/gotoxy.s
@@ -24,8 +24,8 @@ gotoxy: jsr     popa            ; Get Y
     jsr     popa
     sta     SCRX
 
-    jmp     update_adscr          ; Update adress video ram position when SCRY is modified 
-    
+; Update adress video ram position when SCRY is modified (update_adscr)
+; Fall through
 .endproc
 
 .proc update_adscr
@@ -48,7 +48,7 @@ gotoxy: jsr     popa            ; Get Y
 loop:
     lda     ADSCRL          
     clc
-    adc     #$28
+    adc     #SCREEN_XSIZE
     bcc     skip
     inc     ADSCRH
 skip:
diff --git a/libsrc/telestrat/textcolor.s b/libsrc/telestrat/textcolor.s
index 77bf6c71..7d16c9e1 100644
--- a/libsrc/telestrat/textcolor.s
+++ b/libsrc/telestrat/textcolor.s
@@ -6,6 +6,8 @@
         .include        "telestrat.inc"
 
 .proc _textcolor
+    ldx     CHARCOLOR     ; Get previous color
     sta     CHARCOLOR
+    txa                   ; Return previous color
     rts
 .endproc
-- 
2.21.0