]> git.sur5r.net Git - cc65/commitdiff
clriocb and findfreeiocb moved from open.s to fdtable.s (they are now also
authorcpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 3 Oct 2001 16:09:14 +0000 (16:09 +0000)
committercpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 3 Oct 2001 16:09:14 +0000 (16:09 +0000)
used by graphics.s)

git-svn-id: svn://svn.cc65.org/cc65/trunk@1008 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/atari/fdtable.s
libsrc/atari/open.s

index 700cabed9b54debc5d3ebe4c4866289afdfa5b4f..5a8063c38f6a685d10fa0867b7913dd8fdaadf7d 100644 (file)
@@ -9,8 +9,10 @@
        .importzp tmp1,tmp2,tmp3,ptr4,sp
        .import fd_table,fd_index
        .import fdt_to_fdi
+       .export clriocb
        .export fdtoiocb
        .export fdtoiocb_down
+       .export findfreeiocb
        .export fddecusage
        .export newfd
 
@@ -61,12 +63,30 @@ ok_notlast:
        lda     #1                      ; clears Z
        jmp     retiocb
 
-.endproc
+.endproc       ; fdtoiocb_down
 
 inval: ldx     #$ff                    ; sets N
        rts
 
 
+; 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
+
+
 ; gets fd in ax
 ; return iocb index in X
 ; return N bit set for invalid fd
@@ -90,7 +110,31 @@ inval:      ldx     #$ff                    ; sets N
        lda     fd_table+ft_iocb,x      ; get iocb
        rts
 
-.endproc
+.endproc       ; fdtoiocb
+
+; 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       ; findfreeiocb
 
 ; decrements usage counter for fd
 ; if 0 reached, it's marked as unused
@@ -123,7 +167,7 @@ inval:      ldx     #$ff                    ; sets N
        sta     fd_table+ft_iocb,x      ; clear table entry
 ret:   rts
 
-.endproc
+.endproc       ; fddecusage
 
 ; newfd
 ;
@@ -334,5 +378,5 @@ finish:     lda     ptr4
        pla
        rts
 
-.endproc
+.endproc       ; newfd
 
index 7904586f2b79b48e563d50231acb5895e3956813..48568b083dfb72924c113e79769b58481e485385 100644 (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