8-Bit Software Online Conversion

Amcom to ADFS Transfer - Listing

10REM AMCOM for transferring files on Amcom discs to ADFS 20REM by H.L.Clarke and S.B.Yeo 30REM (C) 1991 40MODE 7:HIMEM=&7000 50PROCtitle 60READ fparm,fbuff,ftrack,fsec,secnum s,fresult,faddr,pparms,putdata,putlength ,pointer,cstring 70OSWRCH=&FFEE:OSNEWL=&FFE7:OSWORD=&F FF1:OSGBPB=&FFD1:OSFIND=&FFCE:oscli=&FFF 7:!&7B08=0:U%=PAGE+&1A00:V%=&7000:W%=V%- U% 80PROCcode 90CHAIN"AMCOM2" 10000DEFPROCcode 10010FOR pass%=0 TO 2 STEP 2 10020P%=V% 10030[OPT pass% 10040.centry:JSR transfer½sets up parame ters for loading Amcom 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 entry for Amcom file t o &7BE0 onwards 10260.tstring:LDA (&70),Y 10270STA &7BE0,Y 10280INY 10290CPY #&18 10300BNE tstring 10310STA &7BFF:LDA #&20:STA &7BF7½Amcom directory 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 10370RTS 10380.bn:BRK 10390OPT FNerror(&83,"Illegal filename") 10400½ 10410BRK 10420NOP:NOP 10430NOP:NOP:NOP 10440½ 10450½ 10460.name:JSR transfer½updates list of Amcom directories 10470LDX &7B7A 10480LDA &7BFF:AND #&7F 10490STA &7B90,X:STX &7B90 10500LDY #&28:LDA (&70),Y 10510STA &7BF9 10520RTS 10530½ 10540.secread:LDA #&73:STA fbuff+1½loads Amcom catalogue to &7300 10550LDA #&28:STA secnums 10560LDA #0:STA fbuff:STA fbuff+2:STA fb uff+3 10570STA ftrack:STA fsec 10580½ 10590½ 10600LDA #&7F½function 10610LDX faddr:LDY faddr+1½point X and Y @ fparm 10620JSR OSWORD 10630LDA fresult:BNE re 10640LDA &7300 10650BPL wrong 10660RTS 10670.wrong BRK 10680OPT FNerror(&81,"Not an Amcom disc" ) 10690½ 10700.re:BRK 10710OPT FNerror(&82,"Can't read catalog ue") 10720½ 10730BRK 10740½ 10750.long:LDA fsec:CLC:ADC &7B1E½sets u p 'ftrack' and 'fsec' for loading long f ile by 'stload' 10760CMP #&0A:BNE sametr 10770INC ftrack:LDA #0 10780.sametr:STA fsec 10790.stload:LDA &7B85:STA &7B20½main lo ading routine 10800LDA &7B86:STA &7B21 10810½ 10820LDA #0:STA &7BFA½last load marker f lag 10830LDA &7B84:BEQ noadd 10840LDA &7B20:CLC:ADC #1:STA &7B20 10850LDA &7B21:ADC #0:STA &7B21 10860½ 10870.noadd:LDA #&0A:SEC:SBC fsec:STA &7 B24 10880½ 10890.check:LDA &7B21:BNE morethan 10900LDA &7B24:CMP &7B20:BCS lessthan 10910.morethan:LDA &7B24:STA &7B1E:CLC:A DC #&20:STA secnums 10920LDA &7B20:SEC:SBC &7B24:STA &7B20 10930LDA &7B21:SBC #0:STA &7B21 10940JMP opn 10950.lessthan:LDA &7B20:STA &7B1E:CLC:A DC #&20:STA secnums:STA &7BFA 10960.opn:LDA #&7F:LDX faddr:LDY faddr+1 :JSR OSWORD 10970LDA &7BFA:BNE endfile½last load mar ker set 10980LDA #0:STA fsec:INC ftrack 10990LDA fbuff+1:CLC:ADC &7B1E:STA fbuff +1 11000LDA #&0A:STA &7B24:JMP check 11010.endfile:RTS 11020½ 11030½ 11040½ 11050½ 11060½ 11070.ecomp:LDX #0½takes filename+direct ory from E% loop, ANDs with &5F 11080.ecomploop:LDA &7B60,X 11090AND #&5F:STA &7B60,X 11100INX:CPX #11:BNE ecomploop 11110LDX &7B7A:LDA &7B90,X 11120AND #&5F:STA &7B78 11130RTS 11140½ 11150½ 11160.fcomp:LDX #0½takes filename+direct ory from F% loop, ANDs with &5F, and com pares with result of 'ecomp' 11170.fcomploop:LDA &7B6C,X 11180AND #&5F:STA &7B6C,X 11190INX:CPX #11:BNE fcomploop 11200LDX &7B7B:LDA &7B90,X 11210AND #&5F:STA &7B79 11220LDX #0 11230.trycomp:LDA &7B60,X:CMP &7B6C,X 11240BNE nomatch:INX 11250CPX &73:BNE trycomp 11260LDA &7B78:CMP &7B79 11270BNE nomatch 11280LDA #&FF:JMP matchmark 11290.nomatch:LDA #0 11300.matchmark:STA &7BF8:RTS 11310½ 11320½ 11330½ 11340½ 11350.subd:STA &7B29:LDA #0:STA &7BD0½ma kes list of ADFS sub-directories to be c reated 11360.subloop:STX &72:LDA &7B90,X:CMP #& 24:BEQ s2 11370AND #&5F:STA &7B78:LDA &7BD0:BEQ no tere 11380LDX #1 11390.nsloop:LDA &7BD0,X:CMP &7B78:BEQ s 3 11400CPX &7BD0:BEQ notere 11410INX:JMP nsloop 11420.notere:INC &7BD0:LDX &7BD0 11430LDA &7B78:STA &7BD0,X 11440.s3:LDX &72 11450.s2:CPX &7B29:BEQ endsub 11460INX:JMP subloop 11470.endsub RTS 11480½ 11490½ 11500.title:LDX #8½prints title of Amcom disc 11510.first:LDA &7300,X:AND #&7F:JSR OSW RCH:INX:CPX #&10:BNE first 11520LDX #0 11530.second:LDA &7300,X:AND #&7F:JSR OS WRCH:INX:CPX #4:BNE second 11540JSR OSNEWL:JSR OSNEWL:RTS 11550½ 11560½ 11570½ 11580½ 11590½ 11600.command:LDX #(cstring MOD 256):LDY #(cstring DIV 256) 11610JSR oscli 11620RTS 11630½ 11640½ 11650.putbyte:LDA #&C0:LDX #&60:LDY #&7B ½save second or later part of long file to ADFS disc 11660JSR OSFIND½open file for random acc ess 11670BNE fileok 11680LDA #&FE:STA fresult:RTS 11690.fileok:STA pparms 11700LDX #(pparms MOD 256):LDY #(pparms DIV 256) 11710LDA #1:JSR OSGBPB 11720LDA #0:LDY #0:JSR OSFIND 11730RTS 11740½ 11750] 11760NEXT 11770ENDPROC 11780DEFPROCtitle 11790VDU31,0,3 11800PROCband 11810PRINT'''' 11820FOR N%=0 TO 1 11830PRINTCHR$(130);CHR$(141);STRING$(12 ," ");"Amcom to" 11840NEXT 11850PRINT'''' 11860FOR N%=0 TO 1 11870PRINTCHR$(130);CHR$(141);STRING$(10 ," ");"ADFS transfer" 11880NEXT 11890PRINT'''' 11900PROCband 11910ENDPROC 11920DEFPROCband 11930FOR N%=0 TO 1 11940PRINTCHR$(145);CHR$(154);CHR$(157); CHR$(146);STRING$(30,CHR$(255));" ";CHR $(156) 11950NEXT 11960ENDPROC 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,&72D 0