CPCWiki forum

General Category => Programming => Topic started by: TotO on 08:28, 21 March 14

Title: Disc formatting from your BASIC programs
Post by: TotO on 08:28, 21 March 14
Something that I used long long years ago into my "Discovery" program for formatting floppies.
Line 100 run an example of disc formating, so take care about your floppy before a RUN 100.

5 ' FORMAT (DATA/VENDOR/IBM)
6 ' DATA type=&C1 (9 sectors/178K)
7 ' VENDOR type=&41 (9 sectors/169K)
8 ' IBM type=&01 (8 sectors/154K)
9 ' Usage: CALL &A100,tracknumber,type

10 MEMORY &A0FF : RESTORE 20 : S=0 : FOR T=&A100 TO &A17F : READ A$ : A=VAL("&"+A$) : S=S+A : POKE T,A : NEXT T : IF S<>11553 THEN PRINT"DATA ERROR" : END

20 DATA
FE,02,C0,DD,7E,00,4F,C5,F5,32,5D,A1,3C,32,65,A1,
3C,32,6D,A1,3C,32,75,A1,3C,32,7D,A1,F1,06,05,80,
32,61,A1,3C,32,69,A1,3C,32,71,A1,3C,32,79,A1,DD,
7E,02,32,5B,A1,32,5F,A1,32,63,A1,32,67,A1,32,6B,
A1,32,6F,A1,32,73,A1,32,77,A1,32,7B,A1,C1,57,1E

30 DATA
00,21,5B,A1,DF,58,A1,C9,52,C6,07,00,00,C1,02,00,
00,C6,02,00,00,C2,02,00,00,C7,02,00,00,C3,02,00,
00,C8,02,00,00,C4,02,00,00,C9,02,00,00,C5,02,00

40 END

100 ' Test: DATA formatting from track 39 to 0
110 PRINT "Insert a floppy disc and press any key." : CALL &BB18
120 FOR track=39 to 0 step -1
130 PRINT "Formating track" ; track ; CHR$(11)
140 CALL &A100,track,&C1 : NEXT track : PRINT


Cheers.
Title: Re: Disc formatting from your BASIC programs
Post by: Gryzor on 19:22, 23 April 14
Always useful :)
Powered by SMFPacks Menu Editor Mod