* Disassembly by Os9disasm of modos9p2
mod L04f4,L000d,$c1,$81,L0041,D0000
* OS-9 system function equates
F$Link equ $00
F$UnLink equ $02
F$Chain equ $05
F$SchBit equ $12
F$AllBit equ $13
F$DelBit equ $14
F$SRqMem equ $28
F$SRtMem equ $29
F$AProc equ $2c
F$NProc equ $2d
F$VModul equ $2e
F$Find64 equ $2f
F$All64 equ $30
F$Ret64 equ $31
F$IODel equ $33
I$Dup equ $82
I$Open equ $84
I$ChgDir equ $86
I$Close equ $8f
* class D external label equates
D0001 equ $0001
D0002 equ $0002
D0003 equ $0003
D0004 equ $0004
D0006 equ $0006
D0007 equ $0007
D0009 equ $0009
D000b equ $000b
D000c equ $000c
D000d equ $000d
D000e equ $000e
D0020 equ $0020
D0022 equ $0022
D0024 equ $0024
D0026 equ $0026
D0028 equ $0028
D002a equ $002a
D0036 equ $0036
D0049 equ $0049
D004b equ $004b
D004f equ $004f
D0050 equ $0050
D0053 equ $0053
D0055 equ $0055
D0056 equ $0056
D0057 equ $0057
D0066 equ $0066
D0068 equ $0068
D0099 equ $0099
Dfffe equ $fffe
* OS9 data area definitions
D0000 equ .
L000d clra
comb
rts
neg -19960
clr $0481
fcb $02
neg D0099
lsr D0000
stu D0006
fcb $01
bpl L0027
fcb $01
bita 8,x
fcb $02
fcb $18
rol D0003
L0027 blt L0033
fcb $02
jsr D000c
com D0050
tst D0003
leas 14,x
com D0056
L0033 equ *-1
lbra L03a5
stx 3,x
fcb $87
suba $03a7
cmpa $0425
suba #$31
L0041 equ *-1
bsr L0043
L0043 equ *-1
ldu #4159
fcb $32
ldx D0049
os9 F$All64
bcs L0081
stx D0049
sty D004b
tfr s,d
deca
ldb #1
std D0007,y
lda #$80
sta D000d,y
ldu D002a
bsr L0085
bcc L006a
lbsr L04b9
bsr L0085
L006a bsr L0093
bcc L0073
lbsr L04b9
bsr L0093
L0073 ldd 14,u
leax d,u
lda #1
clrb
ldy #0
os9 F$Chain
L0081 jmp [-2]
L0085 clrb
ldd 16,u
beq L0092
leax d,u
lda #5
os9 I$ChgDir
L0092 rts
L0093 clrb
ldd 18,u
leax d,u
lda #3
os9 I$Open
bcs L00b1
ldx D004b
sta 38,x
os9 I$Dup
sta 39,x
os9 I$Dup
sta 40,x
L00b1 rts
ldd 8,u
beq L00f9
ldx D0026
L00b8 cmpd ,x
beq L00c5
leax 4,x
cmpx D0028
bcs L00b8
bra L00f9
L00c5 lda 2,x
beq L00ce
deca
sta 2,x
bne L00f9
L00ce ldy ,x
cmpy D0066
bcc L00f9
ldb D0006,y
cmpb #$d0
bcs L00e5
os9 F$IODel
bcc L00e5
inc 2,x
bra L00fa
L00e5 clra
clrb
std ,x
std ,y
ldd D0002,y
lbsr L0236
exg d,y
exg a,b
ldx D0020
os9 F$DelBit
L00f9 clra
L00fa rts
ldy D004b
ldx D0049
lda D0003,y
bne L0108
comb
ldb #$e2
rts
L0108 os9 F$Find64
lda D000d,y
bita #1
bne L0124
lda D0002,y
bne L0108
clr 1,u
ldx D004b
orcc #$50
ldd D004f
std 14,x
stx D004f
lbra L033b
L0124 ldx D004b
L0126 lda ,y
ldb D0036,y
std 1,u
pshs a,x,y,u
leay 1,x
ldx D0049
bra L0138
L0135 os9 F$Find64
L0138 lda D0002,y
cmpa ,s
bne L0135
ldu 3,s
ldb 2,u
stb D0002,y
os9 F$Ret64
puls a,x,y,u,pc
ldx D004b
ldb 2,u
stb 54,x
ldb #$10
leay 38,x
L0155 lda ,y+
beq L0160
pshs b
os9 I$Close
puls b
L0160 decb
bne L0155
lda 7,x
tfr d,u
lda 8,x
os9 F$SRtMem
ldu 18,x
os9 F$UnLink
ldu D004b
leay 1,u
ldx D0049
bra L018c
L017a clr D0002,y
os9 F$Find64
lda D000d,y
bita #1
beq L018a
lda ,y
os9 F$Ret64
L018a clr D0001,y
L018c lda D0002,y
bne L017a
ldx #$0041
lda 1,u
bne L01a4
ldx D0049
lda ,u
os9 F$Ret64
bra L01c2
L01a0 cmpa ,x
beq L01b2
L01a4 leay ,x
ldx 14,x
bne L01a0
lda 13,u
ora #1
sta 13,u
bra L01c2
L01b2 ldd 14,x
std D000e,y
os9 F$AProc
leay ,u
ldu 4,x
ldu 1,u
lbsr L0126
L01c2 clra
clrb
std D004b
rts
ldx D004b
ldd 1,u
beq L0227
bsr L0236
subb 8,x
beq L0227
bcs L0207
tfr d,y
ldx 7,x
pshs x,y,u
ldb ,s
beq L01e1
addb 1,s
L01e1 ldx D0020
ldu D0022
os9 F$SchBit
bcs L0231
stb 2,s
ldb ,s
beq L01f6
addb 1,s
cmpb 2,s
bne L0231
L01f6 ldb 2,s
os9 F$AllBit
ldd 2,s
suba 1,s
addb 1,s
puls x,y,u
ldx D004b
bra L0225
L0207 negb
tfr d,y
negb
addb 8,x
addb 7,x
cmpb 4,x
bhi L0217
comb
ldb #$df
rts
L0217 ldx D0020
os9 F$DelBit
tfr y,d
negb
ldx D004b
addb 8,x
lda 7,x
L0225 std 7,x
L0227 lda 8,x
clrb
std 1,u
adda 7,x
std 6,u
rts
L0231 comb
ldb #$cf
puls x,y,u,pc
L0236 addd #$00ff
clrb
exg a,b
rts
lda 1,u
bne L024f
inca
L0242 ldx D004b
cmpa ,x
beq L024a
bsr L024f
L024a inca
bne L0242
clrb
rts
L024f ldx D0049
os9 F$Find64
bcc L0259
ldb #$e0
rts
L0259 orcc #$50
pshs a,y
ldb 2,u
bne L0267
lda D000d,y
ora #2
sta D000d,y
L0267 lda D0036,y
beq L0274
deca
beq L0274
comb
ldb #$e9
puls a,y,pc
L0274 stb D0036,y
ldx #$0043
bra L02a2
L027c cmpx 1,s
bne L02a2
lda 13,x
bita #$40
beq L02b5
ldu 4,x
ldd 4,u
beq L02b5
ldu 14,x
beq L02b5
pshs d
lda 13,u
bita #$40
puls d
beq L02b5
ldu 4,u
addd 4,u
std 4,u
bra L02b5
L02a2 leay ,x
ldx D000e,y
bne L027c
ldx #$0041
L02ab leay ,x
ldx D000e,y
beq L02c5
cmpx 1,s
bne L02ab
L02b5 ldd 14,x
std D000e,y
lda 54,x
deca
bne L02c2
sta 54,x
L02c2 os9 F$AProc
L02c5 clrb
puls a,y,pc
ldx D004b
orcc #$50
lda 54,x
beq L02dc
deca
bne L02d7
sta 54,x
L02d7 os9 F$AProc
bra L033b
L02dc ldd 4,u
beq L0328
subd #1
std 4,u
beq L02d7
pshs x,u
ldx #$0043
L02ec leay ,x
ldx 14,x
beq L0304
pshs d
lda 13,x
bita #$40
puls d
beq L0304
ldu 4,x
subd 4,u
bcc L02ec
addd 4,u
L0304 puls x,u
std 4,u
ldd D000e,y
stx D000e,y
std 14,x
lda 13,x
ora #$40
sta 13,x
ldx 14,x
beq L033b
lda 13,x
bita #$40
beq L033b
ldx 4,x
ldd 4,x
subd 4,u
std 4,x
bra L033b
L0328 lda 13,x
anda #$bf
sta 13,x
ldd #$0043
L0331 tfr d,y
ldd D000e,y
bne L0331
stx D000e,y
std 14,x
L033b leay <L034f,pcr
pshs y
ldy D004b
ldd D0004,y
ldx 4,u
pshs cc,d,dp,x,y,u
sts D0004,y
os9 F$NProc
L034f std D0004,y
stx 4,u
clrb
rts
ldx D004b
ldd 4,u
std 55,x
ldd 8,u
std 57,x
clrb
rts
lda 1,u
ldx D0049
os9 F$Find64
bcs L037a
ldx D004b
ldd 9,x
cmpd D0009,y
bne L037a
lda 2,u
sta D000b,y
rts
L037a comb
ldb #$e0
rts
ldx D004b
lda ,x
sta 1,u
ldd 9,x
std 6,u
clrb
rts
ldx D004b
leay 20,x
ldb 1,u
decb
cmpb #3
bcc L039c
lslb
ldx 4,u
stx b,y
rts
L039c comb
ldb #$e3
rts
L03a0 coma
inc 15,s
com d,s
L03a5 ldx 4,u
ldd ,x
std D0053
ldd 2,x
std D0055
ldd 4,x
std D0057
lda #$c1
leax <L03a0,pcr
os9 F$Link
bcs L03c0
jmp ,y
clrb
L03c0 rts
lda 1,u
ldx 4,u
bsr L03cd
bcs L03cc
sty 6,u
L03cc rts
L03cd pshs d
tsta
beq L03e1
clrb
lsra
rorb
lsra
rorb
lda a,x
tfr d,y
beq L03e1
tst ,y
bne L03e2
L03e1 coma
L03e2 puls d,pc
ldx 4,u
bne L03f0
bsr L03fa
bcs L03f9
stx ,x
stx 4,u
L03f0 bsr L0410
bcs L03f9
sta 1,u
sty 6,u
L03f9 rts
L03fa pshs u
ldd #$0100
os9 F$SRqMem
leax ,u
puls u
bcs L040f
clra
clrb
L040a sta d,x
incb
bne L040a
L040f rts
L0410 pshs x,u
clra
L0413 pshs a
clrb
lda a,x
beq L0425
tfr d,y
clra
L041d tst d,y
beq L0427
addb #$40
bcc L041d
L0425 orcc #1
L0427 leay d,y
puls a
bcc L0452
inca
cmpa #$40
bcs L0413
clra
L0433 tst a,x
beq L0441
inca
cmpa #$40
bcs L0433
ldb #$c8
coma
bra L045f
L0441 pshs a,x
bsr L03fa
bcs L0461
leay ,x
tfr x,d
tfr a,b
puls a,x
stb a,x
clrb
L0452 lslb
rola
lslb
rola
ldb #$3f
L0458 clr b,y
decb
bne L0458
sta ,y
L045f puls x,u,pc
L0461 leas 3,s
puls x,u,pc
lda 1,u
ldx 4,u
pshs d,x,y,u
clrb
lsra
rorb
lsra
rorb
pshs a
lda a,x
beq L048e
tfr d,y
clr ,y
clrb
tfr d,u
clra
L047e tst d,u
bne L048e
addb #$40
bne L047e
inca
os9 F$SRtMem
lda ,s
clr a,x
L048e clr ,s+
puls d,x,y,u,pc
L0492 rola
clra
tsta
fcb $41
ldu #13430
bsr L04af
bcc L04a5
bsr L04b9
bcs L04ad
bsr L04af
bcs L04ad
L04a5 jsr ,y
puls d,x,y,u
ldx Dfffe,y
jmp ,x
L04ad puls d,x,y,u,pc
L04af leax >L0492,pcr
lda #$c1
os9 F$Link
rts
L04b9 pshs u
comb
ldd 20,u
beq L04ef
leax d,u
lda #$c1
os9 F$Link
bcs L04ef
jsr ,y
bcs L04ef
stx D0024
stx D0066
leau d,x
stu D0068
L04d6 ldd ,x
cmpd #$87cd
bne L04e9
os9 F$VModul
bcs L04e9
ldd 2,x
leax d,x
bra L04eb
L04e9 leax 1,x
L04eb cmpx D0068
bcs L04d6
L04ef puls u,pc
emod
L04f4 equ *
end