2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Christian Groessler, May-2000
|
|
|
|
;
|
2002-12-06 00:26:09 +00:00
|
|
|
; int __fastcall__ close(int fd);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
.export _close
|
2022-08-28 19:52:53 +00:00
|
|
|
.import __do_oserror,popax,___oserror
|
2013-05-09 11:56:54 +00:00
|
|
|
.import fdtoiocb_down,__inviocb
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _close
|
|
|
|
jsr fdtoiocb_down ; get iocb index into X and decr. usage count
|
|
|
|
bmi inverr
|
|
|
|
bne ok ; not last one -> don't close yet
|
|
|
|
lda #CLOSE
|
|
|
|
sta ICCOM,x
|
|
|
|
jsr CIOV
|
|
|
|
bmi closerr
|
|
|
|
ok: ldx #0
|
2022-08-28 20:37:33 +00:00
|
|
|
stx ___oserror ; clear system specific error code
|
2013-05-09 11:56:54 +00:00
|
|
|
txa
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
inverr: jmp __inviocb
|
|
|
|
closerr:jmp __do_oserror
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|