Difference between revisions of "Simple DFS Formatter"

From BeebWiki
Jump to: navigation, search
m (1 revision)
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Filing]]
 
[[Category:Filing]]
DFS v0.xx and v1.xx do not have a format command built in. They are supplied
+
DFS versions 0.xx and 1.xx do not have a format command built in. They are
with a format command on disk. A problem arises when you have no formatted
+
supplied with a format command on disk. A problem arises when you have no
disks to start with. This program is short enough to type in directly with
+
formatted disks to start with. This program is short enough to type in
no errors and will format a DFS disk.
+
directly with no errors and will format a DFS disk.
  
   REM Quick DFS Formatter
+
  REM > FormDFS
   DIM X% 31,data% 511
+
   REM Quick Formatter
  Y%=X%DIV256
+
   DIM X% 31,data% 511:Y%=X%DIV256:*DISK
 +
  ON ERROR REPORT:PRINT " at line ";ERL:OSCLI"FX180,"+STR$(PAGE/256):END
 
   *FX180,64
 
   *FX180,64
   INPUT"Drive: "drive%
+
   INPUT"Drive: "drive%
 
   INPUT"Tracks: "num%
 
   INPUT"Tracks: "num%
 
   FOR track%=0 TO num%-1
 
   FOR track%=0 TO num%-1
     PRINTCHR$13;"Track ";track%;
+
     PRINT CHR$13;"Track ";track%;
 
     FOR sector%=0 TO 9
 
     FOR sector%=0 TO 9
 
       data%!(sector%*4)=track%
 
       data%!(sector%*4)=track%
Line 23: Line 24:
 
     X%?7=track%
 
     X%?7=track%
 
     X%!8=&10002A10
 
     X%!8=&10002A10
     A%=127:CALL&FFF1
+
     A%=127:REPEAT:CALL&FFF1:UNTIL X%?12<>&10
     IFX%?10:PRINT" error &";~X%?10
+
     IF X%?12:PRINT" error &";~X%?12
 
   NEXT track%:PRINT
 
   NEXT track%:PRINT
 
   FOR A%=0 TO 511 STEP 4:data%!A%=0:NEXT A%
 
   FOR A%=0 TO 511 STEP 4:data%!A%=0:NEXT A%
Line 33: Line 34:
 
   X%!5=&4B03
 
   X%!5=&4B03
 
   X%!9=&22
 
   X%!9=&22
   A%=127:CALL&FFF1
+
   A%=127:REPEAT:CALL&FFF1:UNTIL X%?10<>&10
   IFX%?10:PRINT"write error &";~X%?10
+
   IF X%?10:PRINT"write error &";~X%?10
   OSCLI"FX180,"+STR$(PAGE/256)
+
   OSCLI"FX180,"+STR$(PAGE/256):END
 
+
 
 
===See Also===
 
===See Also===
 
[http://mdfs.net/Docs/Comp/BBC/Disk/#format BBC FAQ]
 
[http://mdfs.net/Docs/Comp/BBC/Disk/#format BBC FAQ]
  
 
[[User:Jgharston|Jgharston]] 14:46, 4 January 2008 (UTC)
 
[[User:Jgharston|Jgharston]] 14:46, 4 January 2008 (UTC)

Latest revision as of 20:56, 8 March 2015

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)