Source ROM1
-----------
.erames
call nomen
db 31,24,1,#ff
call setcff
db "E",#bf," ",#ff
ret
.alltag
call fprint
db "all t",#ab,"f",#b4,#ff
ret
.SErase
call clastf
call erames
call cshow
call getyn
pop hl
ret nz
call forone
call writedir
jp newfs
.MErase
call ctagged
call erames
call alltag
call getyn
ret nz
call fortagged
.newfs2
call writedir
jp dosort
.SMove
call clastf
call movmes
call cshow
ld e,#96
call getmuser
pop hl
ret z
call forone
jr newfs2
.MMove
call ctagged
call movmes
call alltag
call getmuser
ret z
call fortagged
jr newfs2
.movmes
call mestop
db "Move ",#ff
ret
.getmuser
call fprint
db #b8,"u",#a7,#ff
ld hl,#2901
ld ix,tuser
.entul
call entuser2
cp #f3
jr z,entul
cp #fc
ret z
ld a,b
or a
ret z
ld hl,tuser
call convuser
ld (destuser),a
ld de,movf
or d
ret
.movf
push hl
ld l,e
call faddr
ld a,(destuser)
ld (hl),a
.popret
pop hl
ret
.getatt
call fprint
db #b8,": ",#fe,"R",#b1," read/",#fe,"Write "
db #fe,"D",#be," ",#fe,"System",#ff
.getatl
call #bb18
call upper
ld de,attf
cp #fc
scf
ret z
ld hl,#8009
cp "R"
ret z
ld h,#0
cp "W"
ret z
inc l
cp "D"
ret z
ld h,#80
cp "S"
jr nz,getatl
ret
.getyn
call cprint
db " - ",#d2,#ff
.getyn2
call getukey
ld de,eraf
cp "Y"
jr z,bb5a
ld a,"N"
.bb5a
jp #bb5a
.Filespec
call nomen
db "U",#a7,#ff
ld hl,unumb
call cprint2
call cprint
db 31,25,1,"F",#b4,"pec",#c0,#ff
.entfile
ld hl,#2401
call enter
cp #f2
jr nz,notf2
ld hl,#1001
call entuser
cp #f3
ld a,b
ld (userl),a
jr z,entfile
.notf2
ld a,(userl)
or a
ld a,1
jr z,setall
dec a
.setall
ld (fspec+1),a
ld hl,unumb
call convuser
ld (fspec+2),a
call convmask
ld a,(fspec)
inc a
ret z
jp newfs
.convuser
ld bc,#300
.numlp
ld a,(hl)
cp " "
jr z,finc
ld a,c
add a
add a
add c
add a
add (hl)
sub 48
ld c,a
inc hl
djnz numlp
.finc
ld a,c
ret
.Rename
call clastf
call mestop
db "R",#bd,#ff
call cshow
ld e,#98
call fprint
db #b8,":",#ff
ld hl,tempf
ld b,12
.cltfl
ld (hl)," "
inc l
djnz cltfl
ld (hl),#ff
ld hl,#1f01
ld ix,tempf
call enter3
cp #fc
jr z,popret2
ld a,b
or a
.popret2
jp z,popret
ld hl,tempf2+1
ld de,tempf
call convmask2
pop hl
push hl
ld l,(hl)
call faddr
ld a,(hl)
ld (tempf2),a
call find1
pop hl
jr nz,dorenit
ld hl,tempf2
call exists
.anykey
call cprint
db " - P",#ba,#ff
jp #bb18
.dorenit
ld de,renf
call forone
jp newfs2
.exists
push hl
call mestop
db "File ",#ff
pop hl
db #dd:ld l,#ff
call pfile
call cprint
db 31,24,1,"exists",#ff
ret
.find1
ld de,tempf2
ld hl,#100
.find2
ld a,(dire)
inc a
ld b,a
.loopff
push bc
ld b,11
call compare2
jr nz,notfile
pop bc
ret
.contfind
push bc
.notfile
ld bc,32
add hl,bc
pop bc
djnz loopff
ret
.renf
push hl
ld l,e
call faddr
inc hl
ld b,11
ld de,tempf2+1
ex de,hl
.renlp
ld a,(de)
and #80
or (hl)
ld (de),a
inc l
inc de
djnz renlp
pop hl
ret
.SUntag
ld de,untagf
jr STag+3
.STag
ld de,tagf
call clastf
call coffset
push hl
call forone
pop hl
ld de,(curadr)
call showf
call showt
pop hl
call cursor3+3
jp godown
.tagf
bit 6,a
ret nz
push hl
or #40
ld (de),a
call getfze
add hl,bc
bit 0,a
jr z,setkt
inc de
.setkt
ld (ftagged),de
ld (ktagged),hl
pop hl
ret
.eraf
ld a,(doit)
or a
ret nz
push hl
ld l,e
call faddr
push hl
pop ix
bit 7,(ix+9) ;Is file read-only?
jr z,notro
ld a,(de)
and 1
jr z,notro
pop hl
push hl
push de
push ix
push hl
call nomen
db 31,20,1,"is r",#b1,". E",#bf,#ff
pop hl
ld de,#c781
call showf3
call getyn
pop hl
pop de
jr z,notro
ld a,1
ld (doit),a
pop hl
ret
.notro
ld (hl),#e5
pop hl
ld a,(de)
.untagf
bit 6,a
ret z
push hl
and #bf
ld (de),a
call getfze
or a
sbc hl,bc
bit 0,a
jr z,setkt
dec de
jr setkt
.getfze
push af
ld l,e
call faddr
push hl
pop ix
call getfsz
ld c,a
ld b,0
ld de,(ftagged)
ld hl,(ktagged)
pop af
ret
.forone
ld (fordo+1),de
.forsin
ld a,(hl)
call findsame
ld e,(hl) ;File offset
ld d,dalloch
xor a
ld (doit),a
ld a,(de)
call fordo ;E=entry #, D=dalloch
.foronel
inc hl
call checkhl2
ret c
ld e,(hl)
ld d,dalloch
ld a,(de)
bit 0,a
ret nz
call fordo
jr foronel
.forall
ld (fordo+1),de
ld hl,sorted
.foralp
call checkhl
ret c
push hl
call forsin
pop hl
inc hl
jr foralp
.fortagged
ld (fordo+1),de
ld hl,sorted
.foratlp
call checkhl
ret c
push hl
ld e,(hl)
ld d,dalloch
ld a,(de)
and #41
cp #41 ;Tagged and first entry
call z,forsin
pop hl
inc hl
jr foratlp
.Backup
ret
.Configure
call mestop
db "C",#cf,": ",#fe,"D",#ad,#ce," ",#fe,"F",#ae," ",#ce,#ff
.notsetf
call #bb18
call upper
cp #fc
ret z
cp "D"
jp z,confdrvs
cp "F"
jr nz,notsetf
call nomen2
ld de,#c374
ld bc,#1aff
call tline
call hline2
call mline
ld a,2
call mhline
call mline
ld a,2
call mhline
call mline
call hline2
call bline
ld de,#c645
call fprint
db "Ok",#ff
ld a,3
ld (currf),a
.dshfl
call showfen
.dcurslp2
call fdcurs
call #bb18
push af
call fdcurs
pop af
ld b,3
call updown
jr z,dcurslp2
ld c,2
or a
jr z,setelf
ld c,4
dec a
jr z,setelf
ld c,8
.setelf
ld hl,RAM_DPBC
ld a,(hl)
xor c
ld (hl),a
dec l:dec l
ld (hl),a
jr dshfl
.fdcurs
ld bc,#1a01
ld a,(currf)
or a
jr z,isy0
cp 3
jr nz,noty3
ld a,8
jr isy0
.noty3
ld c,a
add a
add c
dec a
ld c,2
.isy0
push bc
call times80
pop bc
ld de,#c3c5
add hl,de
jp cursdisp
.showfen
ld c,#ff
ld de,#c3c5
call fprint
db "ELECTRO F",#ae,"s",#ff
ld a,(RAM_DPBC)
ld h,a
and 2
call endis
ld de,#c465
call fprint
db #c2,"10",-5," ",#ff
bit 2,h
call iendis
ld e,#b5
call fprint
db #c5,"F",#ae,"s",-4," ",#ff
bit 2,h
call endis
ld de,#c555
call fprint
db #c2,"1",-6," ",#ff
bit 3,h
call iendis
ld e,#a5
call fprint
db #d0,-6," ",#ff
bit 3,h
jr endis
.iendis
jr z,endis+2
xor a
.endis
jr z,diabd
call fprint
db #c0,"Enabled ",#ff
ret
.diabd
call fprint
db #c0,"Disabled",#ff
ret
.confdrvs
call nomen2
ld de,#c2d4
ld bc,#15ff
call tline
ld a,4
call mhline
call mline
ld a,4
call mhline
call mline
call hline2
call bline
ld de,#c645
call fprint
db "Ok",#ff
ld a,6
ld (currf),a
.sdrvslp
call shwdrvs
.dcurslp
call ddcurs
call #bb18
push af
call ddcurs
pop af
ld b,6
call updown
jr z,dcurslp
inc a
ld b,a
sub 4
ld e,0
jr c,isddv0
inc a
ld b,a
inc e
.isddv0
ld a,e
call chkdrv0
djnz ns4080
xor 2
bit 3,a
jr z,setvddb
and #0d
jr setvddb
.ns4080
djnz nssides
ld h,a
and #05
ld a,h
jr nz,isdsdd
xor #04
jr setvddb
.isdsdd
xor #01 ;Now single sided
and #0b
jr setvddb
.nssides
xor 8
bit 1,a
jr z,setvddb
and #07
.setvddb
and #f
ld c,a
add a:add a:add a:add a
ld b,a
ld hl,RAM_DDB
ld a,(hl)
dec e
jr z,isdrv1
and #f
or b
.setddbb
ld (hl),a
dec l:dec l
ld (hl),a
jr sdrvslp
.isdrv1
and #f0
or c
jr setddbb
.updown
ld hl,currf
cp #fc
jr z,endsud
cp #f0
jr nz,notdscu
ld a,(hl)
or a
ret z
dec (hl)
xor a
ret
.notdscu
cp #f1
jr nz,notdscd
ld a,(hl)
cp b
ret z
inc (hl)
.dcursss
xor a
ret
.notdscd
cp 13
jr nz,dcursss
ld a,(hl)
cp b
ret nz
.endsud
pop hl
jp clmain
.ddcurs
ld a,(currf)
cp 3:jr c,lessy3
inc a:inc a
.lessy3
cp 8:jr nz,lessy6
inc a
.lessy6
call times80
ld bc,#c375
add hl,bc
ld bc,#1501
jp cursdisp
.shwdrvs
ld de,#c325
xor a
call shwdrve
ld de,#c4b5
ld a,1
.shwdrve
ld c,0
push de
push af
call chkdrv0
ld h,a
call fprint
db -6," D",#ad,#ff
pop af
add 65
call fastch
call fprint
db ":",-7," ",#ff
pop de
call dnlne
push de
ld c,#ff
bit 1,h
ld a,"4"
jr z,trk40t
ld a,"8"
.trk40t
call fastch
call fprint
db "0 tracks per side",#ff
pop de
call dnlne
push de
bit 0,h
call sdoub
call fprint
db "le sided ",#ff
bit 0,h
jr nz,isdoub
call fprint
db "(Side ",#ff
ld a,"0"
bit 2,h
jr z,issd0
inc a
.issd0
call fastch
ld a,")"
call fastch
jr isndoub
.isdoub
call fprint
db -8," ",#ff
.isndoub
pop de
call dnlne
bit 3,h
call sdoub
call fprint
db "le-stepping",#ff
ret
.sdoub
jr z,sings
call fprint
db "Doub",#ff
ret
.sings
call fprint
db "Sing",#ff
ret
.notz
or #ff
ret
.break
call #bb09
jr nc,notz
cp #fc
ret nz
call #bb8a
call #bb06
push af
call #bb8d
pop af
cp #fc
ret nz
call nomen
db "Operation aborted",#ff
call anykey
xor a
ret
.Format
ld hl,#bafe
set 0,(hl)
call nomen
db "D",#ad,#cb,"f",#ae,#c0,#ff
call getcdrive2
push af
call nomen
db "Select f",#ae," for D",#ad,#ff
pop af
push af
add 65
call #bb5a
ld a,":"
call #bb5a
pop af
ld e,a
call sdrv
ld e,a
ld ix,formbuff
ld bc,#1600 ;Number of formats (22)
ld hl,forms+3
.checkf
ld a,(hl)
inc hl
inc hl
and e
jr z,noput
ld (ix+0),l
ld (ix+1),h
inc c
inc ix
inc ix
.noput
call skip0
inc hl
inc hl
inc hl
djnz checkf
ld a,c
ld (numfr),a
cp 16
jr c,less16
ld a,16
.less16
ld (scrls),a
push af
ld hl,#505
ld de,#1414
call #bb66
ld c,#ff
ld de,#c694
ld b,#90
call bline
pop af
.prflp
call mhline
inc hl
ld (basea),hl
call tline
xor a
ld (basef),a
ld (currf),a
ld c,a
ld a,(scrls)
ld b,a
ld de,(basea)
.shflp
call showfr
djnz shflp
.waitfc
call fcursor
call #bb18
push af
call fcursor
pop af
ld hl,currf
cp #f0
jr nz,notufc
ld a,(hl)
or a
jr z,waitfc
ld a,(basef)
cp (hl)
jr nz,noscruf
dec a
ld (basef),a
ld c,a
dec (hl)
call cprint
db 31,1,1,11,10,#ff
ld de,#c195
jr showfrc
.noscruf
dec (hl)
jr waitfc
.notufc
cp #f1
jr nz,notdfc
ld a,(numfr)
ld b,a
ld a,(hl)
inc a
cp b
jr z,waitfc
ld (hl),a
ld a,(basef)
ld b,a
ld a,(hl)
sub b
cp 16
jr nz,waitfc
ld a,b
inc a
ld (basef),a
call cprint
db 31,1,17,10,#ff
ld de,#c645
ld a,(currf)
ld c,a
.showfrc
call showfr
jr waitfc
.notdfc
cp #fc
jp z,clmain
cp 13
jr nz,waitfc
call clmain
call nomen
db "V",#af," while f",#b0,#ff
call getyn
jr z,isyes
xor a
.isyes
ld (verform),a
call unlog
ld a,(currf)
ld c,a
call getffm
.reform
push hl
call insert
db #b7,"f",#ae,#b8,#ff
pop hl
push hl
call fprint2
call fprint
db " f",#ae,#ff
ld a,(formdrv)
call indrive
jp z,escapef
ld hl,vbuff
ld de,vbuff+1
ld bc,#1ff
ld (hl),#e5
ldir
call nomen
db "F",#ae,#bb,-4," ",#ff
pop hl
push hl
call setform
ld a,(formdrv)
ld c,e
ld e,a
ld a,#f
call #ca63
ld (hl),#ff
inc hl
ld (hl),b ;Number of sectors per track
inc hl
inc hl
ld (hl),c ;Gap length #3
.formloop
push bc
push de
ld a,d
ld de,#c793
call dec3a
pop de
pop bc
call break
jp z,escapef
push bc
push de
ld hl,formbuff
push bc
push hl
ld c,d
.setfbuff
ld a,(#baff)
and 1
jr z,nomod
srl d
jr c,nomod
xor a
.nomod
ld (hl),d
inc hl
ld (hl),a
inc hl
inc hl
inc hl
djnz nomod
pop hl
ld d,c
call #c652 ;Format track
pop bc
ld a,(verform)
or a
jr z,nokv
ld hl,#1901
call #bb75
ld hl,vbuff
call vtrack
jr z,okv
call cprint
db 7,"- E",#b9,#ff
jr nokv
.okv
call cprint
db #c1,#ff
.nokv
pop de
pop bc
ld a,d
dec d
or a
jr nz,formloop
call nomen
db "F",#ae,#d3,#ff
call getyn
pop hl
jp z,reform
push hl
.escapef
pop hl
call relog
jp clmain
.vtrack ;E=drive, D=track, B=sectors per track
ld a,(formbuff+2)
ld c,a
.vloop2
call vsect
ret nz
djnz vloop2
ret
.vsect ;Verifies sector C
push bc
push hl
call vsec
pop hl
pop bc
inc c
ld a,(#be4e)
and #3f
cp #08
ret
.vsec
call #c976
ld a,#51
ld b,#11
jp #c66d
.setform ;Set format buffer to format at HL
;Returns E=gap #3, B=# of sectors, D=last track
;(obaff) = old DDB, (#baff)=setting for format
;format setup at formbuff
dec hl
ld b,(hl) ;Number of sectors per track
dec hl
ld c,(hl) ;Format specifier
dec hl
dec hl
dec hl
push bc
res 7,b
ld a,b ;B=8, 9 or 10
add (hl)
ld c,a ;Last sector + 1
ld de,#552 ;9 sectors per track, interleave, gap #3
bit 0,b
jr nz,use9
ld e,#10 ;10 sectors per track, gap #3
bit 1,b
jr nz,use9
ld de,#150 ;8 sectors per track
.use9
ld a,(hl)
ld hl,formbuff
.use9l
inc hl
inc hl
ld (hl),a
inc hl
ld (hl),2
inc hl
add d ;Add interleave
cp c
jr c,noaddi
sub d
sub d
inc a
.noaddi
djnz use9l
pop bc
ld a,#ff
.checddb
inc a
srl c
jr nc,checddb
ld c,a
add a:add a:add a:add a
or c
ld c,a
ld a,(#baff)
ld (obaff),a
and #cc
or c
ld (#baff),a ;Bit 0 = 1 for double sided
ld d,40
bit 7,b
res 7,b
jr nz,use40
dec d
.use40
and 3
ret z
ld d,79
cp 3
ret nz
ld d,159
ret
.insert
call mestop
db "Insert ",#ff
jp fprint
.indrive
push af
call fprint
db " in d",#ad,#ff
pop af
add 65
call fastch
call fprint
db ": then p",#ba,#ff
call #bb18
cp #fc
ret
.clmain
call mainw
db 12,24,#ff
ret
.fcursor
ld a,(basef)
ld b,a
ld a,(currf)
sub b
call times80
ld bc,(basea)
add hl,bc
ld bc,#1001
jp cursdisp
.showfr
push bc
push de
call getffm
ld c,#ff
inc de
call fprint2
pop de
pop bc
inc c
.dnlne
push hl
ld hl,#50
add hl,de
ex de,hl
pop hl
ret
.getffm
ld hl,formbuff
ld b,0
add hl,bc
add hl,bc
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
ret
.Logdisc
call nomen
db "Log Which D",#ad,": ",#ff
call getdrive
call loga
ld a,e
ld (fspec),a
.getdir
call dirinf
call rsects
call setbuff
call getsort
.getfdesc ;Display current format
ld a,(fspec)
ld e,a
.getfdesce
ld a,#2
call #ca63
ld d,(hl) ;BSH, block shift
inc hl
inc hl
inc hl
ld b,(hl) ;DSM, number of blocks - 1
ld a,#d
call #ca63
ld a,(hl) ;OFF, reserved tracks
inc hl
inc hl
ld c,(hl) ;first sector number
ld hl,forms
cp 1
jr nz,notms8
ld hl,ms800f
.notms8
push de
call sdrv
add a:add a:add a:add a:ld e,a
call findf
pop de
jr nc,issame
.noformf
ld hl,unknown
.issame
ld (formdesc),hl
ret
.unlogd
ld a,(formdrv)
ld hl,savedpb+#1d
jr unlog2
.unlog
ld hl,savedpb
ld a,(fspec)
.unlog2
ld e,a
push hl
xor a
call #ca63
pop de
ld bc,#16
ldir
ld hl,formdesc
ld bc,5
ldir
ld hl,#bafe
ldi
ldi
ret
.relogd
ld a,(formdrv)
ld hl,savedpb+#1d
call relog2
jp dirinf2
.relog
ld a,(fspec)
ld hl,savedpb
.relog2
ld e,a
push de
xor a
push hl
call #ca63
ex de,hl
pop hl
ld bc,#16
ldir
ld de,formdesc
ld bc,5
ldir
ld de,#bafe
res 0,(hl)
ldi
ldi
pop de
jp getfdesce
.loga
ld e,a
ld d,0
call getform
ld (sect1),a
inc d
inc d
call getform
ld (sect2),a
inc hl
ld b,(hl)
cp #71
jr nz,nms800
ld a,(sect1)
cp #c1
jr nz,nms800
dec hl ;#f
dec hl ;#e
dec hl ;#d
ld (hl),1
.nms800
ld a,(sect2)
add b
ld (sect3),a
ret
.sdrv
ld a,e
call chkdrv2
and 3
inc a
ld e,a
xor a
scf
.setdv
adc a
dec e
jr nz,setdv
ret
.findf ;Carry set if not found
ld a,(hl) ;Check sector number
or a
scf
ret z
inc hl
cp c
ld a,(hl) ;Check block shift
inc hl
push hl
jr nz,nosame
cp d
jr nz,nosame
ld a,(hl)
inc hl
cp b
jr nz,nosame
ld a,(hl)
inc hl
inc hl
and e
jr z,nosame
inc sp:inc sp
ret
.nosame
pop hl
inc hl:inc hl
call skip0
jr findf
.skip0
ld a,(hl)
inc hl
inc a
ret z
jr skip0
.dirinf
ld a,(fspec)
ld e,a
.dirinf2
push de
ld a,#d
call #ca63
ld a,(hl)
ld (resert),a
ld a,#2
call #ca63
ld c,(hl) ;BSH in C
inc hl
ld a,(hl)
ld (blmsk),a
inc hl
ld a,(hl)
ld (exmsk),a
inc hl
ld e,(hl) ;LSB of DSM
inc hl
ld d,(hl) ;MSB of DSM
inc hl
ld (dsm),de
ld a,(hl) ;DRM
ld (dire),a
inc hl
inc hl
srl a:inc a ;32
and #e0
rra:rra:rra
ld (dirsc),a
ex de,hl ;HL=DSM-1
inc hl
ld a,(de) ;AL0
ld de,0
ld b,8
.allop
add a
sbc hl,de
djnz allop
ld a,c ;HL=number of blocks
sub 3
jr z,nobshft
.bshft
add hl,hl
dec a
jr nz,bshft
.nobshft
ld (totalk),hl
pop de
.getdir2
ld a,(resert)
ld d,a
ld a,(dirsc)
ld b,a
ld a,(sect2)
ld c,a
ld hl,#100
ret
.writedir
ld a,(fspec)
ld e,a
call getdir2
.wsects
ld ix,#c64e
jr rsects+4
.rsects ;B=number of sects, D=drive, E=track, HL=addr, C=sect
ld ix,#c666
ld (rwcal+1),ix
.nxttrk
push bc
push hl
call rwcal
pop hl
pop bc
inc h
inc h
inc c
ld a,(sect3)
cp c
jr nz,notnxt
ld a,(sect2)
ld c,a
inc d
.notnxt
djnz nxttrk
ret
.getsort
ld hl,dalloc ;First clears the directory allocation map
ld a,(dire)
ld b,a
xor a
ld (hl),a
.gsl1
inc l
ld (hl),a
djnz gsl1
ld a,#80
.gsl2
inc l
jr z,lastde
ld (hl),a
jr gsl2
.lastde
ld hl,0
ld (ktagged),hl
ld (ftagged),hl
.dosort
push iy ;Then sorts the directory using a table at sortedx
ld iy,sortedx
ld hl,sorted
.clrsort
ld (hl),h
inc l
jr nz,clrsort
ld h,l
ld (lastf2),hl
.sort2
ld a,(dire)
inc a
ld b,a
ld c,0
.sort3
call checkent
jr nz,checkff
inc c
djnz sort3
pop iy
jp newfs
.checkff
ex de,hl
db #dd:ld l,c
.skipff
inc c
djnz other
db #dd:ld a,l
ld (iy+0),a
ld (lastf2),iy
inc iy
ld l,a
ld h,sortedh
xor a
ld (hl),a
jr sort2
.other
call checkent
jr z,skipff
push bc ;if entry at HL < entry at DE
call compare
pop bc
jr c,checkff ;if (DE) < (HL)
jr skipff
.compare
ld b,12
.compare2
push de
push hl
ex de,hl
ld a,(de)
cp (hl)
jr nz,lless
.compl1
inc l
inc e
ld a,(hl)
and #7f
ld c,a
ld a,(de)
and #7f
cp c
jr nz,lless
djnz compl1
.lless
pop hl
pop de
ret
.SortFiles
ld hl,issort
ld a,(hl)
cpl
ld (hl),a
jp dosort
.newfs
ld hl,0
ld (entries),hl ;Number of used directory entries
ld (files),hl
ld (kused),hl
ld de,dalloc ;Start of directory map
ld ix,#100 ;First directory entry
.gmasklp
push ix
ld a,(de) ;bit 5=1 means not matching
cp #80 ;1 means checked, first entry
jp z,noentry ;3 means checked, not first entry
;bit 6 = 1 if tagged.
ld a,(ix+0)
cp #e5
jr nz,incentry
cp (ix+1)
jr z,nofile
ld hl,(files)
ld a,(exmsk)
jr chkmsk
.incentry
ld hl,(entries)
inc hl
ld (entries),hl
call getfsz
ld hl,(kused)
add l
ld l,a
ld a,h
adc 0
ld h,a
ld (kused),hl
ld hl,(files)
inc hl
ld a,c
.chkmsk
cpl
and (ix+12)
ld c,2
jr nz,noincc
ld (files),hl
dec c
.noincc
ld hl,fspec+1
ld a,(hl) ;Check user number ?
inc hl
or a
jr z,ychk
ld a,(ix+0)
cp #e5
jr z,nomatch
jr chky
.ychk
ld a,(ix+0)
cp (hl)
jr nz,nomatch
.chky
ld b,11
inc ix
inc hl
ld a,(hl)
cp "?"
jr z,nocheck
ld a,(ix+0)
and #7f
cp (hl)
jr nz,nomatch
.nocheck
djnz chky+2
jr setix
.nofile
ld a,#82 ;Un-used directory entry
jr setix2
.nomatch
set 5,c
.setix
ld a,(de)
and #40 ;Preserve tagged flag
or c
.setix2
ld (de),a
.noentry
pop ix
ld bc,#20
add ix,bc
inc e
jp nz,gmasklp
.sort
xor a
ld (firstf),a
ld h,a:ld l,a
ld (lastf),hl
ld (curpos),hl
ld (maxcp),hl
ld hl,sortedx
ld de,sorted
ld a,(issort)
or a
jr z,sort4
ld hl,dalloc
.sort5
ld a,(hl)
and #bf
dec a
jr nz,nxfile4
ld a,l
ld (de),a
ld (lastf),de
inc de
.nxfile4
inc l
ret z
jr sort5
.sort4
call checkhl2
ret c
push hl
ld l,(hl)
ld h,dalloch
ld a,(hl)
and #bf
dec a
jr nz,nxfile3
ld a,l
ld (de),a
ld (lastf),de
inc de
.nxfile3
pop hl
inc hl
jr sort4
.checkent ;Check entry C
ld l,c
ld h,sortedh
ld a,(hl)
or a
ret z
call faddr
ld a,(hl)
cp #e5
ret nz
inc l
ld a,(hl)
dec l
cp #e5 ;Unused directory entry?
ret nz
.nowsort
ld l,c
ld h,sortedh
xor a
ld (hl),a
ret
.getfsz ;Calculate size of entry at IX in 1K blocks
;Value returned in A
ld a,(blmsk)
ld b,a
cpl
ld c,a
ld a,(ix+15)
add b
and c ;Number of #80 blocks
rra:rra:rra
and #1f
ld b,a ;Number of 1K blocks
ld a,(exmsk)
ld c,a
and (ix+12) ;Number of 16K blocks
add a:add a
add a:add a ;Number of 1K blocks
add b
ret
.faddr
ld h,0
add hl,hl ;*2
add hl,hl ;*4
add hl,hl ;*8
add hl,hl ;*16
add hl,hl ;*32
inc h
ret
.getform ;E=drive, D=track
;Returns A=format
push de
call #c763
call #c56c
ld a,#f
call #ca63
ld a,(hl)
pop de
ret
.DVerify
call nomen
db "D",#ad,#cb,"v",#af,#c0,#ff
call getdrive
ld (formdrv),a
push af
call insert
db #b7,"v",#af,#ff
pop af
call indrive
ret z
call unlog
ld a,(formdrv)
call loga
call getfdesce
call mestop
db "D",#b5,"is ",#ff
ld hl,(formdesc)
ld c,#ff
call fprint2
call fprint
db " f",#ae," - V",#af,#bb,#ff
ld (numadr),de
call mainw
db 12,31,2,2,"E",#b9,"s",#c0,26,11,#37,4,23,#ff
ld hl,(formdesc)
call setform
xor a
ld (verform),a
ld a,(formdrv)
ld e,a
ld a,(formbuff+2)
ld c,a
ld a,d
ld d,0
.verloop
push af
push bc
push de
push de
push bc
ld a,d
ld de,(numadr)
call dec3a
pop bc
pop de
xor a
ld (verror),a
.vloop3
call break
jp z,escape3
push bc
push de
ld hl,vbuff
ld a,2
ld (#be66),a
call #c666 ;Read sector
ld a,16
ld (#be66),a
jr c,sectok
ld a,1
ld (verror),a
ld (verform),a
.sectok
pop de
pop bc
jr nc,verrbad
inc c
djnz vloop3
.verrbad
ld de,(numadr)
inc de:inc de:inc de:inc de
ld a,(verror)
or a
ld c,#ff
jr z,okv2
call fprint
db "- E",#b9,#ff
pop hl
push hl
ld l,h
ld h,0
call #cb3a
call cprint
db 7," ",#ff
jr nokv2
.okv2
call fprint
db #c1,#ff
.nokv2
pop de
pop bc
pop af
inc d
cp d
jr nc,verloop
ld a,(verform)
or a
jr z,noerrs
call nomen
db "V",#af," Failed",#ff
jr doany
.noerrs
call nomen
db "No e",#b9,"s found",#ff
.doany
call anykey
jr noesc
.escape3
pop de
pop bc
pop af
.noesc
call clmain
jp relog
.MTag
call clastf
ld de,tagf
call forall
pop hl
jp keyloop2
.MUntag
call ctagged
ld de,untagf
jr MTag+6
.backsp
call #bb75 ;Locate
push ix
pop hl
call cprint2
dec hl
dec hl
.backspl
ld a,(hl)
cp " "
jr nz,notsp
dec hl
djnz backspl
.notsp
inc hl
ret
.getkey2
call setxy
call getukey
cp #fc
jp z,ret0
ld c,a
ret
.entuser
ld ix,unumb
.entuser2
ld (xypos),hl
ld b,3
call backsp
.prlp2
call getkey2
ld de,prlp2
cp 13
ret z
cp #f3
ret z
push de
cp #80
ret nc
cp 16
jp z,clrfl
cp 127
jp z,delete
ld a,c
cp "0"
ret c
cp "9"+1
ret nc
ld a,b
cp 3
ret z
cp 2
jr nz,tch+1
ld a,(ix+0)
cp "2"
jr z,ok1
jr tch
.ok1 ;if first digit is "2"
ld a,(ix+1)
cp "5"
jr z,ok2
jr tch
.ok2 ;And second digit is "5"
ld a,c
cp "6"
.tch
ret nc
jp sch
.enter ;Call with H=x offset, L=y offset
;Carry not set if escape pressed
ld ix,fspec2
.enter2
db #3e
.enter3
xor a
ld (alloww),a
ld (xypos),hl
ld b,12
call backsp
.prlp
call getkey2
ld de,illegal
.chnc
ld a,(de)
inc de
or a
jr z,osch
cp c
jr nz,chnc
jr prlp
.osch
ld de,prlp
ld a,c
cp 13
ret z
cp #f2
ret z
push de
cp #80
ret nc
ld a,(alloww)
or a
ld a,c
jr nz,awild
cp "*"
ret z
cp "?"
ret z
.awild
ld d,h
ld e,l
cp 16
jr z,clrfl
cp 127
jr z,delete
ld a,b
cp 12
ret z
ld a,c
cp "."
jr z,dot
ld a,b
or a
jr z,fstch
dec hl
ld a,(hl)
inc hl
cp "*"
ret z
call isdot
jr nc,isdot2
ld a,b
cp 8
ret nc
jr fstch
.isdot2
sub b
neg
cp 3
ret nc
.fstch
ld a,c
cp 33
ret c
jr sch
.clrfl
ld a,b
or a
ret z
ld c,32
dec hl
ld (hl),c
dec b
ld a,b
call shpc
jr clrfl
.delete
ld a,b
or a
ret z
ld c,32
dec hl
ld (hl),c
dec b
ld a,b
jr pch
.dot
call isdot
ret nc
.sch
ld (hl),c
inc hl
ld a,b
inc b
.pch
.shpc
call setxy+1
ld a,c
jp #bb5a
.setxy
ld a,b
push hl
ld hl,(xypos)
add h
ld h,a
call #bb75
pop hl
ret
.convmask
ld hl,fspec+3
ld de,fspec2
.convmask2 ;DE=source, HL=dest
ld bc,#80c
call bit
ld b,3
ld a,(de)
inc de
cp "."
jr nz,fillsp+1
.bit
ld a,c
or a
ret z
ld a,(de)
inc de
dec c
cp "*"
jr z,fillq
cp "."
jr z,fillsp
call upper
ld (hl),a
inc hl
djnz bit
ret
.fillsp
dec de
ld a," "
jr fillq+2
.fillq
ld a,"?"
ld (hl),a
inc hl
djnz fillq+2
ret
.illegal
db "%()_=|[];:<>,/\"
.moreil
db "%%",0
.isdot
ld a,b
or a
ret z
push bc
.idlp
dec de
ld a,(de)
cp "."
ld a,b
jr z,pbc
djnz idlp
scf
.pbc
pop bc
ret
.initcb
ld hl,(crsect)
inc h:inc h
ld (ddir),hl
ld bc,#2000
add hl,bc
jr setbuff2
.setbuff
ld (crsect),hl
.setbuff2
ld a,#80
ld (bufstbk),a
ld (bufendbk),a
xor a
ld l,a
ld (bufstrt),hl
ld (bufend),hl
dec h
ld e,h
ld d,a
ld hl,(buftot+1)
sbc hl,de
ld (buffree+1),hl
ld (buffree),a
ld de,#c728
call deck
.showfree
ld de,#c6d8
ld hl,(buffree+1)
jp deck
.initfs
db #ff,1,0,"???????????"
db "*.* ",#ff
db " ",#ff
db " ",#ff
dw 0
db #c3,0,0
db #c3
.ramlist2
db #c0,#c4,#c5,#c6,#c7,#cc,#cd,#ce,#cf,#d4,#d5,#d6,#d7
db #dc,#dd,#de,#df,#e4,#e5,#e6,#e7,#ec,#ed,#ee,#ef
db #f4,#f5,#f6,#f7,#fc,#fd,#fe,#ff,0
.unknown
db "UNKNOWN",#ff
.g10 equ 14
.g9 equ 82
.g8 equ 80
;Use MS800 format block if OFF=1
.ms800f
db #71,#04,#c7,#fc,0,"MS800",#ff ;MS800 format
.forms ;first sect, BSH, LSB of DSM
;form enable, sects
db #91,#04,#c7,#fc,10,#c6,"80",#ff ;1. PARADOS 80
db #81,#03,#cc,#ff,#8a,#c6,"41",#ff ;2. PARADOS 41
db #a1,#04,#c7,#fa,10,#c6,"40D",#ff ;3. PARADOS 40D
db #01,#04,#67,#f8,9,#c2,"1",#ff ;4. ROMDOS D1
db #21,#04,#67,#f8,9,#c2,"2",#ff ;5. ROMDOS D2
db #11,#04,#8f,#f8,10,#c2,"10",#ff ;6. ROMDOS D10
db #31,#04,#8f,#f8,10,#c2,"20",#ff ;7. ROMDOS D20
db #51,#04,#c7,#fa,10,#c2,"40",#ff ;8. ROMDOS D40
db #71,#04,#c7,#fc,10,"S-DOS",#ff ;9. S-DOS (ROMDOS D80)
db #c1,#03,#b3,#ff,9,#c4,#c7,#ff ;10. DATA (SS 40)
db #c1,#04,#b3,#2a,9,#c4,#c8,#ff ;11. DATA (DS 40)
db #c1,#04,#b3,#4c,9,#c4,#c9,#ff ;12. DATA (SS 80)
db #c1,#05,#b3,#f8,9,#c4,#ca,#ff ;13. DATA (DS 80)
db #41,#03,#aa,#ff,9,#c3,#c7,#ff ;14. SYSTEM (SS 40)
db #41,#04,#ae,#2a,9,#c3,#c8,#ff ;15. SYSTEM (DS 40)
db #41,#04,#ae,#4c,9,#c3,#c9,#ff ;16. SYSTEM (SS 80)
db #41,#05,#b0,#f8,9,#c3,#ca,#ff ;17. SYSTEM (DS 80)
db #01,#03,#9b,#ff,8,#c5,#c7,#ff ;18. IBM (SS 40)
db #01,#04,#9d,#2a,8,#c5,#c8,#ff ;19. IBM (DS 40)
db #01,#04,#9d,#4c,8,#c5,#c9,#ff ;20. IBM (SS 80)
db #01,#05,#9e,#f8,8,#c5,#ca,#ff ;21. IBM (DS 80)
db #10,#03,#cc,#ff,#8a,#d0,#ff ;22. ULTRAFORM
;db #01,#ff,#ff,#ff,#c6,#ff ;23. PCW format ???????????
db 0
.endall
.len2 equ $-setdrv
org routines+len2
.total equ $-#4000
NOTICE TEXTE n° 2 (32.91 Ko)
Source ROM2
-----------
.upper equ #caa6
.dalloc equ #a900
.sorted equ #aa00
.sortedx equ #ab00
.dalloch equ #a9
.sortedh equ #aa
.sortedxh equ #ab
.winbuff equ #a360
.formbuff equ #a300
.vbuff equ #aeb0
nocode
org #be80
list
.ramlist ds 34
.keystate db 0
.stack dw 0
.formdesc dw 0
.sect1 db 0
.sect2 db 0
.sect3 db 0
.fspec ds 14
.fspec2 ds 13
.unumb ds 4
.tuser ds 4
.userl db 0
.issort db 0
.rwcal ds 3
.fordo ds 3
.dire db 0
.dirsc db 0
.dsm dw 0
.exmsk db 0
.blmsk db 0
.entries dw 0
.files dw 0
.lastf dw 0
.lastf2 dw 0
.firstf db 0
.totalk dw 0
.kused dw 0
.curpos dw 0
.maxcp dw 0
.curadr dw 0
.ktagged dw 0
.ftagged dw 0
.xypos dw 0
.doit db 0
.numadr
.attset dw 0
.obaff
.destuser db 0
.verror
.alloww db 0
.numfr db 0
.scrls db 0
.basea dw 0
.basef db 0
.currf db 0
.resert db 0
.verform db 0
.formdrv db 0
.oldwin ds 4
.oldpen db 0
.oldcurs dw 0
.wintop dw 0
.winwid db 0
nolist
org #40
list
.tempf2 ds 13
.tempf ds 13
.savedpb ds #3a
.recaddr dw 0
.blkoff dw 0
.sectoff db 0
.trksec dw 0
.rfname dw 0
.buftot ds 3
.buffree ds 3
.bufstrt dw 0
.bufstbk db 0
.bufend dw 0
.bufendbk db 0
.ddir dw 0
.crsect dw 0
.rfptr dw 0
.dlogged db 0
.endddir dw 0
.ffile db 0 ;Leave this
.wfptr dw 0 ;group of 5 bytes
.wblks dw 0 ;intact.
.wrecad dw 0
.wblkof dw 0
.wsectof db 0
.writeyn db 0
.wextent db 0
.wfloc dw 0
.writeent dw 0
.wtrksec dw 0
.wclose db 0
.werror db 0
.wrtany db 0
.needent db 0
.cursdisp dw $+endcurs-showcurs
nolist
code
.RAM_DDB equ #baff
.RAM_DPBC equ #bafe
.RAM_LOCK equ #bafa
org #1000
limit #3fff
write "rom.cmd"
ld c,6
call #b90f
push bc
ld a,(#c002)
ld hl,fb
cp 7
jp nz,start
ld hl,fb2
jp start
.fname
db "A40B80.ROM"
db 2,3 ;Format enables, DDB
.start
push hl
ld a,#a ;Increase step rate for faster drive access
ld (#45da),a
ld a,#75
ld (#4004),a
ld a,#f3
ld (#4078),a
call #b903
pop hl
.nxthl
ld e,(hl)
inc hl
ld a,(hl)
inc hl
sub #80
ld d,a
or e
jr z,finished
ld bc,3
ldir
jr nxthl
.finished
ld a,#f0
ld (#4593),a
ld (hlval+1),hl
ld hl,fname
.lngh
ld b,10
ld de,#8000
call #bc8c
ret nc
.hlval
ld hl,0
ld bc,len1
ld de,here2
ld a,(start-1)
ld (hl),a
inc hl
inc hl
inc hl
ld a,(start-2)
ld (hl),a
dec hl
dec hl
dec hl
ldir
ld hl,here2
ld de,#5c00
ld bc,#2400
ldir
ld hl,endall-#8000
ld de,endall-#7fff
list
ld bc,2-endall
nolist
ld (hl),0
ldir
ld a,2
ld hl,#4000
ld de,#4000
ld bc,0
call #bc98
ret nc ;jp nc,diser
call #bc8f
ret nc ;jp nc,diser
pop bc
jp #b918
.fb
dw #c1be
call dob912
dw #c1c4
jp setdrv
dw #c5f2
call setdrv2
dw #c588
call selhl
dw #c59f
call selde
dw #c687
call drvhd
dw #c566
call drvhd
dw #c6a6
call rttr2
dw #c76f
call rttr
dw #c6aa
call rthd
dw #cde7
call setup
dw #ca7b
call dmess
dw #c57a
call abstrk
dw #c072
jp plus
dw #c075
db "PDo"
dw #8000
.here1
org #dc00
limit #ffff
.ROM_DDB
defb #03
defw RAM_DDB
.DPB_Cont
defb #02
.endd
.len1 equ endd-#dc00
org here1+len1
.fb2
dw #c1b5 ;?????
call dob912
dw #c61c
call setdrv
dw #c588
call selhl
dw #c59f
call selde
dw #c687
call drvhd
dw #c566
call drvhd
dw #c6a6
call rttr2
dw #c7d3
call rttr
dw #c6aa
call rthd
dw #cede
call setup
dw #8000
.here2
org #dc00
.pROM_DDB
defb #03
defw RAM_DDB
.pDPB_Cont
defb #02
org here2+len1
.routines
org #dc00+len1
.setdrv2
push hl
ld hl,16
add hl,sp
ld a,(hl)
cp #2e
jr z,ok464
cp #2b
jr nz,nosign
.ok464
inc hl
ld a,(hl)
cp 3
call z,signon
.nosign
ld hl,(RAM_LOCK)
ld a,h
cp #44
jr nz,resetddb
ld a,l
cp #50
jr z,movein
.resetddb
ld a,(ROM_DDB)
ld (RAM_DDB-2),a ;#bafd
ld a,(DPB_Cont)
ld (RAM_DPBC-2),a ;#bafc
ld hl,#4450
ld (RAM_LOCK),hl ;#bafa
.movein
ld hl,(RAM_DPBC-2)
ld (RAM_DPBC),hl
pop hl
.dob912
jp #b912
.setdrv
call #b912
or a ;If this is ROM 0, do CPM
jr z,c1c7
cp 7 ;If this is ROM 7, log on as normal
jr z,c1c7
pop bc ;Return address in lower ROM
ret nc
push bc
push de
push hl
ld hl,3
add hl,bc
ld b,a
ld a,(hl)
inc hl
cp #21
jr z,is464
inc hl
inc hl
.is464
ld e,(hl)
inc hl
ld d,(hl) ;Address of ROM workspace table
ld hl,14 ;Offset of ROM 7
add hl,de
ld a,(hl)
inc hl
or (hl) ;Not logged on if zero
ld a,b
jr nz,overwr
pop hl
pop de
.c1c7
push iy
push de
jp #c1c7
.overwr
ld bc,-14
add hl,bc
ld c,a
inc b
add hl,bc
add hl,bc ;HL=address of workspace table for
;this ROM
push iy
ld de,(#be7d) ;Address of Disc ROM workspace
ld (hl),d
dec hl
ld (hl),e
push de
pop iy
ld (iy-2),a
ld hl,#c9d6
ld (#be71),hl
ld (#be73),a
ld hl,#18b
call #ca9f ;Change for plus version?
ld (hl),#30
inc hl
ld (hl),#cd
inc hl
ld (hl),a
ld hl,#c5d4
call #c60d
push hl
call setdrv2
pop hl
pop iy
pop hl
pop de
or a
ret
.signon
call cprint
db " PARADOS V1.1. ",&a4,"1997 QUANTUM Solutions.",13,10,10,#ff
ret
.plus
call #b906
ld hl,0
jp #77
.nomen
call cprint
db 26,0,79,24,24,14,1,15,0,12," ",#ff
.cprint
pop hl
call cprint2
jp (hl)
.cprint2
push ix
ld ix,#bb5a
call fprint3
pop ix
ret
.fprint2
push ix
ld ix,fastchr
.fprint4
call #b906
call fprint3
call #b909
pop ix
ret
.fprint3
ld a,(hl)
inc hl
cp #a5
jr c,lessa5
cp #ff
ret z
cp #fe
jr nz,multf
push bc
ld a,c
cpl
ld c,a
ld a,(hl)
inc hl
call doix
pop bc
jr fprint3
.multf
cp -23
jr nc,gt23
push hl
ld hl,messtab
sub #a5
jr z,gotmess
ld b,a
ld a,#ff
.getmess
cp (hl)
inc hl
jr nz,getmess
djnz getmess
.gotmess
call fprint3
pop hl
jr fprint3
.gt23
jr nz,not23
ld a,-55
.not23
neg
.multf2
ld b,a
ld a,(hl)
inc hl
or a
jr nz,pllop2
.pllop3
inc de
djnz pllop3
jr fprint3
.pllop2
push bc
push af
call doix
pop af
pop bc
djnz pllop2
jr fprint3
.lessa5
call doix
jr fprint3
.fastch
push af
call #b906
pop af
call fastchr
jp #b909
.fastchr ;B=mask
push hl
ld h,7
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld b,8
.chloop
ld a,(hl)
inc l
xor c
ld (de),a
ld a,d
add b
ld d,a
jp nc,chloop
add #c0
ld d,a
pop hl
inc de
ret
.chkdrv3
push bc
push de
and 1
ld e,a
ld a,#f
push hl
call #ca63
ld a,(#be51)
and #f0
ld (hl),a
pop hl
jr chkdrv4
.chkdrv2
push bc
push de
and 1
ld e,a
.chkdrv4
ld a,(RAM_DPBC)
ld d,#f
and d
add a:add a
add a:add a
ld c,a
bit 4,c
jr nz,nodpbuse2
ld a,d
call #ca5c
and #f0
cp #90 ;PARADOS 80
jr z,ispdos
cp #70 ;S-DOS (ROMDOS D80)
jr nz,nsdos
.ispdos
dec d
set 1,c ;80 tracks per side
.nsdos
cp #80 ;PARADOS 41?
jr z,setdtoc ;Must be single sided, 40 track
or a ;IBM/D1
jr nz,notd1a
bit 6,c ;IBM formats disabled?
jr z,ds80 ;Must be D1 (DS80)
.notd1a
cp #10 ;Ultraform/D10
jr nz,notd10a
bit 7,c ;Ultraform disabled?
jr z,ds80 ;Must be D10 (DS80)
jr setdtoc ;If Ultraform (SS40)
.notd10a
bit 5,c ;Electro formats enabled?
jr nz,nodpbuse ;IF not, DATA, SYSTEM and IBM (SS40)
cp #40 ;SYSTEM
jr z,setdtoc
cp #c0 ;DATA
jr z,setdtoc
or a ;IBM
jr nz,nodpbuse
.setdtoc
ld d,#c
.nodpbuse
cp #20 ;D2
jr z,ds80
cp #50 ;D40
jr z,ds40
cp #a0 ;PARADOS 40D
jr z,ds40
cp #30 ;D20
jr nz,nodpbuse2
.ds80
set 1,c ;80 tracks per side
.ds40
set 0,c ;Double sided
.nodpbuse2
ld a,e
call chkdrv0
and d
or c
pop de
pop bc
ret
.chkdrv0
or a
ld a,(RAM_DDB)
jr nz,driveb
rra:rra
rra:rra
.driveb
bit 1,a ;If drive is 80 track, then
ret z
and #7 ;Disable double-stepping
ret
.selhl
ld a,l
ld (#be4e),a
call stdalv
push af
push bc
ld hl,#ca43 ;SYSTEM SS40
ld a,(RAM_DPBC)
ld c,a
bit 1,c
jr nz,allowbigds ;Allow big data and system formats
ld a,(#be51)
and #f0
cp #40
jr z,issys
cp #c0
jr z,issys
bit 3,c
jr z,notultraf
cp #10
jr z,issys
.notultraf
bit 2,c
jr z,allowbigds ;Not IBM formats
or a
jr nz,allowbigds
.issys
pop bc
pop af
ret
.allowbigds
pop bc
pop af
call chkdrv3
and 3
ret z
ld hl,sys160
cp 3
ret z
ld hl,sys80
ret
.selde
push af
ld a,(#be4e)
call chkdrv3
and 3
ld b,a
ld a,(RAM_DPBC)
ld c,a
pop af
bit 2,c
jr z,noibmform
or a
jr nz,noibmform
ld a,b
ld de,#c5c0
or a
ret z
ld de,ibm160
cp 3
ret z
ld de,ibm80
ret
.noibmform
inc b
djnz nottyp0
bit 3,c
jr z,nottyp0
ld de,ultra
cp #10
jr z,bigalv
.nottyp0
ld de,d1
or a
jr z,setromdos
ld de,d10
cp #10
jr z,setromdos
ld de,d2
cp #20
jr z,setromdos
ld de,d20
cp #30
jr z,setromdos
ld de,d40
cp #50
jr z,setromdos
cp #70
ld de,d80
jr z,setromdos
cp #80
ld de,pdos41
jr z,bigalv
cp #90
ld de,pdos80
jr z,setromdos2
cp #a0
ld de,pdos40d
jr z,setromdos2
ld de,unknf
ret
.setromdos2
ld a,1
db 6
.setromdos
xor a
push hl
inc hl
inc hl
ld (hl),4
inc hl
ld (hl),#f
inc hl
ld (hl),a
inc hl
inc hl
inc hl
ld a,(de)
inc de
ld (hl),a
inc hl
inc hl
add a
ld a,#c0
jr nc,is7f
ld a,#f0
.is7f
ld (hl),a
inc hl
inc hl
ld (hl),#20
pop hl
.bigalv
ld a,(#be4e)
push de
push hl
ld de,#be00
or a
jr z,setalv
ld de,#4b0
call #ca98
jr setalv
.stdalv
push de
push hl
ld de,#1b9
or a
jr z,isalva
ld de,#1f9
.isalva
call #ca98
.setalv
ld hl,#21e
or a
jr z,isalva2
ld hl,#22e
.isalva2
call #ca9f
ld (hl),e
inc hl
ld (hl),d
pop hl
pop de
ret
.drvhd
call chkdrv2
push bc
ld b,a
bit 0,b
ld a,e
jr z,single
bit 0,d
jr z,output
set 2,a
.output
pop bc
jp #c95c
.single
ld a,b
and 4
or e
jr output
.rttr
call #ca63
ld a,e
call chkdrv2
push bc
ld b,a
bit 0,b ;Sidedness
jr z,output2
srl d ;Divide by 2 if double sided
.output2
bit 3,b
pop bc
ret z
sla d ;Multiply by 2 if double-stepped
ret
.rttr2
ld a,e
call chkdrv2
push bc
ld b,a
bit 0,b
ld a,d
jr z,output3
srl a
.output3
pop bc
call #c95c
ld a,d
ret
.rthd
ld a,e
call chkdrv2
push bc
ld b,a
bit 0,b
ld a,0
jr z,output
ld a,d
and 1
jr output
.abstrk
ld hl,(#bafe)
push hl
set 0,l
res 0,h
ld (#bafe),hl
ld hl,#c55d
call #c6ff
pop hl
ld (#bafe),hl
ret
.sys160
defb #24,#00
defb #05
defb #1f
defb #03
defb #b0,#00
defb #7f,#00
defb #80,#00
defb #10,#00
defb #02,#00
defb #41
defb #09
defb #2a
defb #52
defb #e5
defb #02
defb #04
.sys80
defb #24,#00
defb #04
defb #0f
defb #01
defb #ae,#00
defb #7f,#00
defb #c0,#00
defb #10,#00
defb #02,#00
defb #41
defb #09
defb #2a
defb #52
defb #e5
defb #02
defb #04
.ibm160
defb #20,#00
defb #9e,#00
defb #01,#00
defb #01
defb #08
defb #2a
defb #50
.ibm80
defb #20,#00
defb #9d,#00
defb #01,#00
defb #01
defb #08
defb #2a
defb #50
.pdos41
db #28,#00 ;SPT, records per track
db #cc,#00 ;DSM, number of blocks - 1
db #00,#00 ;OFF, reserved tracks
db #81 ;first sector number
db #0a ;sectors per track
db #09 ;gap length (read/write)
db #10 ;gap length (format)
.ultra
db #28,#00
db #cc,#00
db #00,#00
db #10
db #0a
db #09
db #10
.unknf
db #18,0
db #02,0
db 0,0
db #2a
db 6
db 0
db 0
.d1
db #7f
db #24,#00
db #67,#01
db #00,#00
db #01
db #09
db #2a
db #52
.d2
db #ff
db #24,#00
db #67,#01
db #00,#00
db #21
db #09
db #2a
db #52
.d10
db #7f
db #28,#00
db #8f,#01
db #00,#00
db #11
db #0a
db #09
db #10
.d20
db #ff
db #28,#00
db #8f,#01
db #00,#00
db #31
db #0a
db #09
db #10
.d40
db #7f ;DRM, number of directory entries - 1
db #28,#00
db #c7,#00
db #00,#00
db #51
db #0a
db #09
db #10
.d80 ;Old SDOS format
db #7f ;DRM, number of directory entries - 1
db #28,#00
db #c7,#00
db #00,#00
db #71
db #0a
db #09
db #10
.pdos80
db #7f ;DRM, number of directory entries - 1
db #28,#00
db #c7,#00
db #00,#00
db #91
db #0a
db #09
db #10
.pdos40d
db #7f ;DRM, number of directory entries - 1
db #28,#00
db #c7,#00
db #00,#00
db #a1
db #0a
db #09
db #10
.dmess
ld a,(iy+0)
inc a
ld a,(#be78)
ret nz
pop af
pop af
push bc
push hl
push de
push af
call #bb69
ld (oldwin),hl
ld (oldwin+2),de
call #bb78
ld (oldcurs),hl
call #bb93
ld (oldpen),a
pop af
push af
cp #12
ld hl,#c32c
ld bc,#1cff
jr nz,smallwin
ld l,#29
ld b,#22
.smallwin
ld (wintop),hl
push bc
push hl
inc b
inc b
ld a,b
ld (winwid),a
ld de,winbuff
ld c,40
.keeplp
push bc
push hl
.keeplp2
rst #20
inc hl
ld (de),a
inc de
djnz keeplp2
pop hl
call nwline
pop bc
dec c
jr nz,keeplp
pop de
pop bc
call tline
call hline2
call hline2
call hline2
call bline
ld a,27
rrc b
dec b
sub b
ld h,a
ld a,27
add b
ld d,a
ld l,11
ld e,#d
call #bb66
xor a
call #bb90
ld a,1
call #bb96
pop af
pop de
pop hl
pop bc
ld c,e
call #cab8
push af
push hl
push de
push bc
ld hl,(wintop)
ld a,(winwid)
ld c,a
ld b,40
ld de,winbuff
.restloop
push bc
push hl
ld b,0
ex de,hl
ldir
ex de,hl
pop hl
call nwline
pop bc
djnz restloop
ld hl,(oldwin)
ld de,(oldwin+2)
call #bb66
ld a,(oldpen)
ld b,a
call #bb90
ld a,b
xor 1
call #bb96
ld hl,(oldcurs)
call #bb75
pop bc
pop de
pop hl
pop af
ret
.nwline
ld a,h
add 8
ld h,a
ret nc
ld bc,#c050
add hl,bc
ret
.bline
ld hl,#9a99
ld a,#93
jr hline
.mhline
push af
call hline2
pop af
dec a
jr nz,mhline
ret
.tline
ld hl,#9a9c
ld a,#96
jr hline
.mline
ld hl,#9a9d
ld a,#97
jr hline
.hline2
ld hl,#2095
ld a,l
.hline ;B=width, A=left character, H=mid character, L=right character
push de
push bc
call fastch
call #b906
pop bc
push bc
res 7,b
.mloop
push bc
ld a,h
call fastchr
pop bc
djnz mloop
ld a,l
call fastchr
pop bc
pop de
ld hl,80
bit 7,b
jr z,downl
ld hl,-80
.downl
add hl,de
ex de,hl
jp #b909
.ctagged
ld hl,(ftagged)
ld a,h
or l
ret nz
pop hl
ret
.clastf
ld hl,(lastf)
ld a,h
or l
ret nz
pop hl
ret
.cursor
call clastf
ld a,(curpos)
call times80
ld a,(curpos+1)
ld c,a
add a ;*2
add a ;*4
add a ;*8
add c ;*9
add a ;*18
ld c,a
add hl,bc
ld bc,#c0f1
add hl,bc
ld (curadr),hl
ld bc,#1201
jp cursdisp
.pad
ld a,e
cp h
ret z
ld a,32
call fastch
jr pad
.deck
srl h:rr l
srl h:rr l
jr dec3
.dec3a
ld l,a
ld h,0
.dec3
ld ix,#20ff
jr dec3b
.dec5 ;Display HL as a 5 digit decimal
db #dd:ld h,32
ld bc,10000
call decbit
ld bc,1000
call decbit
.dec3b
ld bc,100
call decbit
ld bc,10
call decbit
ld a,l
add 48
jr decdig
.decbit
ld a,"0"
or a
sbc hl,bc
jr c,fnddig
inc a
db #dd:ld h,"0"
jr decbit+2
.fnddig
add hl,bc
cp "0"
jr nz,decdig
db #dd:ld a,h
.decdig
db #dd:ld c,l
jp fastch
.times80
add a ;*2
add a ;*4
add a ;*8
ld l,a
ld c,a
ld h,0
ld b,h
add hl,hl ;*16
add hl,hl ;*32
add hl,bc ;*40
add hl,hl ;*80
ret
.getblk ;HL=block number, drive in A, returns H=track, L=sector
ld e,a
ld a,2
call #ca5c ;Get block shift in A
sub 2
.adjhl
add hl,hl ;HL=HL*sectors per block
dec a
jr nz,adjhl
ld a,#10
call #ca5c ;Get sectors per track in A
push de
ld c,a
ld de,0
ld b,d
ld a,16
.loopd
push af
add hl,hl
rl e
rl d
ex de,hl
call cphlbc
jr c,nodiv
sbc hl,bc
set 0,e
.nodiv
ex de,hl
pop af
dec a
jr nz,loopd
ld h,e
pop de
ld a,(resert)
add l
ld l,a
ld a,(sect2)
add h
ld h,a
ret
.checkused
ld a,(bufstbk)
ld l,a
ld a,(bufendbk)
cp l
ret nz
ld hl,(bufstrt)
ld bc,(bufend)
jr cphlbc
.getfree
ld a,(buffree+2)
ld hl,(buffree)
or a
ret
.checkfree
call getfree
ret nz
.cphlbc
ld a,h
sub b
ret nz
ld a,l
sub c
ret
.rbuff
push hl
push bc
call movout
ld (bufstrt),de
ld (bufstbk),a
call getfree
pop bc
push bc
add hl,bc
adc 0
call setfree
pop bc
pop hl
ld de,winbuff
.outbuff
ex de,hl
ldir
ex de,hl
ret
.inbuff
ldir
ret
.wbuff
push bc
push bc
ld de,winbuff
ldir
pop hl
call movin
ld (bufend),de
ld (bufendbk),a
pop bc
call getfree
sbc hl,bc
sbc a,0
.setfree
ld (buffree),hl
ld (buffree+2),a
jp showfree
.movout
ld h,b:ld l,c
push hl
ld de,(bufstrt)
add hl,de
ld a,(bufstbk)
ld ix,outbuff
jr movemem
.movin
push hl
ld de,(bufend)
add hl,de
ld a,(bufendbk)
ld ix,inbuff
.movemem
ld bc,#8000
cp b
jr nz,usea3
ld b,#a3
.usea3
or a
sbc hl,bc
jr nc,nofit
pop bc ;Total length
.fits
ld hl,winbuff
push hl
push bc
ld h,#be
ld l,a
ld b,#7f
ld c,(hl)
out (c),c
pop bc
ld a,b
or c
ld a,l
pop hl
call nz,doix
ld bc,#7fc0
out (c),c
ret
.doix
jp (ix)
.nofit
ex (sp),hl ;Second section length
ld h,b
ld l,c
sbc hl,de
ld b,h
ld c,l
call fits
ld d,#40
inc a
pop bc
jr fits+3
.messtab
db #fe,"Attributes",-3," ",#fe,"Copy",-3," " ;#A5
db #fe,"E",#bf,-3," ",#ff
db " ",#fe,"Tag",-3," ",#fe,"Un-tag",#ff ;#A6
db "ser number",#c0,#ff ;#A7
db "Total ",#ff ;#A8
db "entries ",#ff ;#A9
db "space ",#ff ;#AA
db "agged ",#ff ;#AB
db "buffer ",#ff ;#AC
db "rive ",#ff ;#AD
db "ormat",#ff ;#AE
db "erify",#ff ;#AF
db #ae,"ting",#ff ;#B0
db "ead only",#ff ;#B1
db "Used ",#ff ;#B2
db "Free ",#ff ;#B3
db "iles",#ff ;#B4
db "isc ",#ff ;#B5
db "d",#b5,#ff ;#B6
db #b6,#cb,#ff ;#B7
db " ",#cb,#ff ;#B8
db "rror",#ff ;#B9
db "ress any key",#ff ;#BA
db "ing track",#c0,#ff ;#BB
db ": 0K",#ff ;#BC
db "ename ",#ff ;#BD
db "irectory ",#ff ;#BE
db "rase",#ff ;#BF
db " : ",#ff ;#C0
db "- Ok",-3," ",#ff ;#C1
db "ROMDOS D",#ff ;#C2
db "SYSTEM ",#ff ;#C3
db "DATA ",#ff ;#C4
db "IBM ",#ff ;#C5
db "PARADOS ",#ff ;#C6
db "(S",#cc,#ff ;#C7
db "(D",#cc,#ff ;#C8
db "(S",#cd,#ff ;#C9
db "(D",#cd,#ff ;#CA
db "to ",#ff ;#CB
db "S 40)",#ff ;#CC
db "S 80)",#ff ;#CD
db "setup ",#ff ;#CE
db "onfigure ",#ff ;#CF
db "ULTRAFORM",#ff ;#D0
db "orted)",#ff ;#D1
db "(Y/N)",#c0,#ff ;#D2
db " another ",#b6,#ff ;#D3
.setup
or a
jp nz,#cdc2
ld hl,showcurs
ld de,cursdisp
ld bc,endcurs-showcurs
ldir
call #b912
ld hl,cursdisp+3
ld (hl),a
dec hl
ld c,0
jp #bd16
.begun
ld iy,#ac00
ld (iy+0),#ff
ld hl,ramlist2
ld de,ramlist
ld bc,#7fc0
ld ix,#62
push hl
.ramcheck
ld a,(hl)
inc hl
or a
jr z,exit1
out (c),a
xor a
ld (#4000),a
jr ramcheck
.exit1
pop hl
ld a,(hl)
inc hl
or a
jr z,exit2
out (c),a
ld a,(#4000)
or a
jr nz,exit1+1
cpl
ld (#4000),a
dec hl
ld a,(hl)
ld (de),a
inc hl
inc de
push bc
ld bc,#40
add ix,bc
pop bc
jr exit1+1
.exit2
xor a
ld (de),a
out (c),c
ld e,a
db #dd:ld a,h
db #dd:ld d,l
ld (buftot),de
ld (buftot+2),a
ld hl,initfs
ld de,fspec
ld bc,14+13+4+4+1+3+2
ldir
call cprint
db 4,2,29,13,13,28,-3,32,28,1,13,13,14,1,15,0
db 26,0,79,0,1,12
db 26,0,79,24,24,12,#ff
ld de,#c002
call dprint
db "PARADOS - Version 1.1 ",#a4
db "1997 QUANTUM Solutions. Program by Richard Wilson.",0
.UnLogDsk
ld sp,#c000
call clmain
ld hl,0
ld (lastf),hl
ld (ftagged),hl
ld de,#c0a0
ld a,#ff
ld (fspec),a
ld c,a
call fprint
db #96,-23,#9a,#9e,-22,#9a,#9c,#ff
ld b,20
.pllop
push bc
call fprint
db #95,-23,0,#95,-22," ",#95,#ff
pop bc
djnz pllop
call fprint
db #93,-23,#9a,#9b,-22,#9a,#99,#ff
inc c
ld de,#c129
call fprint
db -5," Information",-6," ",#ff
dec c
ld e,#c9
call fprint
db "D",#ad,#c0,#ff
ld de,#c219
call fprint
db "F",#ae,#c0,#ff
ld e,#69
call fprint
db "User",-3," :",#ff
ld e,#b9
call fprint
db "F",#b4," ",#c0,#ff
ld de,#c359
call fprint
db "No. of f",#b4," ",#c0,#ff
ld e,#a9
call fprint
db #b2,#a9,#c0,#ff
ld e,#f9
call fprint
db #a8,#a9,":",#ff
ld de,#c499
call fprint
db #b3,#aa," ",#bc,#ff
ld e,#e9
call fprint
db #b2,#aa," ",#bc,#ff
ld de,#c539
call fprint
db #a8,#aa," ",#bc,#ff
ld e,#d9
call fprint
db "T",#ab,"f",#b4," ",#c0,#ff
ld de,#c629
call fprint
db "T",#ab,#aa,#bc,#ff
ld e,#c9
call fprint
db #b3,#ac," ",#bc,#ff
ld de,#c719
call fprint
db #a8,#ac,#bc,#ff
ld h,1
call setbuff
.keyloop2
ld a,#ff
ld (keystate),a
call status
.keyloop3
call cursor
.keyloop
call #bb1b
push af
ld a,23
call #bb1e
ld hl,klist2
ld a,2
jr nz,pressed
ld a,21
call #bb1e
ld hl,klist1
ld a,1
jr nz,pressed
ld hl,klist0
xor a
.pressed
push hl
call showmenu
pop hl
pop af
jr nc,keyloop
call upper
ld b,a
.ktloop
ld a,(hl)
inc hl
or a
jr z,testud
cp b
jr z,pressed2
inc hl
inc hl
jr ktloop
.pressed2
call cursor2
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
ld (stack),sp
call #1e
.cont
ld sp,(stack)
jr keyloop2
.testud
xor a
call #bb1e
jr nz,goup
ld a,2
call #bb1e
jr z,keyloop
call cursor3
.godown
ld bc,#213
call cpbchl
jr nz,notscru
call first
ld bc,60
add hl,bc
call checkhl
jr c,setcurs+3
call mainw
db 31,1,21,10,24,#ff
ld hl,firstf
inc (hl)
call first
ld de,#c6e1
add 19
.showem
ld l,a
call showf
inc de
call showf
inc de
call showf
jr setcurs+3
.notscru
ld a,d
cp h
jr nz,notr1
ld a,l
cp e
jr z,setcurs+3
.notr1
ld a,l
inc a
ld l,a
cp 20
jr nz,setcurs
ld l,0
inc h
.setcurs
ld (curpos),hl
jp keyloop3
.goup
call cursor3
ld a,h
or l
jr nz,notscrd
ld hl,firstf
ld a,(hl)
or a
jr z,setcurs+3
dec (hl)
call mainw
db 11,10,24,#ff
call first
ld de,#c0f1
jr showem
.notscrd
ld a,l
dec l
or a
jr nz,setcurs
ld l,19
dec h
jr setcurs
.mainw
call cprint
db 26,1,55,3,22,24,#ff
jp cprint
.cursor3
call cursor
ld hl,(curpos)
ld de,(maxcp)
ret
.cursor2
push hl
call cursor
.ret0
pop hl
xor a
ret
.status
ld c,#ff
ld de,#c269+8
ld a,(fspec+1)
or a
jr z,showdecu
call fprint
db "All",#ff
jr notdecu
.showdecu
ld a,(fspec+2)
call dec3a
.notdecu
ld de,#c2b9+8
ld hl,fspec2
call fprint2
ld de,#c1c9+8
ld a,(fspec)
inc a
ret z
add 64
call fastch
call fprint
db ": (",#ff
ld a,(issort)
or a
jr z,itssort
call fprint
db "Un-s",#d1,#ff
jr notsort
.itssort
call fprint
db "S",#d1,#fd," ",#ff
.notsort
ld de,#c219+8
ld hl,(formdesc)
call fprint2
.nochar
ld h,#2f
call pad
ld de,#c359+15
ld hl,(files)
call dec3
ld de,#c3a9+15
ld hl,(entries)
call dec3
ld de,#c3f9+15
ld a,(dire)
ld l,a
ld h,0
inc hl
call dec3
ld hl,(totalk)
push hl
ld de,(kused)
or a
sbc hl,de
ld de,#c499+15
call dec3
pop hl
ld de,#c539+15
call dec3
ld hl,(kused)
ld de,#c4e9+15
call dec3
call showt
push iy
ld iy,#ff
ld de,#c0f1
call first
.lpshowf
call checkhl
jr c,nofs
push hl
call showf2
db #fd:inc l
db #fd:ld a,l
cp 20
jr nz,norow
db #fd:inc h
db #fd:ld l,0
.norow
call nxfline
jr c,enddisp
.trynext
pop hl
inc hl
jr lpshowf
.enddisp
pop hl
jr anymore
.nofs
push de
ld c,0
call fprint
db -17," ",#ff
pop de
call nxfline
jr nc,nofs
.anymore
ld (maxcp),iy
pop iy
ret
.showf
push hl
call showf2
ld hl,17
add hl,de
ex de,hl
pop hl
ld a,l
add 20
ld l,a
ret
.cshow
call coffset
pop bc
push hl
push bc
.showf3 ;HL points to file number
ld l,(hl)
db #dd:ld l,#ff
xor a
jr showf4
.showf2
db #dd:ld l,#00
ld l,(hl)
ld h,dalloch
ld a,(hl)
.showf4
push de
push af
call faddr
call pfile
pop af
and #40
ld a,32
jr z,usespc
ld a,"*"
.usespc
call fastch
pop de
ret
.showt
ld de,#c5d9+15
ld hl,(ftagged)
call dec3
ld de,#c629+15
ld hl,(ktagged)
jp dec3
.first
ld a,(firstf)
ld l,a
ld h,sortedh
ret
.showcurs
jr showcrs2
ld c,7
push bc
ld h,b
call #bcce
pop bc
call #b90f
jp begun
.showcrs2
call #b903
.xorlp2
push bc
push hl
.xorlp
ld a,(hl)
cpl
ld (hl),a
inc hl
djnz xorlp
pop hl
ld a,h
add 8
ld h,a
pop bc
jr nc,xorlp2
ld a,l:add #50:ld l,a
ld a,h:adc #c0:ld h,a
dec c
jr nz,xorlp2
jp #b900
.endcurs
.nxfline ;Carry set if at last pos
ld hl,#50
add hl,de
ld bc,#c730
call cpbchl
jr nc,nline
ld bc,#f9d2
add hl,bc
ld bc,#c120
call cpbchl
.nline
ex de,hl
ret
.pfile ;Displays filename of file at HL
push hl
ld l,(hl)
ld h,0
db #dd:ld h,#20
call dec3b
ld a,":"
call fastch
pop hl
inc hl
ld b,8
call pmask
ld a,"."
call fastch
ld b,3
.pmask
ld a,(hl)
inc hl
push bc
bit 7,a
jr z,b7i0
ld c,#ff
.b7i0
and #7f
call fastch
pop bc
djnz pmask
ret
.checkhl2
ld bc,(lastf2)
jp cpbchl
.checkhl
ld bc,(lastf)
.cpbchl
ld a,b
sub h
ret nz
ld a,c
sub l
ret
.showmenu
ld b,a
ld a,(keystate)
cp b
ret z
ld a,b
ld (keystate),a
or a
jr nz,notmain
call setcff
db "MAIN",#ff
call showmen
db #a5,#fe,"F",#b4,"pec",-3," ",#fe,"Move",-3," ",#fe,"R",#bd,#a6," ",#ff
ret
.klist0
db "A":dw SAttrib
db "C":dw SCopy
db "E":dw SErase
db "F":dw Filespec
db "M":dw SMove
db "R":dw Rename
db "T":dw STag
db "U":dw SUntag
db 0
.notmain
dec a
jr nz,notshft
call setcff
db "SHIFT",#ff
call showmen
db #fe,"Backup",-3," ",#fe,"C",#cf," ",#fe,"F",#ae,-3," ",#fe,"Log "
db #b6," ",#fe,"Sort",-3," ",#fe,"Un-log ",#b6," ",#fe,"V",#af,#ff
ret
.klist1
db "B":dw Backup
db "C":dw Configure
db "F":dw Format
db "L":dw Logdisc
db "S":dw SortFiles
db "U":dw UnLogDsk
db "V":dw DVerify
db 0
.notshft
call setcff
db "CONTROL",#ff
call showmen
db #a5,#fe,"Move ",#a6,-19," ",#ff
ret
.klist2
db "A"-64:dw MAttrib
db "C"-64:dw MCopy
db "E"-64:dw MErase
db "M"-64:dw MMove
db "T"-64:dw MTag
db "U"-64:dw MUntag
db 0
.dprint
call #b906
pop hl
ld a,(hl)
inc hl
push hl
or a
jp z,#b909
call dheight
jr dprint+3
.dheight
ld h,7
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld c,8
push de
.chrloop
ld a,(hl)
cpl
ld (de),a
ld a,d
add c
ld d,a
ld a,(hl)
cpl
ld (de),a
inc hl
ld a,d
add c
jr nc,noadd
ld a,e
cp #50
jr nc,last
add #50
ld e,a
ld a,d
adc #c8
.noadd
ld d,a
jr chrloop
.last
pop de
inc de
ret
.showmen
call fprint
db #c0,#ff
.fprint
ex (sp),hl
call fprint2
ex (sp),hl
ret
.getkey
call #bb8a
call #bb18
push af
call #bb8a
pop af
ret
.getukey
call getkey
jp upper
.getdrive
call getukey
cp #fc
jp z,cont
cp "A"
jr c,getdrive
cp "C"
jr nc,getdrive
call #bb5a
sub "A"
ret
.coffset
ld hl,(curpos)
ld a,h
add a
add a
add h ;*5
add a
add a ;*20
add l
ld l,a
ld a,(firstf)
add l
ld l,a
ld h,sortedh ;HL=sorted+cursor offset
ret
.findsame ;Finds entry A from sortedx
ld bc,#100
ld hl,sortedx
cpir
dec hl
ret ;Returns with Z set if found
.attmes
call mestop
db "Set ",#ff
ret
.SAttrib
call clastf
call attmes
call cshow
ld e,#95
call getatt
ld (attset),hl
pop hl
ret c
call forone
jp writedir
.MAttrib
call ctagged
call attmes
call alltag
call getatt
ret c
ld (attset),hl
call fortagged
jp writedir
.attf
push hl
ld l,e
call faddr
ld bc,(attset)
ld a,l
add c
ld l,a
ld a,(hl)
and #7f
or b
ld (hl),a
pop hl
ret
.copyf
ld (rfptr),hl
push hl
ld l,e
call faddr
ld (rfname),hl
push hl
ld a,(doit)
or a
jr nz,notbeg
call showrf
ld hl,16
ld (blkoff),hl
xor a
.notbeg
ld hl,(crsect)
ld (hl),a
ld a,#ff
ld (doit),a
inc h:inc h
ld (recaddr),hl
xor a
ld (sectoff),a
ld bc,5
call testfree
pop ix
ld a,(exmsk)
and (ix+12) ;Number of 16K blocks
ld d,a
xor a
srl d
rra
add (ix+15) ;Number of 128 byte blocks
ld e,a
jr nc,noih
inc d ;Actual number of 128 byte blocks
.noih
push de
ld hl,(crsect)
ld l,4
ld (hl),d
dec hl
ld (hl),e
dec hl
ld de,(rfptr)
ld (hl),d
dec hl
ld (hl),e
dec hl
ld bc,5
call wbuff
pop bc
.rdloop
push bc
ld bc,#80
push bc
call testfree
ld hl,(recaddr)
ld a,(crsect+1)
add 2
sub h
jr nz,notfbu
or l
jr nz,notfbu
ld a,(sectoff)
or a
jr nz,notfstsc
ld hl,(rfname) ;First sector in block
ld bc,(blkoff)
add hl,bc
ld e,(hl)
inc hl
inc c
ld d,b
ld a,(dsm+1)
or a
jr z,gotdev
ld d,(hl)
inc c
.gotdev
ld a,c
and #df
or #10
ld (blkoff),a
ex de,hl ;Now HL=block number
ld a,(fspec)
call getblk
ld (trksec),hl
.notfstsc
ld hl,(trksec)
push hl
ld c,h
ld d,l
ld hl,(crsect)
ld (recaddr),hl
ld a,(fspec)
ld e,a
call #c666 ;Read one sector
pop bc
ld hl,sectoff
call nextsec
ld (trksec),bc
.notfbu
pop bc
push bc
ld hl,(recaddr)
push hl
call wbuff
pop hl
pop bc
add hl,bc
ld (recaddr),hl
pop bc
dec bc
ld a,b
or c
jp nz,rdloop
pop hl
ret
.nextsec
inc b
ld a,(sect3)
cp b
jr nz,samet
ld a,(sect2)
ld b,a
inc c
.samet
ld a,(blmsk)
rra:rra:and 15
inc (hl)
and (hl)
ld (hl),a
ret
.tsame
ld a,(formdrv)
ld e,a
ld a,(fspec)
cp e
ret
.inmesd
push de
call insert
db "destination ",#b6,#ff
dec de
ld a,(formdrv)
call indrive2
pop de
ret
.inmess
call tsame
ret nz
call insert
db "source ",#b6,#ff
dec de
ld a,(fspec)
.indrive2
call indrive
.nomen2
push af
call nomen
db #ff
pop af
ret
.testfree
call checkfree
ret nc
call emptycb
.showrf
call setcff
db "Reading ",#ff
ld hl,(rfptr)
jp showf3
.showwf
call setcff
db "Writing ",#ff
ld hl,(wfptr)
jp showf3
.exitcp
ld a,1
ld (wclose),a
.emptycb
call unlog
ld a,(formdrv)
ld e,a
ld a,(dlogged)
or a
jr nz,allog
inc a
ld (dlogged),a
call inmesd ;Insert destination disc
ld a,e
call loga
call dirinf2
ld hl,(ddir)
call rsects
ld (endddir),hl
call unlogd
jr nodmes
.allog
call tsame
call z,inmesd
call relogd
.nodmes
ld hl,(wblks)
ld a,h
or l
jr z,getnewe
call showwf
jp notnewe
.getnewe ;New file entry
call checkused
jp z,exitwr
ld bc,5
ld hl,ffile
call rbuff
call showwf
ld a,(ffile)
or a
jr z,makenew
ld a,(needent)
or a
jr z,setnewe
jr notnewe
.makenew
ld hl,16
ld (wblkof),hl
ld l,h
ld (wsectof),hl
ld (wextent),hl
ld hl,(wfptr)
ld l,(hl)
call faddr
ld (wfloc),hl
ex de,hl ;DE points to filename
ld hl,(ddir)
call find2
jr nz,setnewe
push bc
push de
push hl
call exists
call cprint
db " - Overwrite ",#d2,#ff
call getyn2
call nomen2
pop hl
pop de
pop bc
sub "Y"
ld (writeyn),a
jr nz,isnewe
.erasede
ld (hl),#e5
call contfind
jr z,erasede
call showwf
.setnewe
call getfentry
ld a,h
or l
jp z,dirfull
ld (wrtany),a
ld (needent),a
ld (writeent),hl
ex de,hl
ld hl,(wfloc)
ld bc,12
ldir
ld a,(wextent)
ld (de),a
inc e
ld bc,3+16
call #caaf
.isnewe
ld hl,vbuff
ld (wrecad),hl
.notnewe
ld hl,(wblks)
ld a,h
or l
jp z,getnewe
call checkused
jp z,exitwr
ld hl,(wrecad)
ld bc,#80
call rbuff
ex de,hl
ld hl,(wblks)
dec hl
ld (wblks),hl
ld a,(writeyn)
or a
jr nz,notnewe
ld (wrecad),de
ld a,h
or l
ld hl,vbuff+#200
jr z,writesect
call cphlde
jr nz,noteos
.writesect
ld hl,(wtrksec)
ld a,(wsectof)
or a
jr nz,notnewb
call getfreeb
jp c,diskfull
ld hl,(writeent)
ld bc,(wblkof)
add hl,bc
ld (hl),e
inc hl
inc c
ld a,(dsm+1)
or a
jr z,noputd
ld (hl),d
inc hl
inc c
.noputd
ld a,c
and #df
or #10
ld (wblkof),a
push de
call usedblk
pop hl
ld a,(formdrv)
call getblk
.notnewb
push hl
ld a,(formdrv)
ld e,a
ld d,l
ld c,h
ld hl,vbuff
ld (wrecad),hl
call #c64e
pop bc
ld hl,wsectof
call nextsec
ld (wtrksec),bc
.noteos
ld ix,(writeent)
inc (ix+15)
jp p,notnewe
ld hl,wextent
inc (hl)
ld a,(exmsk)
and (hl)
jr nz,incext
ld hl,(wblks)
ld a,h
or l
jp nz,setnewe
ld (needent),a
jp getnewe
.incext
ld (ix+15),0
inc (ix+12)
jp notnewe
.dirfull
call didrv
db #be,#ff
.diskfull
call didrv
db #b5,#ff
.didrv
ld de,(wfloc)
ld hl,(ddir)
call find2
jr nz,noeyet
.erahalf
ld (hl),#e5
call contfind
jr z,erahalf
.noeyet
call mestop
db "D",#ad,#ff
ld a,(formdrv)
add "A"
call fastch
call fprint
db ": d",#ff
pop hl
call fprint2
call fprint
db "full",#ff
push de
ld a,1
ld (wclose),a
ld (werror),a
.exitwr
ld hl,(endddir)
call setbuff2
ld a,(wclose)
or a
jp z,relogs
ld a,(wrtany)
or a
jr z,nowrtaa
call relogd
ld hl,(ddir)
call wsects
.nowrtaa
ld a,(werror)
or a
jr z,nowerr
pop de
ld c,#ff
call fprint
db " - P",#ba,#ff
call #bb18
.nowerr
ld hl,cont
push hl
ld hl,(crsect)
call setbuff2
.relogs
call inmess ;Insert source disc
call relog
jp dirinf
.getfreeb ;No carry if free block
ld hl,formbuff
ld b,#60
ld a,#ff
.findfre
cp (hl)
jr nz,fndfre
inc hl
djnz findfre
.fndfre
ld a,(hl)
ld h,0
add hl,hl
add hl,hl
add hl,hl
dec l
.getfrel
inc l
rla
jr c,getfrel
ex de,hl
ld hl,(dsm)
.cphlde
ld a,h
sub d
ret nz
ld a,l
sub e
ret
.getfentry
ld de,formbuff+1 ;Create block allocation map, and find free entry
ld bc,#5f
call #caaf
ld a,(formdrv)
ld e,a
ld a,#9
call #ca5c
ld (formbuff),a ;Allocate directory blocks
ld ix,(endddir) ;For each directory entry
ld hl,0
ld a,(dire)
inc a
ld b,a
.allclp
ld de,-32
add ix,de
ld a,(ix)
cp #e5
jr z,skipit
push bc
push ix
ex (sp),hl
ld bc,16
add hl,bc
.nextalb
ld e,(hl)
inc hl
ld a,(dsm+1)
or a
jr z,setdvl
ld a,(hl)
inc hl
.setdvl
ld d,a
call usedblk
bit 4,l
jr nz,nextalb
pop hl
pop bc
jr conallc
.skipit
push ix
pop hl
.conallc
djnz allclp
ret
.usedblk
push hl
ld hl,(dsm)
call cphlde
pop hl
ret c
ld a,e
and 7
inc a
ld b,a
srl d:rr e
srl e:srl e
ld d,formbuff/256
ld a,1
.rcalp
rrca
djnz rcalp
ex de,hl
or (hl)
ld (hl),a
ex de,hl
ret
.getcdrive
call fprint
db #b8,"d",#ad,": ",#ff
call getcdrive2
call nomen2
call initcb
xor a
ld (dlogged),a
ld (wclose),a
ld (werror),a
ld (wrtany),a
ld h,a
ld l,a
ld (wblks),hl
ld de,copyf
ret
.getcdrive2
call getdrive
ld (formdrv),a
ret
.SCopy
call clastf
call copmess
call cshow
ld e,#96
call getcdrive
pop hl
call forone
jp exitcp
.MCopy
call ctagged
call copmess
call alltag
call getcdrive
call fortagged
jp exitcp
.mestop
call nomen2
.setcff
ld c,#ff
ld de,#c781
jp fprint
.copmess
call nomen
db 31,35,1,#ff
call setcff
db "Copy ",#ff
ret