Author Topic: Disc formatting from your BASIC programs  (Read 3150 times)

0 Members and 1 Guest are viewing this topic.

Offline TotO

  • 6128 Plus
  • ******
  • Posts: 4.055
  • Country: fr
    • ?area=showdonations;u=4
    • Awards
Disc formatting from your BASIC programs
« on: 09: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.

Code: [Select]
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.
« Last Edit: 09:29, 21 March 14 by TotO »
like
0
No reactions
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.181
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
    • Awards
Re: Disc formatting from your BASIC programs
« Reply #1 on: 21:22, 23 April 14 »
Always useful :)
like
0
No reactions