2000-05-28 13:40:48 +00:00
|
|
|
;
|
2002-12-06 00:24:35 +00:00
|
|
|
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
2022-08-28 19:52:53 +00:00
|
|
|
.import __rwsetup,__do_oserror,__inviocb,___oserror
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _write
|
2000-05-28 13:40:48 +00:00
|
|
|
_write:
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr __rwsetup ; do common setup
|
|
|
|
beq write9 ; if size 0, it's a no-op
|
|
|
|
cpx #$FF ; invalid iocb?
|
|
|
|
beq _inviocb
|
|
|
|
lda #PUTCHR
|
|
|
|
sta ICCOM,x
|
|
|
|
jsr CIOV
|
|
|
|
bpl write9
|
|
|
|
jmp __do_oserror ; update errno
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
write9:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ICBLL,x ; get buf len low
|
|
|
|
pha
|
|
|
|
lda ICBLH,x ; buf len high
|
|
|
|
tax
|
|
|
|
lda #0
|
2022-08-28 20:37:33 +00:00
|
|
|
sta ___oserror ; clear system dependend error code
|
2013-05-09 11:56:54 +00:00
|
|
|
pla
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_inviocb:
|
2013-05-09 11:56:54 +00:00
|
|
|
jmp __inviocb
|