Finally: Commodore file I/O
git-svn-id: svn://svn.cc65.org/cc65/trunk@1531 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
37
libsrc/cbm/filedes.s
Normal file
37
libsrc/cbm/filedes.s
Normal file
@@ -0,0 +1,37 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 16.11.2002
|
||||
;
|
||||
; File descriptor management for the POSIX I/O routines
|
||||
;
|
||||
|
||||
|
||||
.include "filedes.inc"
|
||||
|
||||
.code
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; freefd: Find a free file handle and return it in X. Return carry clear if we
|
||||
; found one, return a carry if no free lfns are left.
|
||||
|
||||
.proc freefd
|
||||
|
||||
ldx #0
|
||||
clc
|
||||
loop: lda fdtab,x
|
||||
beq found
|
||||
inx
|
||||
cpx #MAX_FDS
|
||||
bcc loop
|
||||
found: rts
|
||||
|
||||
.endproc
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Data
|
||||
|
||||
.bss
|
||||
fdtab: .res MAX_FDS
|
||||
unittab:.res MAX_FDS
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user