X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libsrc%2Fatari%2Frwcommon.s;h=5f51cc5f7f8fa962599845a2916c0bb06295c4ed;hb=a03b3574b65a6167ac1207e66b83888eb0ca8465;hp=e489634544c648c158b155701e02494e526797ed;hpb=9b058add4ae81a4bd518ad86205c9ce3dbf2ddde;p=cc65 diff --git a/libsrc/atari/rwcommon.s b/libsrc/atari/rwcommon.s index e48963454..5f51cc5f7 100644 --- a/libsrc/atari/rwcommon.s +++ b/libsrc/atari/rwcommon.s @@ -2,63 +2,42 @@ ; common iocb setup routine for read, write ; expects __fastcall__ parameters (int fd, void *buf, int count) ; - .include "atari.inc" - .include "errno.inc" - .import popax - .import __oserror - .import fdtoiocb + .include "atari.inc" + .include "errno.inc" + .import popax + .import fdtoiocb - .export __rwsetup + .export __rwsetup __rwsetup: - 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 ; negative (X=$FF or A>$7F) on error. - tax - pla ; store address - sta ICBAH,x - pla - sta ICBAL,x - pla ; store length - sta ICBLH,x - pla - sta ICBLL,x - ora ICBLH,x ; returns Z if length is 0 - rts + 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 ; negative (X=$FF or A>$7F) on error. + tax + pla ; store address + sta ICBAH,x + 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:pla - pla - pla - pla - ldx #$FF ; indicate error + clear ZF - rts + 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. -; - .export __do_oserror,__inviocb -__do_oserror: - sty __oserror ; save os dependent error code -retminus: - lda #$FF - tax ; return -1 - rts - -; -; sets EINVAL error code and returns -1 -; - -__inviocb: - lda #