Blame 0022-Fix-label-optimize-code.patch

f26de6
From 6f7f6b5119344a4cb855b5ea0b849b96a91701a7 Mon Sep 17 00:00:00 2001
f26de6
From: jede <jede@oric.org>
f26de6
Date: Wed, 10 Jul 2019 21:44:07 +0200
f26de6
Subject: [PATCH 22/29] Fix label, optimize code
f26de6
f26de6
---
f26de6
 libsrc/telestrat/clrscr.s    | 15 +++++++--------
f26de6
 libsrc/telestrat/cputc.s     |  2 +-
f26de6
 libsrc/telestrat/gotoxy.s    |  9 ++++++---
f26de6
 libsrc/telestrat/gotoy.s     |  4 ----
f26de6
 libsrc/telestrat/textcolor.s |  4 ++--
f26de6
 5 files changed, 16 insertions(+), 18 deletions(-)
f26de6
f26de6
diff --git a/libsrc/telestrat/clrscr.s b/libsrc/telestrat/clrscr.s
f26de6
index a24647f8..22a88012 100644
f26de6
--- a/libsrc/telestrat/clrscr.s
f26de6
+++ b/libsrc/telestrat/clrscr.s
f26de6
@@ -30,14 +30,13 @@
f26de6
     sta     ADSCRH
f26de6
 
f26de6
     ; reset display position
f26de6
-    lda     #$01
f26de6
-    sta     SCRY
f26de6
-    lda     #$00
f26de6
-    sta     SCRX
f26de6
-
f26de6
-    lda     #$00
f26de6
-    sta     CHARCOLOR_CHANGE
f26de6
-    sta     BGCOLOR_CHANGE
f26de6
+    ldx     #$01
f26de6
+    stx     SCRY
f26de6
+    dex
f26de6
+    stx     SCRX
f26de6
+
f26de6
+    stx     CHARCOLOR_CHANGE
f26de6
+    stx     BGCOLOR_CHANGE
f26de6
 
f26de6
     lda     #$07
f26de6
     sta     CHARCOLOR
f26de6
diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s
f26de6
index 96763caf..d313d778 100644
f26de6
--- a/libsrc/telestrat/cputc.s
f26de6
+++ b/libsrc/telestrat/cputc.s
f26de6
@@ -15,7 +15,7 @@
f26de6
     dec     SCRX
f26de6
     pha
f26de6
     lda     CHARCOLOR
f26de6
-    BRK_TELEMON  $4E             ; Change color on the screen (foreground)
f26de6
+    BRK_TELEMON  XFWR             ; Change color on the screen (foreground)
f26de6
     lda     #$00
f26de6
     sta     CHARCOLOR_CHANGE
f26de6
     inc     SCRX
f26de6
diff --git a/libsrc/telestrat/gotoxy.s b/libsrc/telestrat/gotoxy.s
f26de6
index 8dcb69e8..7a53a77a 100644
f26de6
--- a/libsrc/telestrat/gotoxy.s
f26de6
+++ b/libsrc/telestrat/gotoxy.s
f26de6
@@ -23,14 +23,17 @@ gotoxy: jsr     popa            ; Get Y
f26de6
         
f26de6
         jsr     update_adscr          ; Update adress video ram position when SCRY et SCRX are modified
f26de6
         ;       Force to put again attribute when it moves on the screen
f26de6
-        lda     #$01
f26de6
-        sta     CHARCOLOR_CHANGE
f26de6
-        sta     BGCOLOR_CHANGE
f26de6
+
f26de6
         rts
f26de6
 .endproc
f26de6
 
f26de6
 
f26de6
 .proc update_adscr
f26de6
+
f26de6
+        lda     #$01
f26de6
+        sta     CHARCOLOR_CHANGE
f26de6
+        sta     BGCOLOR_CHANGE
f26de6
+
f26de6
         lda     #
f26de6
         sta     ADSCRL
f26de6
 
f26de6
diff --git a/libsrc/telestrat/gotoy.s b/libsrc/telestrat/gotoy.s
f26de6
index ae6a0bcf..13be8e42 100644
f26de6
--- a/libsrc/telestrat/gotoy.s
f26de6
+++ b/libsrc/telestrat/gotoy.s
f26de6
@@ -2,7 +2,6 @@
f26de6
 ; jede jede@oric.org 2017-02-25
f26de6
 ;
f26de6
     .export    _gotoy
f26de6
-    .import    CHARCOLOR_CHANGE, BGCOLOR_CHANGE
f26de6
 
f26de6
     .import    update_adscr
f26de6
 
f26de6
@@ -14,8 +13,5 @@
f26de6
 
f26de6
    ; We change the current line, it means that we need to put color attributes again.
f26de6
    ; That is not the case with _gotox because, it's on the same line attribute are already set
f26de6
-   lda     #$01             
f26de6
-   sta     CHARCOLOR_CHANGE
f26de6
-   sta     BGCOLOR_CHANGE
f26de6
    rts
f26de6
 .endproc
f26de6
diff --git a/libsrc/telestrat/textcolor.s b/libsrc/telestrat/textcolor.s
f26de6
index b5584902..ee6ba729 100644
f26de6
--- a/libsrc/telestrat/textcolor.s
f26de6
+++ b/libsrc/telestrat/textcolor.s
f26de6
@@ -9,11 +9,11 @@
f26de6
 .proc _textcolor
f26de6
     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
f26de6
     bne     out             ; yes
f26de6
-    
f26de6
+
f26de6
     ldy     #$00
f26de6
     sty     CHARCOLOR_CHANGE
f26de6
     
f26de6
-    lda     CHARCOLOR       ; Return last color
f26de6
+    ; Return last color
f26de6
 
f26de6
     rts
f26de6
 out:
f26de6
-- 
f26de6
2.21.0
f26de6