1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00
cc65/libsrc/atari/rwcommon.s
cpg 7fb08aa749 move __do_oserror and __inviocb into their own source files
git-svn-id: svn://svn.cc65.org/cc65/trunk@4487 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-25 17:35:21 +00:00

44 lines
650 B
ArmAsm

;
; 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 fdtoiocb
.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
iocberr:pla
pla
pla
pla
ldx #$FF ; indicate error + clear ZF
rts