From: cpg Date: Sun, 24 Mar 2002 23:44:16 +0000 (+0000) Subject: fix return Z flag: it was set if the LSB of the length was zero and X-Git-Tag: V2.12.0~2409 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f709fd679bc1f8c0937069f44c54884f0292efcb;p=cc65 fix return Z flag: it was set if the LSB of the length was zero and didn't care about the MSB git-svn-id: svn://svn.cc65.org/cc65/trunk@1207 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atari/rwcommon.s b/libsrc/atari/rwcommon.s index 8a888142d..7f77e15a7 100644 --- a/libsrc/atari/rwcommon.s +++ b/libsrc/atari/rwcommon.s @@ -5,7 +5,7 @@ .include "atari.inc" .include "../common/errno.inc" .importzp tmp2,tmp3 - .import incsp6,ldaxysp + .import incsp6,ldax0sp,ldaxysp .import __errno,__oserror .import fdtoiocb @@ -17,18 +17,12 @@ __rwsetup: jsr ldaxysp ; get fd jsr fdtoiocb ; convert to iocb bmi iocberr -; asl a ; iocb # --> iocb index -; asl a -; asl a -; asl a sta tmp3 ; save it - ldy #1 - jsr ldaxysp ; get size - php ; save cond codes, for zero-ness + jsr ldax0sp ; get size stx tmp2 ldx tmp3 ; iocb cpx #$80 ; iocb must be 0...7 - bcs iocberr + bcs iocberr sta ICBLL,x lda tmp2 ; size hi sta ICBLH,x @@ -40,11 +34,11 @@ __rwsetup: lda tmp2 sta ICBAH,x jsr incsp6 ; pop args - plp + lda ICBLL,x + ora ICBLH,x ; return with Z if length was 0 rts iocberr:jsr incsp6 ; pop args - plp ; throw away ldx #$FF ; indicate error + clear ZF rts