Blob Blame History Raw
From 6f7f6b5119344a4cb855b5ea0b849b96a91701a7 Mon Sep 17 00:00:00 2001
From: jede <jede@oric.org>
Date: Wed, 10 Jul 2019 21:44:07 +0200
Subject: [PATCH 022/170] Fix label, optimize code

---
 libsrc/telestrat/clrscr.s    | 15 +++++++--------
 libsrc/telestrat/cputc.s     |  2 +-
 libsrc/telestrat/gotoxy.s    |  9 ++++++---
 libsrc/telestrat/gotoy.s     |  4 ----
 libsrc/telestrat/textcolor.s |  4 ++--
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/libsrc/telestrat/clrscr.s b/libsrc/telestrat/clrscr.s
index a24647f8..22a88012 100644
--- a/libsrc/telestrat/clrscr.s
+++ b/libsrc/telestrat/clrscr.s
@@ -30,14 +30,13 @@
     sta     ADSCRH
 
     ; reset display position
-    lda     #$01
-    sta     SCRY
-    lda     #$00
-    sta     SCRX
-
-    lda     #$00
-    sta     CHARCOLOR_CHANGE
-    sta     BGCOLOR_CHANGE
+    ldx     #$01
+    stx     SCRY
+    dex
+    stx     SCRX
+
+    stx     CHARCOLOR_CHANGE
+    stx     BGCOLOR_CHANGE
 
     lda     #$07
     sta     CHARCOLOR
diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s
index 96763caf..d313d778 100644
--- a/libsrc/telestrat/cputc.s
+++ b/libsrc/telestrat/cputc.s
@@ -15,7 +15,7 @@
     dec     SCRX
     pha
     lda     CHARCOLOR
-    BRK_TELEMON  $4E             ; Change color on the screen (foreground)
+    BRK_TELEMON  XFWR             ; Change color on the screen (foreground)
     lda     #$00
     sta     CHARCOLOR_CHANGE
     inc     SCRX
diff --git a/libsrc/telestrat/gotoxy.s b/libsrc/telestrat/gotoxy.s
index 8dcb69e8..7a53a77a 100644
--- a/libsrc/telestrat/gotoxy.s
+++ b/libsrc/telestrat/gotoxy.s
@@ -23,14 +23,17 @@ gotoxy: jsr     popa            ; Get Y
         
         jsr     update_adscr          ; Update adress video ram position when SCRY et SCRX are modified
         ;       Force to put again attribute when it moves on the screen
-        lda     #$01
-        sta     CHARCOLOR_CHANGE
-        sta     BGCOLOR_CHANGE
+
         rts
 .endproc
 
 
 .proc update_adscr
+
+        lda     #$01
+        sta     CHARCOLOR_CHANGE
+        sta     BGCOLOR_CHANGE
+
         lda     #<SCREEN
         sta     ADSCRL
 
diff --git a/libsrc/telestrat/gotoy.s b/libsrc/telestrat/gotoy.s
index ae6a0bcf..13be8e42 100644
--- a/libsrc/telestrat/gotoy.s
+++ b/libsrc/telestrat/gotoy.s
@@ -2,7 +2,6 @@
 ; jede jede@oric.org 2017-02-25
 ;
     .export    _gotoy
-    .import    CHARCOLOR_CHANGE, BGCOLOR_CHANGE
 
     .import    update_adscr
 
@@ -14,8 +13,5 @@
 
    ; We change the current line, it means that we need to put color attributes again.
    ; That is not the case with _gotox because, it's on the same line attribute are already set
-   lda     #$01             
-   sta     CHARCOLOR_CHANGE
-   sta     BGCOLOR_CHANGE
    rts
 .endproc
diff --git a/libsrc/telestrat/textcolor.s b/libsrc/telestrat/textcolor.s
index b5584902..ee6ba729 100644
--- a/libsrc/telestrat/textcolor.s
+++ b/libsrc/telestrat/textcolor.s
@@ -9,11 +9,11 @@
 .proc _textcolor
     cmp     CHARCOLOR       ; Do we set the same color? If we don't detect it, we loose one char on the screen for each textcolor call with the same color
     bne     out             ; yes
-    
+
     ldy     #$00
     sty     CHARCOLOR_CHANGE
     
-    lda     CHARCOLOR       ; Return last color
+    ; Return last color
 
     rts
 out:
-- 
2.26.0