From: cpg Date: Fri, 6 Dec 2002 00:32:20 +0000 (+0000) Subject: adapted to fastcall calling convention X-Git-Tag: V2.12.0~1933 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c56b5218d2e3aa7a1222323fcc034ddb60e4cdec;p=cc65 adapted to fastcall calling convention git-svn-id: svn://svn.cc65.org/cc65/trunk@1723 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atari/rwcommon.s b/libsrc/atari/rwcommon.s index afdbb443b..6dd7f14fc 100644 --- a/libsrc/atari/rwcommon.s +++ b/libsrc/atari/rwcommon.s @@ -1,53 +1,53 @@ -; +; ; common iocb setup routine for read, write -; expects parameters (int fd,void *buf,int count) +; expects __fastcall__ parameters (int fd, void *buf, int count) ; - .include "atari.inc" - .include "errno.inc" - .importzp tmp2,tmp3 - .import incsp6,ldax0sp,ldaxysp + .include "atari.inc" + .include "errno.inc" + .importzp tmp2,tmp3 + .import incsp4,ldax0sp,ldaxysp .import __errno,__oserror .import fdtoiocb - .export __rwsetup + .export __rwsetup __rwsetup: - ldy #5 - jsr ldaxysp ; get fd + sta tmp2 + stx tmp3 ; remember size + ldy #3 + jsr ldaxysp ; get fd jsr fdtoiocb ; convert to iocb bmi iocberr - sta tmp3 ; save it - jsr ldax0sp ; get size - stx tmp2 - ldx tmp3 ; iocb + tax cpx #$80 ; iocb must be 0...7 bcs iocberr - sta ICBLL,x - lda tmp2 ; size hi - sta ICBLH,x - ldy #3 ; get buf addr (was 2 in orig. version) - jsr ldaxysp - stx tmp2 - ldx tmp3 - sta ICBAL,x - lda tmp2 - sta ICBAH,x - jsr incsp6 ; pop args + 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 + sta ICBAH,x + jsr incsp4 ; pop args lda ICBLL,x ora ICBLH,x ; return with Z if length was 0 - rts + rts -iocberr:jsr incsp6 ; pop args +iocberr:jsr incsp4 ; pop args ldx #$FF ; indicate error + clear ZF rts ; ; this routine updates errno. do a JMP here right after calling -; CIOV. we expect status in Y. +; CIOV. we expect status in Y. ; - .export __do_oserror,__seterrno,__inviocb + .export __do_oserror,__seterrno,__inviocb __do_oserror: sty __oserror ; save os dependent error code retminus: @@ -56,9 +56,9 @@ retminus: rts __seterrno: - sta __errno - stx __errno+1 - rts + sta __errno + stx __errno+1 + rts ; ; sets EINVAL error code and returns -1