This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
39
libsrc/common/_fdesc.s
Normal file
39
libsrc/common/_fdesc.s
Normal file
@@ -0,0 +1,39 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 17.06.1998
|
||||
;
|
||||
; int _fdesc (void);
|
||||
; /* Find a free descriptor slot */
|
||||
|
||||
|
||||
.export __fdesc
|
||||
.import return0, __filetab
|
||||
.importzp tmp1
|
||||
|
||||
__fdesc:
|
||||
ldy #0
|
||||
L1: lda __filetab+1,y ; load flags
|
||||
beq L2 ; jump if empty (== CLOSED)
|
||||
iny
|
||||
iny
|
||||
cpy #16 ; Done?
|
||||
bne L1
|
||||
|
||||
; File table is full
|
||||
|
||||
jmp return0
|
||||
|
||||
; Free slot found
|
||||
|
||||
L2: sty tmp1 ; Offset
|
||||
lda #<__filetab
|
||||
ldx #>__filetab
|
||||
clc
|
||||
adc tmp1
|
||||
tay
|
||||
txa
|
||||
adc #0
|
||||
tax
|
||||
tya
|
||||
rts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user