]> git.sur5r.net Git - cc65/commitdiff
space improvements by Daniel Serpell
authorcpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 25 Nov 2009 17:03:18 +0000 (17:03 +0000)
committercpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 25 Nov 2009 17:03:18 +0000 (17:03 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4484 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/atari/rwcommon.s

index 6775d99504c0dce8b2854c8731b212aa69685688..d1952f07409a0b38b34d28aca4e7435a557087af 100644 (file)
@@ -5,44 +5,44 @@
        .include "atari.inc"
        .include "errno.inc"
        .importzp tmp2,tmp3
-       .import incsp4,ldax0sp,ldaxysp
+       .import popax
        .import __errno,__oserror
        .import fdtoiocb
 
        .export __rwsetup
 
+
 __rwsetup:
 
-       sta     tmp2
-       stx     tmp3            ; remember size
-       ldy     #3
-       jsr     ldaxysp         ; get fd
+       pha                     ; push size in stack
+       txa
+       pha
+       jsr     popax           ; get buffer address
+       pha
+       txa
+       pha
+       jsr     popax           ; get handle
        jsr     fdtoiocb        ; convert to iocb
-       bmi     iocberr
+       bmi     iocberr         ; negative (X=$FF or A>$7F) on error.
        tax
-       cpx     #$80            ; iocb must be 0...7
-       bcs     iocberr
-       lda     tmp2
-       sta     ICBLL,x
-       lda     tmp3            ; size hi
-       sta     ICBLH,x
-       stx     tmp3
-       jsr     ldax0sp         ; get buf addr
-       stx     tmp2
-       ldx     tmp3
-       sta     ICBAL,x
-       lda     tmp2
+       pla                     ; store address
        sta     ICBAH,x
-       jsr     incsp4          ; pop args
-       lda     ICBLL,x
-       ora     ICBLH,x         ; return with Z if length was 0
+       pla
+       sta     ICBAL,x
+       pla                     ; store length
+       sta     ICBLH,x
+       pla
+       sta     ICBLL,x
+       ora     ICBLH,x         ; returns Z if length is 0
        rts
 
-iocberr:jsr    incsp4          ; pop args
+iocberr:pla
+       pla
+       pla
+       pla
        ldx     #$FF            ; indicate error + clear ZF
        rts
 
-
 ;
 ; this routine updates errno.  do a JMP here right after calling
 ; CIOV.         we expect status in Y.