1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-05 08:05:51 +00:00
cc65/libsrc/atari/close.s

37 lines
522 B
ArmAsm
Raw Normal View History

;
; Christian Groessler, May-2000
;
; int close(int fd);
;
.include "atari.inc"
.export _close
.import __do_oserror,popax,__oserror
.import fdtoiocb_down,__inviocb
.proc _close
jsr popax
jsr fdtoiocb_down ; get iocb index into X and decr. usage count
bmi inverr
bne ok ; not last one -> don't close yet
; asl a
; asl a
; asl a
; asl a
; tax
lda #CLOSE
sta ICCOM,x
jsr CIOV
bpl ok
jmp __do_oserror
ok: ldx #0
stx __oserror ; clear system specific error code
txa
rts
inverr: jmp __inviocb
.endproc