1REM V1.21 10REM HardError - This removes a sector from the ADFS free space map 11REM if possible, so it is neither free nor allocated and as such 12REM inaccessible. If it is not in the map, it is allocated and it 13REM is up to you to free the space (delete the object). 20: 21ON ERROR PRINT:REPORT:PRINT:GOTO 699 25MODE 7 30PROCINIT 35VDU14 40: 45PRINT' 210PRINT"Please type in the disc address of" 220PRINT"the error, either in decimal, or in Hex" 230PRINT"preceded with '&', or press Escape." 233PRINT' 235VDU15 240REPEATINPUT"Disc address ? "A$ 250Add%=EVAL(A$) 260PRINT"The error is at "Add%" = &"~Add% 270REPEATINPUT"Correct ? "A$ 280UNTIL INSTR("YyNn",LEFT$(A$,1)) 290UNTIL(ASCA$AND&5F)=ASC"Y" 300: 400PROCGetFS 410: 500PROCReserve(Add%,1) 505IF F% GOTO 800 510: 600PROCPutFS 610: 620*Mount 630: 699IF V%+&C00=PAGE THEN PROCback_to_menu 700END 710: 800PRINT"This sector is not in the map." 810PRINT"Delete the object occupying the" 820PRINT"space and try again." 830GOTO699 11800: 11900: 12000DEF PROCINIT 12100@%=0 12300DIM ADD%(175),FLEN%(175) 12500DIM X% 20 12600DIM MAP% 512 12700Y%=X% DIV 256 12900ENDPROC 13000: 13100DEF PROCGetFS 13400REM Get the FSmap into ADD%(),FLEN%(),EOFSL% 13800PROCGetFSfromDisc 13900: 13910EOFSL%=(MAP%?&1FE)DIV3 14700FORI%=0 TO EOFSL%-1 14800ADD%(I%)=(!(MAP%+I%*3)AND&FFFFFF) 14900FLEN%(I%)=(!(MAP%+256+I%*3)AND&FFFFFF) 15000NEXT 15100ENDPROC 15200: 15300DEF PROCMAP 15400PRINT"Free Space Map" 15500PRINT"Address : Length" 15600@%=6 15700FOR I%=0 TO EOFSL%-1 15800PRINT~ADD%(I%);" : ";~FLEN%(I%) 15900NEXT 16000ENDPROC 16100: 16200: 16300: 20300DEF PROCReserve(A%,L%) 20350F%=FALSE 20400IF L% ELSE ENDPROC 20500I%=-1 20600REPEAT I%=I%+1:UNTIL I%=EOFSL% OR ADD%(I%)+FLEN%(I%)>A% 20700IF I%=EOFSL% GOTO 21800 20800IF ADD%(I%)=A% GOTO 21600 20900IF ADD%(I%)>A% : GOTO 21800 21000IF ADD%(I%)+FLEN%(I%)=A%+L% : FLEN%(I%)=FLEN%(I%)-L% : ENDPROC 21050IF ADD%(I%)+FLEN%(I%)L% THEN ADD%(I%)=ADD%(I%)+L%:FLEN%(I%)=FLEN%(I%)-L%:ENDPROC 21700IF FLEN%(I%)=L% THEN FOR J%=I% TO EOFSL%-2:ADD%(J%)=ADD%(J%+1):FLEN%(J%)=FLEN%(J%+1):NEXT:EOFSL%=EOFSL%-1:ENDPROC 21800IF L%:F%=TRUE 21900ENDPROC 22000: 22100DEF PROCPutFS 22500A%=&72 22550IF EOFSL%>81:PRINT"***Map too full!":STOP 22600FOR I%=0 TO EOFSL%-1 22700MAP%!(I%*3)=ADD%(I%) 22800MAP%!(I%*3+256)=FLEN%(I%) 22900NEXT 23000: 23100MAP%?&1FE=EOFSL%*3 23200DIM Q% 30:P%=Q%:[OPT0 23300CLC:LDY#255:TYA 23400.L1 ADC MAP%-1,Y:DEY:BNE L1 23500TAX:DEY:TYA:CLC 23600.L2 ADC MAP%-1+256,Y:DEY:BNE L2 23700STX MAP%+255 23800STA MAP%+255+256 23900RTS:] 23905CALL Q% 23910REM and drop thru to... 23920DEF PROCPutFStoDisc 23930REM Put the new FSmap in MAP% onto the disc 24000?X%=0 24100A%=&72 24200X%!1=MAP% 24300X%!5=10 24400X%!9=2 24600CALL&FFF1 24700IF ?X% PRINT"Disc error "~?X%" while writing map - ended.":END 24900ENDPROC 25000: 25100: 28100: 28200DEF PROCGetFSfromDisc 28250REM Get the FSmap into MAP% as kept on the disc 28300A%=&72 28400?X%=0 28500X%!1=MAP% 28600X%!5=8 28700X%!9=2 28800CALL &FFF1 28900IF ?X% PRINT"Disc error "~?X%" while reading map - ended.":END 29000ENDPROC 30000DEFPROCback_to_menu 30010PRINT"Press SPACE to return to menu" 30020IF GET <> &20 THEN 30020 30030PAGE=V% : RUN 30040ENDPROC