|
|
1.1 root 1: /*
2: * Written by Paul Popelka ([email protected])
3: *
4: * You can do anything you want with this software,
5: * just don't say you wrote it,
6: * and don't remove this notice.
7: *
8: * This software is provided "as is".
9: *
10: * The author supplies this software to be publicly
11: * redistributed on the understanding that the author
12: * is not responsible for the correct functioning of
13: * this software in any circumstances and is not liable
14: * for any damages caused by this software.
15: *
16: * October 1992
17: *
18: * bpb.h,v 1.2 1993/05/20 03:34:04 cgd Exp
19: */
20:
21: /*
22: * BIOS Parameter Block (BPB) for DOS 3.3
23: */
24: struct bpb33 {
25: u_short bpbBytesPerSec; /* bytes per sector */
26: u_char bpbSecPerClust; /* sectors per cluster */
27: u_short bpbResSectors; /* number of reserved sectors */
28: u_char bpbFATs; /* number of FATs */
29: u_short bpbRootDirEnts; /* number of root directory entries */
30: u_short bpbSectors; /* total number of sectors */
31: u_char bpbMedia; /* media descriptor */
32: u_short bpbFATsecs; /* number of sectors per FAT */
33: u_short bpbSecPerTrack; /* sectors per track */
34: u_short bpbHeads; /* number of heads */
35: u_short bpbHiddenSecs; /* number of hidden sectors */
36: };
37:
38: /*
39: * BPB for DOS 5.0
40: * The difference is bpbHiddenSecs is a short for DOS 3.3,
41: * and bpbHugeSectors is not in the 3.3 bpb.
42: */
43: struct bpb50 {
44: u_short bpbBytesPerSec; /* bytes per sector */
45: u_char bpbSecPerClust; /* sectors per cluster */
46: u_short bpbResSectors; /* number of reserved sectors */
47: u_char bpbFATs; /* number of FATs */
48: u_short bpbRootDirEnts; /* number of root directory entries */
49: u_short bpbSectors; /* total number of sectors */
50: u_char bpbMedia; /* media descriptor */
51: u_short bpbFATsecs; /* number of sectors per FAT */
52: u_short bpbSecPerTrack; /* sectors per track */
53: u_short bpbHeads; /* number of heads */
54: u_long bpbHiddenSecs; /* number of hidden sectors */
55: u_long bpbHugeSectors; /* number of sectrs if bpbSectors == 0 */
56: };
57:
58: /*
59: * The following structures represent how the bpb's look
60: * on disk. shorts and longs are just character arrays
61: * of the appropriate length. This is because the compiler
62: * forces shorts and longs to align on word or halfword
63: * boundaries.
64: */
65: #include <machine/endian.h>
66: #if BYTE_ORDER == LITTLE_ENDIAN
67: #define getushort(x) *((u_short *)(x))
68: #define getulong(x) *((u_long *)(x))
69: #define putushort(p, v) (*((u_short *)(p)) = (v))
70: #define putulong(p, v) (*((u_long *)(p)) = (v))
71: #else
72:
73: #endif
74:
75: /*
76: * BIOS Parameter Block (BPB) for DOS 3.3
77: */
78: struct byte_bpb33 {
79: char bpbBytesPerSec[2]; /* bytes per sector */
80: char bpbSecPerClust; /* sectors per cluster */
81: char bpbResSectors[2]; /* number of reserved sectors */
82: char bpbFATs; /* number of FATs */
83: char bpbRootDirEnts[2]; /* number of root directory entries */
84: char bpbSectors[2]; /* total number of sectors */
85: char bpbMedia; /* media descriptor */
86: char bpbFATsecs[2]; /* number of sectors per FAT */
87: char bpbSecPerTrack[2]; /* sectors per track */
88: char bpbHeads[2]; /* number of heads */
89: char bpbHiddenSecs[2]; /* number of hidden sectors */
90: };
91:
92: /*
93: * BPB for DOS 5.0
94: * The difference is bpbHiddenSecs is a short for DOS 3.3,
95: * and bpbHugeSectors is not in the 3.3 bpb.
96: */
97: struct byte_bpb50 {
98: char bpbBytesPerSec[2]; /* bytes per sector */
99: char bpbSecPerClust; /* sectors per cluster */
100: char bpbResSectors[2]; /* number of reserved sectors */
101: char bpbFATs; /* number of FATs */
102: char bpbRootDirEnts[2]; /* number of root directory entries */
103: char bpbSectors[2]; /* total number of sectors */
104: char bpbMedia; /* media descriptor */
105: char bpbFATsecs[2]; /* number of sectors per FAT */
106: char bpbSecPerTrack[2]; /* sectors per track */
107: char bpbHeads[2]; /* number of heads */
108: char bpbHiddenSecs[4]; /* number of hidden sectors */
109: char bpbHugeSectors[4]; /* number of sectrs if bpbSectors == 0 */
110: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.