mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 21:29:03 +00:00
adapted to fastcall calling convention
git-svn-id: svn://svn.cc65.org/cc65/trunk@1723 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
4314ed5185
commit
c56b5218d2
@ -1,53 +1,53 @@
|
|||||||
;
|
;
|
||||||
; common iocb setup routine for read, write
|
; 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 "atari.inc"
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.importzp tmp2,tmp3
|
.importzp tmp2,tmp3
|
||||||
.import incsp6,ldax0sp,ldaxysp
|
.import incsp4,ldax0sp,ldaxysp
|
||||||
.import __errno,__oserror
|
.import __errno,__oserror
|
||||||
.import fdtoiocb
|
.import fdtoiocb
|
||||||
|
|
||||||
.export __rwsetup
|
.export __rwsetup
|
||||||
|
|
||||||
__rwsetup:
|
__rwsetup:
|
||||||
|
|
||||||
ldy #5
|
sta tmp2
|
||||||
jsr ldaxysp ; get fd
|
stx tmp3 ; remember size
|
||||||
|
ldy #3
|
||||||
|
jsr ldaxysp ; get fd
|
||||||
jsr fdtoiocb ; convert to iocb
|
jsr fdtoiocb ; convert to iocb
|
||||||
bmi iocberr
|
bmi iocberr
|
||||||
sta tmp3 ; save it
|
tax
|
||||||
jsr ldax0sp ; get size
|
|
||||||
stx tmp2
|
|
||||||
ldx tmp3 ; iocb
|
|
||||||
cpx #$80 ; iocb must be 0...7
|
cpx #$80 ; iocb must be 0...7
|
||||||
bcs iocberr
|
bcs iocberr
|
||||||
sta ICBLL,x
|
lda tmp2
|
||||||
lda tmp2 ; size hi
|
sta ICBLL,x
|
||||||
sta ICBLH,x
|
lda tmp3 ; size hi
|
||||||
ldy #3 ; get buf addr (was 2 in orig. version)
|
sta ICBLH,x
|
||||||
jsr ldaxysp
|
stx tmp3
|
||||||
stx tmp2
|
jsr ldax0sp ; get buf addr
|
||||||
ldx tmp3
|
stx tmp2
|
||||||
sta ICBAL,x
|
ldx tmp3
|
||||||
lda tmp2
|
sta ICBAL,x
|
||||||
sta ICBAH,x
|
lda tmp2
|
||||||
jsr incsp6 ; pop args
|
sta ICBAH,x
|
||||||
|
jsr incsp4 ; pop args
|
||||||
lda ICBLL,x
|
lda ICBLL,x
|
||||||
ora ICBLH,x ; return with Z if length was 0
|
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
|
ldx #$FF ; indicate error + clear ZF
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; this routine updates errno. do a JMP here right after calling
|
; 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:
|
__do_oserror:
|
||||||
sty __oserror ; save os dependent error code
|
sty __oserror ; save os dependent error code
|
||||||
retminus:
|
retminus:
|
||||||
@ -56,9 +56,9 @@ retminus:
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
__seterrno:
|
__seterrno:
|
||||||
sta __errno
|
sta __errno
|
||||||
stx __errno+1
|
stx __errno+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;
|
;
|
||||||
; sets EINVAL error code and returns -1
|
; sets EINVAL error code and returns -1
|
||||||
|
Loading…
Reference in New Issue
Block a user