184. Master ADFS compacting routine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you try a *MAP command after *COMPACT, you will often find that only partial compaction has taken place. If fuller compaction is required, you have to try again. The short program below can be kept in the root "$" directory of all your discs, and when CHAINed will carry out several 'passes' until there is only one gap when *MAP is issued. Each pass takes less time than the previous one, even if the same number of gaps result. Occasionally, a disc can be very reluctant to compact below 2 gaps, though it will make it eventually. The program therefore prompts you after 10 passes, in case you don't want to bother to go the whole way. Typically, I found that between 1 and 4 passes were needed with most discs. You can alter the maximum number of passes via the variable T% in line 10, and you can alter the number of gaps it will attempt to compact down to, via the variable N% in line 10. (You will save a lot of time by increasing this to 2, as long as this is sufficient for your purposes.) Do not alter the variable A%. The program keeps you informed about how many passes it has made, and shows the free space on the disc when it has finished. Note the *COMPACT start page of 0F in line 20 to avoid corrupting the program itself, which should reside at the normal PAGE setting of &E00. Therefore, if you do add anything to the listing, even just a few extra spaces, then just check that PRINT~TOP gives a Hex number starting with an E and not an F. The spaces after the line numbers are shown for clarity only, and should be omitted. 10 T%=10:N%=1:A%=0:REPEAT:MODE135:*MAP 20 V%=VPOS-1:A%=A%+1:IFV%>N%ANDA%<=T%THENPRINT'"Pass ";A%:*COMPACT 0F 71 30 UNTILV%<=N%ORA%>T% 40 IFV%>N%THENPRINT'"Another try? ";:IFCHR$(GETAND&DF)="Y"THENRUN 50 PRINT''"Compacted"':*FREE