-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIBMINIT.C
79 lines (67 loc) · 1.75 KB
/
IBMINIT.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* @(#)ibminit.c 2.6 */
/* vmformat (09 AUG 84) - PC-DOS (CDOS) initialization routines */
#include "portab.h"
#include "ibmdisk.h"
EXTERN FS fs;
/* initpcdos() - fats, and directory */
initpcdos(argc,argv)
WORD argc;
BYTE **argv;
{
/* We will need a pretty big buffer */
BYTE sector[MAXRTDIRENTRIES*DIRENTRYSZBYTES];
WORD nfats;
BYTE buf;
/* write the FATS and directory */
printf("All File System data on the diskette will now be destroyed.\n");
printf("Is this what you want (y/n)? ");
read(0,&buf,1);
printf("\n");
if (buf != 'y' && buf != 'Y')
{
printf("Init aborted\n");
return;
}
printf("Writing %d FATs of %d sector(s) each...\n",fs.nfats,fs.fatszinsecs);
for (nfats = 0; nfats < fs.nfats; nfats++)
{
setb(0,sector,sizeof(sector));
sector[0] = sector[1] = sector[2] = fs.mediatype;
if( WriteSector(fs.disknum,
(LONG)(fs.fatstartsec+nfats*fs.fatszinsecs),
fs.fatszinsecs,sector) == ERROR)
{
printf("COULD NOT WRITE FATS\n");
return;
}
}
setb(0,sector,sizeof(sector));
printf("Writing directory of %d sectors...\n",fs.rtdirszinsecs);
if( WriteSector(fs.disknum,fs.rtdirstartsec,fs.rtdirszinsecs,sector) == ERROR )
{
printf("Could not write the directory.\n");
return;
}
}
#if FORMATCMD
ibmformat()
{
BYTE buf;
BYTE status;
printf("Floppy format for CONCURRENT DOS 68k v2.0\n");
printf("Insert a new diskette in the disk drive.\n");
printf("All data on the diskette will now be destroyed.\n");
printf("Is this what you want (y/n)? ");
read(0,&buf,1);
printf("\n");
if (buf != 'y' && buf != 'Y')
{
printf("Format aborted\n");
return;
}
/* checkstatus(config()); */
/* checkstatus(format()); */
printf("All done!\n");
}
#endif