;
-; Christian Groessler, May-2002
+; Christian Groessler, Jan-2003
;
; int open(const char *name,int flags,...);
;
.include "atari.inc"
.include "fcntl.inc"
.include "errno.inc"
+ .include "fd.inc"
+
.export _open
+ .destructor closeallfiles, 17
+
+ .import _close
.import clriocb
.import fddecusage,newfd
.import findfreeiocb
jsr clriocb ; init with zero
ldy #1
jsr ldaxysp ; get mode
- ;brk
ldx tmp4
pha
and #O_APPEND
rts
.endproc
+
+
+; closeallfiles: Close all files opened by the program.
+
+.proc closeallfiles
+
+ lda #MAX_FD_INDEX-1
+loop: ldx #0
+ pha
+ jsr _close
+ pla
+ clc
+ sbc #0
+ bpl loop
+ rts
+
+.endproc