]> git.sur5r.net Git - cc65/commitdiff
Saved 6 bytes by using popptr1.
authorIrgendwerA8 <c.krueger.b@web.de>
Mon, 21 May 2018 14:21:45 +0000 (16:21 +0200)
committerIrgendwerA8 <c.krueger.b@web.de>
Mon, 21 May 2018 14:21:45 +0000 (16:21 +0200)
libsrc/cbm/read.s
libsrc/cbm/rwcommon.s
libsrc/cbm/write.s

index 87a2c703785baf108f57460c825c31358aefb83c..9de4980ced86fd78c4b49699028676abb942be32 100644 (file)
 
         ldy     #0
         lda     tmp1
-        sta     (ptr2),y
-        inc     ptr2
+        sta     (ptr1),y
+        inc     ptr1
         bne     @L1
-        inc     ptr2+1          ; *buf++ = A;
+        inc     ptr1+1          ; *buf++ = A;
 
 ; Increment the byte count
 
 
 ; Decrement the count
 
-@L3:    inc     ptr1
+@L3:    inc     ptr2
         bne     @L0
-        inc     ptr1+1
+        inc     ptr2+1
         bne     @L0
         beq     done            ; Branch always
 
index c044b6c38e3b4a96103c1fd5c0c92687acbe0d67..0168a78d03bb4ce049700a65c047a7347d981b76 100644 (file)
@@ -6,7 +6,7 @@
 
         .export         rwcommon
 
-        .import         popax
+        .import         popax, popptr1
         .importzp       ptr1, ptr2, ptr3, tmp2
 
         .include        "errno.inc"
 .proc   rwcommon
 
         eor     #$FF
-        sta     ptr1
+        sta     ptr2
         txa
         eor     #$FF
-        sta     ptr1+1          ; Remember -count-1
-
-        jsr     popax           ; Get buf
-        sta     ptr2
-        stx     ptr2+1
+        sta     ptr2+1          ; Remember -count-1
 
-        lda     #$00
-        sta     ptr3
-        sta     ptr3+1          ; Clear ptr3
+        jsr     popptr1         ; Get buf
+                                ; Y=0 by popptr1
+        sty     ptr3
+        sty     ptr3+1          ; Clear ptr3
 
         jsr     popax           ; Get the handle
         cpx     #$01
index 20999d2aceba98adca7a6fc21b9134971f4beb88..dddec07920ce0e9608b4ade4d7b60c30aa817f7f 100644 (file)
 ; Output the next character from the buffer
 
 @L0:    ldy     #0
-        lda     (ptr2),y
-        inc     ptr2
+        lda     (ptr1),y
+        inc     ptr1
         bne     @L1
-        inc     ptr2+1          ; A = *buf++;
+        inc     ptr1+1          ; A = *buf++;
 @L1:    jsr     BSOUT
 
 ; Check the status
@@ -84,9 +84,9 @@
 
 ; Decrement count
 
-@L2:    inc     ptr1
+@L2:    inc     ptr2
         bne     @L0
-        inc     ptr1+1
+        inc     ptr2+1
         bne     @L0
 
 ; Wrote all chars or disk full. Close the output channel