2004-05-13 21:56:31 +00:00
|
|
|
;
|
2000-05-28 13:40:48 +00:00
|
|
|
; common iocb setup routine for read, write
|
2002-12-06 00:32:20 +00:00
|
|
|
; expects __fastcall__ parameters (int fd, void *buf, int count)
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
.include "errno.inc"
|
|
|
|
.import popax
|
|
|
|
.import fdtoiocb
|
2002-04-21 14:19:16 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export __rwsetup
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-11-25 17:03:18 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
__rwsetup:
|
2002-04-21 14:19:16 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
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
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-11-25 17:03:18 +00:00
|
|
|
iocberr:pla
|
2013-05-09 11:56:54 +00:00
|
|
|
pla
|
|
|
|
pla
|
|
|
|
pla
|
|
|
|
ldx #$FF ; indicate error + clear ZF
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|