clriocb and findfreeiocb moved from open.s to fdtable.s (they are now also

used by graphics.s)


git-svn-id: svn://svn.cc65.org/cc65/trunk@1008 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg
2001-10-03 16:09:14 +00:00
parent 5f36ad2d53
commit 8d6f5a2fca
2 changed files with 50 additions and 47 deletions

View File

@@ -10,7 +10,9 @@ UCASE_FILENAME = 1 ; comment it out if filename shouldn't be uppercased
.include "../common/fmode.inc"
.include "../common/errno.inc"
.export _open
.import clriocb
.import fddecusage,newfd
.import findfreeiocb
.import __do_oserror,__seterrno,incsp4
.import ldaxysp,addysp,subysp
.import _strupr,__oserror
@@ -165,46 +167,3 @@ ok: lda tmp2 ; get fd
rts
.endproc
; find a free iocb
; no entry parameters
; return ZF = 0/1 for not found/found
; index in X if found
; all registers destroyed
.proc findfreeiocb
ldx #0
ldy #$FF
loop: tya
cmp ICHID,x
beq found
txa
clc
adc #$10
tax
cmp #$80
bcc loop
inx ; return ZF cleared
found: rts
.endproc
; clear iocb except for ICHID field
; expects X to be index to IOCB (0,$10,$20,etc.)
; all registers destroyed
.proc clriocb
inx ; don't clear ICHID
ldy #15
lda #0
loop: sta ICHID,x
inx
dey
bne loop
rts
.endproc