Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Written by Paul Popelka (paulp@uts.amdahl.com) | |
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 | * | |
78ed81a3 | 18 | * $Id$ |
15637ed4 RG |
19 | */ |
20 | ||
21 | /* | |
22 | * Format of a boot sector. This is the first sector | |
23 | * on a DOS floppy disk or the fist sector of a partition | |
24 | * on a hard disk. But, it is not the first sector of | |
25 | * a partitioned hard disk. | |
26 | */ | |
27 | struct bootsector33 { | |
28 | char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */ | |
29 | char bsOemName[8]; /* OEM name and version */ | |
30 | char bsBPB[19]; /* BIOS parameter block */ | |
31 | char bsDriveNumber; /* drive number (0x80) */ | |
32 | char bsBootCode[474]; /* pad so structure is 512 bytes long */ | |
33 | u_short bsBootSectSig; | |
34 | #define BOOTSIG 0xaa55 | |
35 | }; | |
36 | ||
37 | struct bootsector50 { | |
38 | char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */ | |
39 | char bsOemName[8]; /* OEM name and version */ | |
40 | char bsBPB[25]; /* BIOS parameter block */ | |
41 | char bsDriveNumber; /* drive number (0x80) */ | |
42 | char bsReserved1; /* reserved */ | |
43 | char bsBootSignature; /* extended boot signature (0x29) */ | |
44 | #define EXBOOTSIG 0x29 | |
45 | char bsVolumeID[4]; /* volume ID number */ | |
46 | char bsVolumeLabel[11]; /* volume label */ | |
47 | char bsFileSysType[8]; /* file system type (FAT12 or FAT16) */ | |
48 | char bsBootCode[448]; /* pad so structure is 512 bytes long */ | |
49 | u_short bsBootSectSig; | |
50 | #define BOOTSIG 0xaa55 | |
51 | }; | |
52 | ||
53 | union bootsector { | |
54 | struct bootsector33 bs33; | |
55 | struct bootsector50 bs50; | |
56 | }; | |
57 | ||
58 | /* | |
59 | * Shorthand for fields in the bpb. | |
60 | */ | |
61 | #define bsBytesPerSec bsBPB.bpbBytesPerSec | |
62 | #define bsSectPerClust bsBPB.bpbSectPerClust | |
63 | #define bsResSectors bsBPB.bpbResSectors | |
64 | #define bsFATS bsBPB.bpbFATS | |
65 | #define bsRootDirEnts bsBPB.bpbRootDirEnts | |
66 | #define bsSectors bsBPB.bpbSectors | |
67 | #define bsMedia bsBPB.bpbMedia | |
68 | #define bsFATsecs bsBPB.bpbFATsecs | |
69 | #define bsSectPerTrack bsBPB.bpbSectPerTrack | |
70 | #define bsHeads bsBPB.bpbHeads | |
71 | #define bsHiddenSecs bsBPB.bpbHiddenSecs | |
72 | #define bsHugeSectors bsBPB.bpbHugeSectors |