home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 1
/
crawlyvol1.bin
/
program
/
hard_prj
/
flop14st
/
hdflop.4
< prev
Wrap
Text File
|
1993-07-01
|
5KB
|
130 lines
Atari ST High Density Disk Drives - Part 2
/* formath.c Formatter fuer High Density Disketten */
/* nur fuer angepasste Hardware! Floppycontroller und Laufwerk */
/* muessen High-Density tauglich sein! */
/* Hartmut Semken, Lupsteiner Weg 67 1000 Berlin 37 */
/* hase@hase_1.mbx.sub.org or hase@netmbx.mbx.sub.org */
/* 03-SEP-89 */
#include <stdio.h>
#include <osbind.h>
#include <time.h>
#define SLEEPTIME 1 /* 1: Zeitschleife, 0: Taste */
#define BLANK (0xE5E5)
#define MAGIC (0x87654321L)
#define BUFSIZE (20*1024) /* Platz fuer mehr als 18 Sektoren... */
#define DEVICE 0 /* 0 = Floppy A, 1 = Floppy B */
#define SIDES 2 /* je */
#define SECTORS 18 /* nach */
#define TRACKS 80 /*Belieben */
#define TOTSEC (TRACKS * SIDES * SECTORS)
extern int errno;
main()?
int track;
int side;
int status;
short *bf;
register char reply;
short *middle;
char buffer[512];
printf("\033E\n");
printf("Public Domain High Density Mini Formatter\n");
printf("von H. Semken\nDer Autor garantiert in keiner Weise fr die
Funktion\nDieses Programmes.\nBenutzung auf eigene Gefahr.\n");
printf("\n\n\n");
printf("\007\033pFormatiere Diskette in Drive %c\033q\n%d Seiten\n%d Sektoren
pro Spur\n%d Spuren\n\n", (65+DEVICE), SIDES, SECTORS, TRACKS);
printf("Wirklich formatieren? ");
fflush(stdout);
if ((reply = Crawcin()) != 'y' && reply != 'Y' && reply != 'j' && reply != 'J')
?
printf("Nein. Floppy nicht formatiert.\n");
sleep(1);
Pterm0();
?
printf("Ja.\n");
printf("Diskette einlegen; Taste drcken...");
fflush(stdout);
Crawcin();
printf("\n");
bf = malloc(BUFSIZE);
for (track = TRACKS-1; track >= 0; track--) ?
for (side = 0; side < SIDES; side++) ?
printf("Formatiere Spur %d, Seite %d", track, side);
fflush(stdout);
status = Flopfmt(bf, 0L, DEVICE, SECTORS, track, side, 1, MAGIC, BLANK);
if (status) ?
middle = bf;
printf("\t%d\n", status);
while (*middle) ?
printf("\tDefekter Sektor %d\n", *middle++);
?
? else ?
printf("\tokay\r");
?
?
?
printf("\n\nAlle Spuren formatiert\n");
printf("Initialisiere Directory\n");
for (track = 0; track < (BUFSIZE>>1); bf[track++] = 0);
for (track = 0; track < 2;track++) ?
for (side = 0; side < SIDES; side++)?
if (status = Flopwr(bf, 0L, DEVICE, 1, track, side, SECTORS)) ?
errno = -status;
perror("Write Error");
?
?
?
Protobt(buffer, (long)Random(),3,0); /* Prototyp Bootsector fr
* 80 * 2 * 9 Sektoren */
/* Prototyp Bootsektor fr das neue Format anpassen */
/* Bytes 19 und 20 enthalten die Sektoren pro Disk */
/* unteres Byte von TOTSEC */
buffer[19] = (char)(((TOTSEC>>8)<<8)~TOTSEC);
/* oberes Byte von TOTSEC; es lebe das Intel int-Format */
buffer[20] = (char)(TOTSEC>>8);
buffer[24] = (char)SECTORS; /* Sektoren pro Spur */
status = Flopwr(buffer, 0L, DEVICE, 1, 0, 0, 1);
if (status) ?
errno = -status;
perror("Write Error (Bootsector)");
?
status = Flopver(buffer, 0L, DEVICE, 1, 0, 0, 1);
if (status) ?
errno = -status;
perror("Verify Error (Bootsector)");
?
printf("Diskette in Laufwerk %c formatiert\n", (65+DEVICE));
sleep(1);
Pterm0();
?
sleep(seconds)
int seconds;
#if SLEEPTIME
?
clock_t t;
for(t = clock();clock() < (t + CLK_TCK*seconds););
?
#else
?
printf("Taste druecken\n");
fflush(stdout);
Crawcin();
?
#endif
--
Hartmut Semken, Lupsteiner Weg 67, 1000 Berlin 37 hase@hase_1.UUCP
Dennis had stepped up into the top seat whet its founder had died of a
lethal overdose of brick wall, taken while under the influence of a
Ferrari and a bottle of tequila. (Douglas Adams; the long dark teatime...)
------------------------------
ə