From c40ae4d774ef2a1e325e51524170a35eaad266c0 Mon Sep 17 00:00:00 2001 From: IrgendwerA8 Date: Mon, 21 May 2018 16:21:45 +0200 Subject: [PATCH] Saved 6 bytes by using popptr1. --- libsrc/cbm/read.s | 10 +++++----- libsrc/cbm/rwcommon.s | 17 +++++++---------- libsrc/cbm/write.s | 10 +++++----- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/libsrc/cbm/read.s b/libsrc/cbm/read.s index 87a2c7037..9de4980ce 100644 --- a/libsrc/cbm/read.s +++ b/libsrc/cbm/read.s @@ -88,10 +88,10 @@ 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 @@ -107,9 +107,9 @@ ; Decrement the count -@L3: inc ptr1 +@L3: inc ptr2 bne @L0 - inc ptr1+1 + inc ptr2+1 bne @L0 beq done ; Branch always diff --git a/libsrc/cbm/rwcommon.s b/libsrc/cbm/rwcommon.s index c044b6c38..0168a78d0 100644 --- a/libsrc/cbm/rwcommon.s +++ b/libsrc/cbm/rwcommon.s @@ -6,7 +6,7 @@ .export rwcommon - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3, tmp2 .include "errno.inc" @@ -22,18 +22,15 @@ .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 diff --git a/libsrc/cbm/write.s b/libsrc/cbm/write.s index 20999d2ac..dddec0792 100644 --- a/libsrc/cbm/write.s +++ b/libsrc/cbm/write.s @@ -61,10 +61,10 @@ ; 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 -- 2.39.2