1 | /*
|
---|
2 | =============================================================================
|
---|
3 | proto.c -- dump Atari prototype boot sectors
|
---|
4 | Version 2 -- 1988-01-25 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stdio.h"
|
---|
9 | #include "osbind.h"
|
---|
10 | #include "bootsec.h"
|
---|
11 |
|
---|
12 | short buf[256]; /* boot sector buffer */
|
---|
13 |
|
---|
14 | char *descrip[] = { /* boot sector descriptions */
|
---|
15 |
|
---|
16 | "40 tracks, single sided (180K)",
|
---|
17 | "40 tracks, double sided (360K)",
|
---|
18 | "80 tracks, single sided (360K)",
|
---|
19 | "80 tracks, double sided (720K)"
|
---|
20 | };
|
---|
21 |
|
---|
22 | /* |
---|
23 |
|
---|
24 | */
|
---|
25 |
|
---|
26 | /*
|
---|
27 | =============================================================================
|
---|
28 | getiwd() -- get an Intel byte reversed word
|
---|
29 | =============================================================================
|
---|
30 | */
|
---|
31 |
|
---|
32 | unsigned
|
---|
33 | getiwd(wp)
|
---|
34 | register char wp[];
|
---|
35 | {
|
---|
36 | register unsigned val;
|
---|
37 |
|
---|
38 | val = ((wp[1] & 0x00FF) << 8) | (wp[0] & 0x00FF);
|
---|
39 | return(val);
|
---|
40 | }
|
---|
41 |
|
---|
42 | /* |
---|
43 |
|
---|
44 | */
|
---|
45 |
|
---|
46 | main()
|
---|
47 | {
|
---|
48 | register long i;
|
---|
49 | register short dt, j;
|
---|
50 | register struct BootSec *bsp;
|
---|
51 |
|
---|
52 | bsp = (struct BootSwc *)buf;
|
---|
53 |
|
---|
54 | for (dt = 0; dt < 4; dt++) {
|
---|
55 |
|
---|
56 | memsetw(buf, 0xE5E5, 256); /* 0xE5 fill */
|
---|
57 |
|
---|
58 | Protobt(buf, 0x01000000L, dt, 0); /* make the prototype */
|
---|
59 |
|
---|
60 | printf("Atari prototype boot sector type %d:\n", dt);
|
---|
61 |
|
---|
62 | printf(" %s\n", descrip[dt]);
|
---|
63 |
|
---|
64 | printf("\nBoot sector contents --\n\n");
|
---|
65 |
|
---|
66 | printf(" Branch word = $%02.2x $%02.2x\n",
|
---|
67 | 0x00FF & bsp->branch[0],
|
---|
68 | 0x00FF & bsp->branch[1]);
|
---|
69 |
|
---|
70 | printf(" OEM area =");
|
---|
71 |
|
---|
72 | for (j = 0; j < 6; j++)
|
---|
73 | printf(" $%02.2x", 0x00FF & bsp->oem[j]);
|
---|
74 |
|
---|
75 | printf("\n Volume S/N =");
|
---|
76 |
|
---|
77 | for (j = 0; j < 3; j++)
|
---|
78 | printf(" $%02.2x", 0x00FF & bsp->vsn[j]);
|
---|
79 |
|
---|
80 | printf("\n Bytes / Sector = %u\n", getiwd(bsp->bps));
|
---|
81 | printf(" Sectors / Cluster = %u\n", bsp->spc);
|
---|
82 | printf(" Reserved sectors = %u\n", getiwd(bsp->res));
|
---|
83 | printf(" Number of FATS = %u\n", bsp->nfats);
|
---|
84 | printf(" Directory entries = %u\n", getiwd(bsp->ndirs));
|
---|
85 | printf(" Total Sectors = %u\n", getiwd(bsp->nsects));
|
---|
86 | printf(" Media byte = $%02.2x\n", 0x00FF & bsp->media);
|
---|
87 | printf(" Sectors / FAT = %u\n", getiwd(bsp->spf));
|
---|
88 | printf(" Sectors / Track = %u\n", getiwd(bsp->spt));
|
---|
89 | printf(" Sides = %u\n", getiwd(bsp->nsides));
|
---|
90 | printf(" Hidden files = %u\n", getiwd(bsp->nhid));
|
---|
91 | printf(" Checksum = $%04.4x\n\n", getiwd(bsp->cksum));
|
---|
92 |
|
---|
93 | printf("Dump of entire sector:\n");
|
---|
94 |
|
---|
95 | mdump((char *)&buf, (char *)&buf+511L, 0L);
|
---|
96 |
|
---|
97 | printf("\f");
|
---|
98 | }
|
---|
99 |
|
---|
100 | exit(0);
|
---|
101 | }
|
---|