8-Bit Software Online Conversion
:2.$.DTOA - Listing
10REM ADFTFR for transferring files o
n DFS discs to ADFS
20REM based on AMCOM/ADFS transfer pr
ograms
30REM by H.L.Clarke and S.B.Yeo
40REM (C) 1991
50MODE 7:HIMEM=&7000
60PROCtitle
70READ fparm,fbuff,ftrack,fsec,secnum
s,fresult,faddr,pparms,putdata,putlength
,pointer,cstring
80OSWRCH=&FFEE:OSNEWL=&FFE7:OSWORD=&F
FF1:OSGBPB=&FFD1:OSFIND=&FFCE:oscli=&FFF
7:U%=PAGE+&1800:V%=&7600:W%=V%-U%
90PROCcode
100CHAIN"DTOA2"
10000DEFPROCcode
10010FOR pass%=0 TO 2 STEP 2
10020P%=V%
10030[OPT pass%
10040.centry:JSR transfer½sets up parame
ters for loading DFS file
10050LDA &7BE6
10060ROR A:ROR A:ROR A:ROR A
10070AND #3:STA &7B86
10080LDA #0:STA &7B82:STA &7B83:STA &7B8
7
10090LDA &7BE4:STA &7B84
10100LDA &7BE5:STA &7B85½store file leng
th in !&7B84
10110LDA &7BE6:AND #3
10120STA &7B81
10130LDA &7BE7:STA &7B80
10140RTS
10150½
10160½
10170½
10180½
10190½
10200½
10210½
10220½
10230½
10240½
10250.transfer:STX &70:STY &71:LDY #0½tr
ansfers catalogue filename entry for DFS
file to &7BE8 onwards
10260.tstring:LDA (&70),Y
10270STA &7BE8,Y
10280INY
10290CPY #8
10300BNE tstring
10310STA &7BFF:LDA #&20:STA &7BEF½DFS di
rectory in &7BFF
10320.tcr:LDX #8
10330.tcrloop:LDA &7BE0,X:CMP #&20
10340BEQ crin:BCC bn
10350INX:JMP tcrloop
10360.crin:LDA #&0D:STA &7BE0,X
10370INC &71:LDY #0½transfers catalogue
address entry for DFS file to &7BE0 onwa
rds
10380.taddr:LDA (&70),Y
10390STA &7BE0,Y
10400INY
10410CPY #8
10420BNE taddr
10430RTS
10440.bn:BRK
10450OPT FNerror(&83,"Illegal filename")
10460½
10470BRK
10480NOP:NOP
10490NOP:NOP:NOP
10500½
10510½
10520.name:JSR transfer½updates list of
DFS directories
10530LDX &7B7A
10540LDA &7BFF:AND #&7F
10550STA &7B90,X
10560RTS
10570½
10580.secread:LDA #&79:STA fbuff+1½loads
DFS catalogue to &7900
10590LDA #&22:STA secnums
10600LDA #0:STA fbuff:STA fbuff+2:STA fb
uff+3
10610STA ftrack:STA fsec
10620½
10630½
10640LDA #&7F½function
10650LDX faddr:LDY faddr+1½point X and Y
@ fparm
10660JSR OSWORD
10670LDA fresult:BNE re
10680LDA &7A05:ROR A:ROR A:ROR A
10690STA &7B90½number of DFS files store
d in &7B90
10700RTS
10710½
10720½
10730.re:BRK
10740OPT FNerror(&82,"Can't read catalog
ue")
10750BRK
10760½
10770½
10780.long:LDA fsec:CLC:ADC &7B1E½sets u
p 'ftrack' and 'fsec' for loading long f
ile by 'stload'
10790CMP #&0A:BNE sametr
10800INC ftrack:LDA #0
10810.sametr:STA fsec
10820.stload:LDA &7B85:STA &7B20½main lo
ading routine
10830LDA &7B86:STA &7B21
10840½
10850LDA #0:STA &7BFA½last load marker f
lag
10860LDA &7B84:BEQ noadd
10870LDA &7B20:CLC:ADC #1:STA &7B20
10880LDA &7B21:ADC #0:STA &7B21
10890½
10900.noadd:LDA #&0A:SEC:SBC fsec:STA &7
B24
10910½
10920.check:LDA &7B21:BNE morethan
10930LDA &7B24:CMP &7B20:BCS lessthan
10940.morethan:LDA &7B24:STA &7B1E:CLC:A
DC #&20:STA secnums
10950LDA &7B20:SEC:SBC &7B24:STA &7B20
10960LDA &7B21:SBC #0:STA &7B21
10970JMP opn
10980.lessthan:LDA &7B20:STA &7B1E:CLC:A
DC #&20:STA secnums:STA &7BFA
10990.opn:LDA #&7F:LDX faddr:LDY faddr+1
:JSR OSWORD
11000LDA &7BFA:BNE endfile½last load mar
ker set
11010LDA #0:STA fsec:INC ftrack
11020LDA fbuff+1:CLC:ADC &7B1E:STA fbuff
+1
11030LDA #&0A:STA &7B24:JMP check
11040.endfile:RTS
11050½
11060½
11070½
11080½
11090½
11100½
11110½
11120½
11130½
11140.subd:STA &7B29:LDA #0:STA &7BD0½ma
kes list of ADFS sub-directories to be c
reated
11150.subloop:STX &72:LDA &7B90,X:CMP #&
24:BEQ s2
11160AND #&5F:STA &7B78:LDA &7BD0:BEQ no
tere
11170LDX #1
11180.nsloop:LDA &7BD0,X:CMP &7B78:BEQ s
3
11190CPX &7BD0:BEQ notere
11200INX:JMP nsloop
11210.notere:INC &7BD0:LDX &7BD0
11220LDA &7B78:STA &7BD0,X
11230.s3:LDX &72
11240.s2:CPX &7B29:BEQ endsub
11250INX:JMP subloop
11260.endsub RTS
11270½
11280½
11290.title:LDX #0½prints title of DFS d
isc
11300.first:LDA &7900,X:JSR OSWRCH:INX:C
PX #8:BNE first
11310LDX #0
11320.second:LDA &7A00,X:JSR OSWRCH:INX:
CPX #4:BNE second
11330JSR OSNEWL:JSR OSNEWL:RTS
11340½
11350½
11360½
11370½
11380½
11390.command:LDX #(cstring MOD 256):LDY
#(cstring DIV 256)
11400JSR oscli
11410RTS
11420½
11430½
11440.putbyte:LDA #&C0:LDX #&60:LDY #&7B
½save second or later part of long file
to ADFS disc
11450JSR OSFIND½open file for random acc
ess
11460BNE fileok
11470LDA #&FE:STA fresult:RTS
11480.fileok:STA pparms
11490LDX #(pparms MOD 256):LDY #(pparms
DIV 256)
11500LDA #1:JSR OSGBPB
11510LDA #0:LDY #0:JSR OSFIND
11520RTS
11530½
11540]
11550NEXT
11560ENDPROC
11570DEFPROCtitle
11580VDU31,0,3
11590PROCband
11600PRINT''''
11610FOR N%=0 TO 1
11620PRINTCHR$(131);CHR$(141);STRING$(10
," ");"DFS to ADFS"
11630NEXT
11640PRINT''''
11650FOR N%=0 TO 1
11660PRINTCHR$(131);CHR$(141);STRING$(12
," ");"transfer"
11670NEXT
11680PRINT''''
11690PROCband
11700ENDPROC
11710DEFPROCband
11720FOR N%=0 TO 1
11730PRINTCHR$(150);CHR$(154);CHR$(157);
CHR$(147);STRING$(30,CHR$(255));" ";CHR
$(156)
11740NEXT
11750ENDPROC
15000DEFFNerror(err,err$)
15010?P%=err
15020P%=P%+1
15030$P%=err$
15040P%=P%+LEN(err$)
15050=pass%
20000DATA &7B10,&7B11,&7B17,&7B18,&7B19,
&7B1A,&7B1B,&7B2A,&7B2B,&7B2F,&7B33,&78D
0