mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 06:31:31 +00:00
Merge pull request #16 from groessler/something_to_pull
move findfreeiocb function into its own object file
This commit is contained in:
commit
a8d66d0ef4
@ -11,7 +11,6 @@
|
|||||||
.import fdt_to_fdi
|
.import fdt_to_fdi
|
||||||
.export clriocb
|
.export clriocb
|
||||||
.export fdtoiocb_down
|
.export fdtoiocb_down
|
||||||
.export findfreeiocb
|
|
||||||
.export fddecusage
|
.export fddecusage
|
||||||
.export newfd
|
.export newfd
|
||||||
|
|
||||||
@ -87,31 +86,6 @@ loop: sta ICHID,x
|
|||||||
.endproc
|
.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 ; findfreeiocb
|
|
||||||
|
|
||||||
|
|
||||||
; decrements usage counter for fd
|
; decrements usage counter for fd
|
||||||
; if 0 reached, it's marked as unused
|
; if 0 reached, it's marked as unused
|
||||||
; get fd index in tmp2
|
; get fd index in tmp2
|
||||||
|
23
libsrc/atari/findfreeiocb.inc
Normal file
23
libsrc/atari/findfreeiocb.inc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
; 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
|
7
libsrc/atari/findfreeiocb.s
Normal file
7
libsrc/atari/findfreeiocb.s
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
;
|
||||||
|
; Christian Groessler, June-2013
|
||||||
|
;
|
||||||
|
|
||||||
|
.include "atari.inc"
|
||||||
|
.export findfreeiocb
|
||||||
|
.include "findfreeiocb.inc"
|
Loading…
Reference in New Issue
Block a user