1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 15:05:14 +00:00
cc65/libsrc/atari/close.s
cuz 9e74c2b26f Make close() fastcall
git-svn-id: svn://svn.cc65.org/cc65/trunk@1530 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-16 19:38:37 +00:00

35 lines
522 B
ArmAsm

;
; 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 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
bmi closerr
ok: ldx #0
stx __oserror ; clear system specific error code
txa
rts
inverr: jmp __inviocb
closerr:jmp __do_oserror
.endproc