Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2345

8-bit acorn software: other • Re: Bad FS Map

$
0
0
Errmmm I can confirm UltraForm does work on a non-ST506 disc cos I just used it and wiped my BBC B CF IDE hard drive!!!!!!! Ooops! Hopefully I had a backup.

A long time ago, I added an "initialise only" option, which just writes the blank catalogue and free space map. At some point in the past it looks like I also REMmed out a mode select before the initialisation, probably to cater for this very situation.

I made a new version earlier on which uses less memory, so it now works on BBC with PAGE at &2200. I've also added an option only to change the interleave, which affects the number of sectors per track you can get, and also to check the geometry doesn't exceed the ADFS limits when a geometry change is made. (That could be a bit annoying though, so I might alter that to only check the geometry just before a format or initialisation).

Here it is:

Code:

  100REM UltraForm2 (Combined Version)  120REM Winchester Disc formatter for Adaptec Controllers  140REM Uses Acorn's Superform as a shell with improvements:  160REM (1) Selectable interleave  180REM (2) Option to format first with no interleave then with selected interleave  200REM (3) Better defect sector translation using values in Adaptec manual  220REM (4) Can cope with discs with more than 128 defects  240REM (5) Maximise disc space by better calculation of available sectors (i.e. doesn't just reserve 128 sectors for defects like Superform)  260REM (6) Continue after errors - helps to cope with SCSI-SD card  280REM Ultraform amendments (C) Ian Wolstenholme 2006-2020  300REM Version 2.10 16/i/2024  320REM BeebSCSI manual fill option removed - delete in next version  330REM Allows buffer% to be reduced back to 1280  340REM Add option K to set interleave only  350REM Check for outsized ADFS geometry  460PROCinit  480MODE7  500FORB%=1TO2  520VDU131,157,132,141  540PRINT"UltraForm Winchester Formatter 2.10"  560NEXT  580VDU131,157,136,132  600PRINT"BEWARE formatting destroys ALL data"  620VDU131,157,132  640PRINT" Escape then Q to quit."  660F%=TRUE  680*DISMOUNT  700*FADFS  720ON ERROR F%=FALSE:VDU 132,157,136,131:PRINT"Disc error when reading drive shape":GOTO1080  740OSCLI"MOUNT "+STR$(drive%)  750X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls  780?X%=0  800X%!1=data%  820X%!5=&1A  840X%!9=22  860A%=&72  880CALL&FFF1  900IF ?X% THEN Cause an error!  920heads%=data%?15  940cyl%=(data%?13)*256+data%?14  960step%=data%?21  980rwcc%=(data%?16)*256+data%?17 1000lz%=data%?20 1020!data%=0 1040ON ERROR PRINT"Error - ";:REPORT:PRINT'"while searching for '$.Format.Defects'":GOTO1260 1060IF OPENIN"$.Format.Defects" THEN CLOSE#0 ELSE VDU 132,157,136,131:PRINT"File '$.Format.Defects' not found.":GOTO1260 1080ON ERROR OFF 1100IFF% ELSE GOTO1260 1120$buffer%="$.Format.Defects" 1140!X%=buffer% 1160X%!2=data% 1180X%!6=0 1200A%=-1 1220CALL&FFDD 1240A%=&72:REM restore for OSWORD calls after OSFILE call //ISW 9/ii/2020 1260VDU28,0,23,39,4 1280PROCmenu 1300ONERRORPROCerror 1320REPEAT 1340PRINT'CHR$(134)+"Action"+CHR$(135)+":"; 1360*FX15,0 1380Z%=GET AND &5F 1400IFZ%=13    :PROCmenu 1420IFZ%=0     :PROCmenu 1440IFZ%=ASC"A":PROCadd_sector_numbers 1460IFZ%=ASC"B":PROCadd_cyl_head_bytes 1480IFZ%=ASC"F":PROCformat_the_disc:Z%=INKEY(100):Z%=0:*FX15,0 1500IFZ%=ASC"L":PRINT"List current parameters":PROClistparams 1520IFZ%=ASC"Q":PROCquit 1540IFZ%=ASC"S":PROCsave_defect_list 1560IFZ%=ASC"T":PROCtype_defect_list 1580IFZ%=ASC"C":PROCchange_attributes:F%=TRUE:REM Jump to mode sense removed 'cos overrides new settings just entered! //ISW 15/i/2011 1590IFZ%=ASC"D":PROCchange_drive:GOTO740 1600IFZ%=ASC"V":PRINT"Verify disc":PROCdoverify 1620IFZ%=ASC"I":PROCdoinit 1640IFZ%=ASC"M"PROCmfm:PROCcheckgeom 1660IFZ%=ASC"R"PROCrll:PROCcheckgeom 1665IFZ%=ASC"K"PRINT:PROCgetinterleave:PROCinterleave(T%):PROCcheckgeom 1670REMIFZ%=ASC"X"PROCtogglefill 1680UNTILFALSE 1700DEFPROCmenu 1720PRINT'"Options are:"' 1740PRINT"A - Add defects as sector numbers" 1760PRINT"B - Add defects as Cyl, Head, Bytes" 1780PRINT"C - Change the format parameters" 1790PRINT"D - Change drive number" 1795PRINT"K - Set interleave" 1800PRINT"L - List current format parameters" 1820PRINT"M - Select MFM controller"'"R - Select RLL controller" 1840PRINT"F - Format(destroy all data - beware)!" 1860PRINT"V - Verify disc" 1880PRINT"I - Initialise disc" 1900PRINT"S - Save an updated defect list" 1920PRINT"T - Type the defect list" 1930REMIFFNBeebSCSI PRINT"X - Toggle manual fill after format" 1940PRINT'"Q - Quit" 1960ENDPROC 1980DEFPROCinit 2000@%=4 2020heads%=4 2040cyl%=615 2060step%=2:REM amended to 2 for fastest rate //ISW 16/i/2011 2080rwcc%=128 2100lz%=0 2120drive%=0 2140IFM%<>TRUE AND M%<>0 M%=FALSE:REM MFM Flag; keep previous value if valid //ISW 10/iii/12 2160IFM% spt%=33 ELSEspt%=47 2180vblocks%=&2000:REM number of blocks per verify op 2200IFT%<1ORT%>spt% T%=5:REM interleave; keep previous value if valid //ISW 10/iii/2012 2220PROCinterleave(T%) 2240V%=1:REM counter for number of formats.  Set V=0 to format with interleave=1 on first format (recommended in Adaptec manual) then with i/leave=T% on reformats, or V%>0 for format always with i/leave of T% //ISW 6/i/07 2260fpos%=0:lpos%=0:byte%=0:REM Declare earlier than DIMs to stop DIM overflow deleting variables  //ISW 9/ii/2014 2270dofill%=FALSE 2280DIM X% 20:x%=X%:REM //ISW Keep track of OS block X% 4/v/2020 2300Y%=X% DIV256 2320DIM data% 2048:REM only 1044 needed 2340FORB%=0TO2044STEP4:data%!B%=0:NEXT 2360DIM buffer% 1296:REM Buffer, 1280 needed, plus overflow for safety 2380buffer0%=buffer% 2400buffer1%=buffer%+1 2420buffer2%=buffer%+2 2440buffer3%=buffer%+3 2460buffer4%=buffer%+4 2480buffer5%=buffer%+5 2500buffer6%=buffer%+6 2520buffer7%=buffer%+7 2540DIM osblock 16,result 16:REM for BSCSI detect 2560IFFNBeebSCSI E%=0 ELSE E%=8:REM no of error sectors to reserve 2580ENDPROC 2600DEFPROCadd_sector_numbers 2620PRINT"Add sectors"' 2640K%=-8 2660REPEAT 2680K%=K%+8 2700INPUT"Sector ? "A$ 2720IFA$=""ELSEbuffer%!K%=EVALA$ 2740IFK%>1023 PRINT"Buffer full":A$="" 2760UNTILA$="" 2780IFK% ELSE ENDPROC 2800PRINT'"Bad sectors are -" 2820VDU14 2840FORJ%=0 TO K%-8 STEP 8 2860PRINT" &"~buffer%!J%," = "buffer%!J% 2880NEXT 2900VDU15 2920REPEAT 2940PRINT'"Correct (Y/N) ? "; 2960Z%=GET AND &5F 2980UNTILZ%=ASC"Y" OR Z%=ASC "N" 3000IFZ%=ASC"N":PRINT"No":ENDPROC 3020PRINT"Yes"'"Adding new defects to list" 3040PROCtranslate_buffer(K%) 3060PROCinsert_buffer(K%) 3080PRINTK%/8" new defects added to list."' 3100ENDPROC 3120DEFPROCadd_cyl_head_bytes 3140PRINT"Add defects"' 3160K%=-8 3180REPEAT 3200K%=K%+8 3220INPUTLINE "Head, Cyl, Bytes ? "A$ 3240IFA$=""GOTO3460 3260A$=A$+"," 3280buffer3%?K%=EVALLEFT$(A$,INSTR(A$,",")) 3300B$=MID$(A$,INSTR(A$,",")+1) 3320IFB$="":INPUTLINE"      Cyl, Bytes ? "B$:B$=B$+"," 3340buffer0%!K%=EVALLEFT$(B$,INSTR(B$,","))ORbuffer0%!K%AND&FF000000 3360B$=MID$(B$,INSTR(B$,",")+1) 3380IFB$="":INPUTLINE"           Bytes ? "B$:B$=B$+"," 3400buffer4%!K%=EVALLEFT$(B$,INSTR(B$,",")) 3420IF buffer3%?K%>=heads%:PRINT"Head number too big - entry rejected.":GOTO3220 3440IF(buffer0%!K% AND &FFFFFF)>=cyl%:PRINT"Cylinder too big - entry rejected.":GOTO3220 3460UNTILA$="" 3480IFK% ELSE ENDPROC 3500VDU14 3520PRINT'"Bad areas are -"'"Head  Cylinder   Bytes" 3540FORJ%=0 TO K%-8 STEP 8 3560PRINTbuffer3%?J%TAB(10)buffer0%!J%AND&FFFFFFTAB(18)buffer4%!J% 3580NEXT 3600VDU15 3620REPEAT 3640PRINT'"Correct (Y/N) ? "; 3660Z%=GET AND &5F 3680UNTILZ%=ASC"Y" OR Z%=ASC "N" 3700IFZ%=ASC"N":PRINT"No":ENDPROC 3720PRINT"Yes"'"Adding new defects to list" 3740FORJ%=0TOK%-8 STEP8 3760Z%=buffer2%?J%:buffer2%?J%=buffer0%?J%:buffer0%?J%=Z% 3780Z%=buffer4%?J%:buffer4%?J%=buffer7%?J%:buffer7%?J%=Z% 3800Z%=buffer6%?J%:buffer6%?J%=buffer5%?J%:buffer5%?J%=Z% 3820NEXT 3840PROCinsert_buffer(K%) 3860PRINTK%/8" new defects added to list."' 3880ENDPROC 3900DEFPROCsave_defect_list 3920PRINT"Save defect list"' 3940IFF% ELSE PRINT"Disc not formatted - save impossible":ENDPROC 3960*dir $.Format 3980IF OPENIN"Defects":CLOSE#0:*rename Defects OldDefects 4000$buffer%="Defects" 4020!X%=buffer% 4040X%!2=-1 4060X%!6=0 4080X%!10=data% 4100X%!14=data%+1024 4120A%=0 4140CALL&FFDD 4160PRINT"New Defects file saved." 4180IF OPENIN"OldDefects":CLOSE#0:PRINT"Old Defects file renamed." 4200*back 4220ENDPROC 4240DEFPROCtype_defect_list 4260PRINT"Type defect list"' 4280VDU14 4300PRINT'"Defect list" 4320PRINT"Head   Cylinder    Bytes" 4340N%=data%?2*256+data%?3 4360IFN% ELSEPRINT"No defects in list"':VDU15:ENDPROC 4380FORI%=data%+4 TO data%+N%-4 STEP8 4400PRINTI%?3TAB(10)?I%*&10000+I%?1*256+I%?2TAB(20); 4420PRINT((I%?4*256+I%?5)*256+I%?6)*256+I%?7 4440NEXT 4460PRINTN%/8" defects in list."' 4480VDU15 4500ENDPROC 4520DEFPROCerror 4540VDU15 4560IFERR=17:ENDPROC 4580REPORT 4600PRINT" at line "ERL 4620ENDPROC 4640DEFPROCquit 4660VDU12,26,10,10,10,10,10,10,10,10,13 4680PRINT"Quit" 4700END 4720DEFPROClistparams 4740PRINT 4760PRINT"Current attributes are" 4780PRINT"Drive                 "drive% 4800PRINT"Heads =               "heads% 4820PRINT"Cylinders =           "cyl% 4840PRINT"Step rate code        "step% 4860PRINT"RWCC =                "rwcc% 4880PRINT"Landing zone offset = "lz% 4900PRINT"Interleave =          "T% 4920PRINT"Sectors per track =   "spt% 4940IFM%PRINT"MFM";ELSEPRINT"RLL"; 4960PRINT" Controller" 4970REMIFFNBeebSCSI PRINT"Manual byte fill       ";:IFdofill% PRINT"On" ELSEIFFNBeebSCSI PRINT"Off" 4980PRINT 5000ENDPROC 5020DEFPROCchange_attributes 5040PRINT"Change Format Parameters" 5060PROClistparams 5160PRINT"New attributes -" 5180INPUT"Heads =               "heads% 5200INPUT"Cylinders =           "cyl% 5220INPUT"Step rate code        "step% 5240INPUT"RWCC =                "rwcc% 5260INPUT"Landing zone =        "lz% 5270PROCgetinterleave 5300PROCmfmrll 5320PROCinterleave(T%):REM //ISW 9/i/2011 5340PRINT'"Sectors per track will be : "spt% 5360PRINT 5370PROCcheckgeom 5380PROCmode_select:REM Unsure if desirable as other parm changes do not call this //ISW 16/i/24 5400ENDPROC 5405DEFPROCgetinterleave 5407INPUT"Interleave =          "T% 5409ENDPROC 5420DEFPROCtranslate_buffer(K%) 5440IFK%<>0PRINT"Translating defects..." ELSE ENDPROC:REM //ISW 4/v/2020 ELSE added 5460FORI%=0 TO K%-8 STEP8 5480Q%=buffer%!I% 5500C%=0 5520IF FNtranslate(Q%,buffer%+I%) GOTO5580 5540IFC%>10PRINT"Too many retries - skipping":NEXT:ENDPROC 5560IF((buffer4%?I%*256+buffer5%?I%)*256+buffer6%?I%)*256+buffer7%?I%>maxbfi% OR (buffer%?I%*65536+buffer1%?I%*256+buffer2%?I%)>cyl% PRINT"Translation error - retrying":C%=C%+1:GOTO 5520 ELSENEXT:ENDPROC:REM //ISW 16/iii/11 5580IF FNtranslate(Q%+1,buffer%+I%) THEN GOTO5800 5600R%=((buffer4%?I%*256+buffer5%?I%)*256+buffer6%?I%)*256+buffer7%?I% 5620R%=R%-(U%*W%):REM translate using next sector, add bytes per record (U%) * interleave (W%) for correct calculation of offset //ISW 5/i/07 5640IFR%>maxbfi% OR(buffer%?I%*65536+buffer1%?I%*256+buffer2%?I%)>cyl% ANDC%<10 PRINT"Translation error - retrying":GOTO5580 ELSEPRINT"Too many retries - skipping" 5660IF R%<0 GOTO5800 5680buffer4%?I%=R%DIV&1000000 5700buffer5%?I%=R%DIV&10000 5720buffer6%?I%=R%DIV&100 5740buffer7%?I%=R% 5760NEXT 5780ENDPROC 5800C%=C%+1:IF FNtranslate(Q%-1,buffer%+I%) THEN PRINT"***Translation impossible ",~Q%:STOP 5820R%=((buffer4%?I%*256+buffer5%?I%)*256+buffer6%?I%)*256+buffer7%?I% 5840R%=R%+(U%*W%):REM translate using previous sector, see line 4910 //ISW 5/i/07 5860IFR%>maxbfi% OR(buffer%?I%*65536+buffer1%?I%*256+buffer2%?I%)>cyl% ANDC%<10 PRINT"Translation error - retrying":GOTO5800 5880GOTO5680 5900DEFFNtranslate(sector%,address%) 5910X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 5920?X%=0 5940X%!1=address% 5960X%?5=&F 5980X%?6=drive%*&20+sector%DIV&10000 6000X%?7=sector%DIV&100 6020X%?8=sector% 6040X%!9=0 6060A%=&72 6080CALL&FFF1 6100IFK%<>0PRINT"Sec &";~sector%;" =";TAB(13)"Cyl ";(?address%*65536+address%?1*256+address%?2);TAB(21)"Head ";address%?3;" BFI ";address%?4*16777216+address%?5*65536+address%?6*256+address%?7:REM //ISW 9/i/2011 6120=?X% 6140DEFPROCinsert_buffer(K%) 6160IFK% ELSE ENDPROC 6180N%=data%?3+data%?2*256 6200FORJ%=buffer% TO buffer%+K%-8 STEP8 6220fpos%=data%+4 6240lpos%=data%+4+N% 6260FORbyte%=0TO7 6280IF fpos%>=lpos%:byte%=8:NEXT:GOTO6480 6300fpos%=fpos%-8 6320REPEAT 6340fpos%=fpos%+8 6360UNTIL fpos%?byte%>=J%?byte% OR lpos%=fpos% 6380REPEAT 6400lpos%=lpos%-8 6420UNTIL lpos%?byte%<=J%?byte% OR lpos%=fpos%-8 6440lpos%=lpos%+8 6460NEXTbyte% 6480FORI%=data%+N% TO fpos% STEP-4 6500I%!8=!I% 6520NEXT I% 6540N%=N%+8 6560data%?2=N%DIV&100 6580data%?3=N% 6600!fpos%=!J% 6620fpos%!4=J%!4 6640NEXT J% 6660ENDPROC 6680DEFPROCformat_the_disc 6700PRINT"Format"'"Disc will be formatted using current    parameters" 6705PROClistparams:PROCcheckgeom 6720VDU129,157,131,141,136 6740PRINT"Formatting destroys all data" 6760VDU129,157,131,141,136 6780PRINT"Formatting destroys all data" 6800PRINT 6820@%=0 6840IFV%>1 V%=1:REM reset format counter in case more than one drive formatted in same run //ISW 6/x/2018 6860PRINT"You really want to format drive "drive%" ? "; 6880IF(GET AND &5F)=ASC"Y":PRINT"Y";ELSEPRINT'"Aborted"':ENDPROC 6900IF(GET AND &5F)=ASC"E":PRINT"e";ELSEPRINT'"Aborted"':ENDPROC 6920IF(GET AND &5F)=ASC"S":PRINT"s";ELSEPRINT'"Aborted"':ENDPROC 6940IF GET=13 PRINT ELSEPRINT'"Aborted"':ENDPROC 6960INPUT"Fill byte (RETURN for default) ? "A$ 6980IF A$="":fill%=&6C ELSE fill%=EVALA$ 7000REPEAT 7020PROCmode_select 7040PRINT"Formatting attempt number ";V%;" ..."; 7060PROCformat 7070REMIFFNBeebSCSI PROCfilldisc(fill%):REM //ISW 4/v/2020 7080PRINT 7100V%=V%+1:REM increment format counter //ISW 5/i/07 7120PROCdoverify 7140PROCtranslate_buffer(K%):PROCinsert_buffer(K%) 7160IF L% PRINTL%DIV8" defects found."ELSEPRINT"No defects found." 7180UNTILK%=0 7200PROCinitialise 7220ENDPROC 7240DEFPROCinitialise 7260FORI%=buffer% TO buffer%+1279 STEP4 7280!I%=0 7300NEXT 7320N%=data%?2*256+data%?3:REM size of defect list //ISW 29/iii/07 7340!buffer%=7 7360buffer%!252=heads%*cyl%*spt%-E%-(N% DIV8):REM calculate total available sectors by drive geometry less number of bad sectors in defect list less margin of error in E%  //ISW 9/ii/2020 7380buffer%!256=heads%*cyl%*spt%-E%-7-(N% DIV8):REM length of first free space, i.e. as above less 7 sectors for space used by FS map & root //ISW 9/ii/2020 7400buffer%!507=RND 7420buffer%!509=&300 7440P%=buffer%+1000 7460[ OPT2 7480CLC:LDY#&FF:TYA 7500.L1% ADC buffer%+255,Y 7520DEY:BNE L1% 7540TAX:DEY:CLC:TYA 7560.L2% ADC buffer%-1,Y 7580DEY:BNE L2% 7600STX buffer%+511 7620STA buffer%+255 7640RTS 7660] 7680CALLbuffer%+1000 7700PRINT"Writing map" 7720PROCwrite_map 7740FORI%=buffer% TO buffer%+1279 STEP4 7760!I%=0 7780NEXT 7800buffer%!1=&6F677548 7820buffer%!&4FB=&6F677548 7840$(buffer%+&4CC)="$" 7860$(buffer%+&4D9)="$" 7880buffer%?&4D6=2 7900PROCwrite_dir 7920OSCLI"MOUNT "+STR$(drive%) 7960PRINT"Writing root" 7980F%=TRUE 8000*DIR $ 8020*LIB $ 8040*CDIR Format 8060IFE%=0 ORN%=0 PRINT"No defects...not saving a defect list" ELSEPROCsave_defect_list:REM Skip if BeebSCSI or no defects //ISW 9/ii/2020 8080$buffer%="$.Format.UltraForm" 8100!X%=buffer% 8120X%!2=PAGE 8140X%!6=&8023 8160X%!10=PAGE 8180X%!14=TOP 8200A%=0 8220CALL&FFDD 8240PRINT"UltraForm saved." 8260$buffer%="$.Format.UltraForm1" 8280X%!10=PAGE 8300X%!14=TOP 8320A%=0 8340CALL&FFDD 8360PRINT"UltraForm1 saved." 8380ENDPROC 8400DEFPROCmode_select 8410X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 8420?X%=0 8440X%!1=buffer% 8460X%?5=&15 8480X%?6=drive%*&20 8500X%!7=&160000 8520!buffer%=&8000000 8540buffer%!4=0 8560buffer%!8=&10000 8580buffer%?12=1 8600buffer%?13=cyl%DIV256 8620buffer%?14=cyl% 8640buffer%?15=heads% 8660buffer%?16=rwcc%DIV256 8680buffer%?17=rwcc% 8700buffer%?18=rwcc%DIV256 8720buffer%?19=rwcc% 8740buffer%?20=lz% 8760buffer%?21=step% 8780A%=&72 8800CALL&FFF1 8820IF ?X% PROCCont 8840ENDPROC 8860DEFPROCformat 8880IFV%=0 W%=1 ELSE W%=T%:REM interleave of 1 (i.e. no sector skew) on first format, otherwise use T% //ISW 5/i/07 8900PROCinterleave(W%) 8910X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 8920?X%=0 8940X%!1=data% 8960X%?5=4 8980X%?6=drive%*&20+&1E 9000X%?7=fill% 9020X%?8=0 9040X%?9=W%:REM interleave //ISW 5/i/07 9060X%?10=0 9080A%=&72 9100CALL&FFF1 9120IF ?X% PROCCont 9140ENDPROC 9160DEFPROCverify(I%) 9180PRINT"Verifying sectors &";~I%;" to &";~I%+vblocks%-1; 9190X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 9200?X%=0 9220X%!1=0 9240X%?5=&2F 9260X%?6=drive%*&20 9280X%?7=I% DIV &1000000 9300X%?8=I% DIV &10000 9320X%?9=I% DIV &100 9340X%?10=I% 9360X%?11=0:X%?12=vblocks% DIV256:X%?13=vblocks% MOD256:X%?14=0:REM //ISW 9/i/2011 9380A%=&72 9400CALL&FFF1 9420VDU13 9440IF ?X% ELSE I%=I%+vblocks%:GOTO9180 9460ENDPROC 9480DEFPROCget_error 9500A%=&73 9520CALL&FFF1 9540error%=X%?3 9560sector%=(!X%)AND&1FFFFF 9580error%=error% MOD128:REM mask off top bit for correct error number (BeebSCSI sets top bit) // ISW 6/x/18 9600ENDPROC 9620DEFPROCwrite_map 9630A%=&72:X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 9640?X%=0 9660X%!1=buffer% 9680X%?5=10 9700X%?6=drive%*&20 9720X%!7=0 9740X%!9=2 9760CALL&FFF1 9780IF ?X% PROCCont 9800ENDPROC 9820DEFPROCwrite_dir 9830A%=&72:X%=x%:Y%=X% DIV256:REM //ISW 4/v/2020 - corrupted by other calls 9840?X%=0 9860X%!1=buffer% 9880X%?5=10 9900X%?6=drive%*&20 9920X%!7=&50200 9940CALL&FFF1 9960IF ?X% PROCCont 9980ENDPROC10000DEFPROCinterleave(B%)10020IFM% U%=310:spt%=33 ELSE U%=323:spt%=47:REM record size and spt depending on MFM flag //ISW 16/i/1110040IFB%=1U%=U%+10:spt%=spt%-1:REM record size is 10 more and spt 1 less if no interleave //ISW 30/viii/0910060maxbfi%=(U%*(spt%-1))+150:REM Bytes from index in Translate cannot be larger than this //ISW 9/i/1110080ENDPROC10100DEFPROCmfmrll10120PRINT"MFM or RLL? (M/R)     ";10140REPEAT10160REPEAT10180B%=GET10200UNTILB%=ASC"M"ORB%=ASC"m"ORB%=ASC"R"ORB%=ASC"r"10220VDUB%10240IFB%=ASC"M"ORB%=ASC"m"M%=TRUE ELSEM%=FALSE10260REPEAT10280B%=GET10300UNTILB%=13ORB%=12710320VDUB%10340UNTILB%=1310360PRINT10380ENDPROC10400DEFPROCdoverify10420I%=010440K%=0:L%=0:REM L% is total defects, K% will only go up to 1024 //ISW 11/i/0710460PRINT"Verifying ..."10480PROCverify(I%)10500PROCget_error10520IF error%=&21 OR error%=&23 OR sector%>heads%*cyl%*spt%-(K%+data%?3+data%?2*256)DIV8 GOTO 1068010540PRINT"Defect &";~error% MOD128" at &";~sector%;:IFL%>1016 PRINT" - DEFECT LIST FULL"ELSEPRINT"                 "10560IFsector%<spt% PRINT"Defect in Cyl 0, Head 0 - ignoring":GOTO10640:REM //ISW 9/i/201110580IFL%<1016 buffer%!K%=sector%10600L%=L%+810620IFL%<1016 K%=K%+810640I%=sector%+110660GOTO 1048010680PRINT"Disc verified                         "10700ENDPROC10720DEFPROCdoinit10740PRINT"Initialise"'"Disc will be initialised using current  parameters"10760PROClistparams10770PROCcheckgeom10780VDU129,157,131,141,13610800PRINT"Initialising destroys all data"10820VDU129,157,131,141,13610840PRINT"Initialising destroys all data"10860PRINT10880PRINT"Proceed? ";10900IF(GET AND &5F)=ASC"Y":PRINT"Y";ELSEPRINT'"Aborted"':ENDPROC10920IF(GET AND &5F)=ASC"E":PRINT"e";ELSEPRINT'"Aborted"':ENDPROC10940IF(GET AND &5F)=ASC"S":PRINT"s";ELSEPRINT'"Aborted"':ENDPROC10960IF GET=13 PRINT ELSEPRINT'"Aborted"':ENDPROC10980OSCLI"MOUNT "+STR$drive%11000REMPROCmode_select11020PROCinitialise11040ENDPROC11060DEFPROCmfm11080PRINT'"MFM controller selected"11100M%=TRUE:IFT%=1 spt%=32 ELSE spt%=3311120ENDPROC11140DEFPROCrll11160PRINT'"RLL controller selected"11180M%=FALSE:IFT%=1 spt%=46 ELSE spt%=4711200ENDPROC11220DEFPROCCont11240PRINT"Error "~?X%11260PRINT"Continue?";11280REPEATD%=GET AND&5F:UNTILD%=89ORD%=7811300VDUD%:PRINT11320IFD%=89ENDPROC11340STOP11360DEFFNBeebSCSI11380LOCAL A%,X%,Y%11400A%=&7211420X%=osblock MOD 25611440Y%=osblock DIV 25611460?osblock=011480osblock!1=result11500osblock?5=&D0:REM BeebSCSI Sense11520osblock!6=0:REM reserved11540osblock?9=8:REM 8 bytes returned11560osblock!10=0:REM reserved11580CALL&FFF111600IF?osblock=0 =TRUE ELSE =FALSE12000DEFPROCchange_drive12100PRINT"Change drive number"12110PRINT'"Current drive: ";drive%'12120REPEAT12150PRINT"New drive: ";:INPUT""drive%12180UNTILdrive%<8ANDdrive%>-112200ENDPROC13000DEFPROCfilldisc(G%)13005REM NO LONGER USED - DELETE IN NEXT VERS13010IFdofill% PRINTELSE ENDPROC13020H%=EVAL("&"+STRING$(4,STR$~G%))13040FORB%=0TO4092STEP413060buffer%!B%=H%13080NEXT13090B%=013100A%=&7213120X%=osblock MOD25613140Y%=osblock DIV25613160?osblock=013170osblock!1=buffer%13180osblock?5=&A:REM write13185REPEAT13190osblock?6=B%DIV 65536:REM MSB of start sector in low 5 bits13200osblock?6=osblock?6+32*drive%:REM drive number is in top 3 bits13210osblock?7=B% DIV 256 MOD 256:REM middle byte of start sector13220osblock?8=B% MOD 256:REM LSB of start sector13230osblock?9=16:REM 16blocks=4K of buffer13240osblock?10=0:REM reserved13250VDU13:PRINT"Filling sector &";~B%;" (";B%;")";13260CALL&FFF113270B%=B%+3213280UNTIL?osblock=&21 OR ?osblock=&23  OR B%>heads%*cyl%*spt%13300ENDPROC14000DEFPROCtogglefill14005REM NO LONGER USED - Delete in next vers14010dofill%=NOTdofill%14020PRINT"Manual fill ";14030IFdofill% PRINT"On" ELSE PRINT"Off"14040ENDPROC14500DEFPROCcheckgeom14510IFheads%*cyl%*spt%>&200000 PRINT"Geometry exceeds maximum ADFS disc size-reducing:":heads%=64:cyl%=1024:M%=TRUE:T%=1:PROCinterleave(T%):PROClistparams14520ENDPROC

Statistics: Posted by BeebMaster — Tue Jan 16, 2024 10:43 pm



Viewing all articles
Browse latest Browse all 2345

Trending Articles