Simple DFS Formatter

From BeebWiki
Jump to: navigation, search

DFS versions 0.xx and 1.xx do not have a format command built in. They are supplied with a format command on disk. A problem arises when you have no formatted disks to start with. This program is short enough to type in directly with no errors and will format a DFS disk.

 REM > FormDFS
 REM Quick Formatter
 DIM X% 31,data% 511:Y%=X%DIV256:*DISK
 ON ERROR REPORT:PRINT " at line ";ERL:OSCLI"FX180,"+STR$(PAGE/256):END
 *FX180,64
 INPUT"Drive:  "drive%
 INPUT"Tracks: "num%
 FOR track%=0 TO num%-1
   PRINT CHR$13;"Track ";track%;
   FOR sector%=0 TO 9
     data%!(sector%*4)=track%
     data%?(sector%*4+2)=(sector%+track%*7)MOD10
     data%?(sector%*4+3)=1
   NEXT sector%
   X%?0=drive%
   X%!1=data%
   X%!5=&6305
   X%?7=track%
   X%!8=&10002A10
   A%=127:REPEAT:CALL&FFF1:UNTIL X%?12<>&10
   IF X%?12:PRINT" error &";~X%?12
 NEXT track%:PRINT
 FOR A%=0 TO 511 STEP 4:data%!A%=0:NEXT A%
 data%?&107=num%*10
 data%?&106=num%/25.6
 X%?0=drive%
 X%!1=data%
 X%!5=&4B03
 X%!9=&22
 A%=127:REPEAT:CALL&FFF1:UNTIL X%?10<>&10
 IF X%?10:PRINT"write error &";~X%?10
 OSCLI"FX180,"+STR$(PAGE/256):END
 

See Also

BBC FAQ

Jgharston 14:46, 4 January 2008 (UTC)