The Standard
MBR Code
and
Notes on the Differences in one OEM
versionof
the DOS 3.30 MBR
(Master Boot Record)
Web Page and Text Copyright © 2003, 2005, 2007 by Daniel
B. Sedory
NOT to be reproduced in any form without Permission of the
Author !
After studying many different versions
of DOS, our conclusion is this:
The Standard MBR code was solidified with the release of
IBM®/MS DOS 3.30, but its history actually begins
with the release of IBM® Personal Computer DOS 2.00.
The only difference found in the MBRs created by all DOS 3.30 versions of FDISK were in a single version of DOS 3.30 made for NEC® Powermate Systems! (If you know of any other MBR code differences², please let us know.)
The IBM® Personal Computer DOS version 3.30's MBR code is exactly the same code used in most versions of MS-DOS 3.30 (i.e., for those systems with an architecture close to an IBM® machine) and all other versions up to and including the MBR code used by the original Microsoft® Windows 95 FDISK program.
The different code for the NEC®
MS-DOS 3.30 (Revision 3) MBR is shown below inside the YELLOW BOX in
the following Table; which is only a small portion of all the code in the MBR's
512-byte sector. (If you find any other version of DOS that has the same kind
of code; or a variation of it, please
inform us.)
The first four digits are the hex offset locations in the first Segment of Memory where these instructions are loaded and executed during the boot-up process:
IBM
and MS-DOS 3.30
and other DOS MBR versions (in Memory) |
|
7C18 JMP 0000:061D 061D MOV SI,07BE 0620 MOV BL,04 |
7C18 JMP 0000:061D 061D MOV SI,07BE 0620 MOV BL,04 |
* 0622 MOV DI,077C * 0625 CMP WORD PTR [DI],A55A * 0629 JNZ 0630 * 062B MOV BL,08 * 062D MOV SI,077E |
These
lines of code are not
found in the 'Standard' IBM or MS-DOS 3.30 MBR nor anywhere else we've checked. |
0630 CMP BYTE PTR [SI],80 etc. etc. |
0622 CMP BYTE PTR [SI],80 etc. etc. |
Here are the actual bytes to look for (with red highlighting) in an MBR that makes it different from the Standard DOS 3.30 code:
0000 FA 33 C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC .3.....|..P.P... 0010 BF 00 06 B9 00 01 F2 A5 EA 1D 06 00 00 BE BE 07 ................ 0020 B3 04 BF 7C 07 81 3D 5A A5 75 05 B3 08 BE 7E 07 ...|..=Z.u....~. 0030 80 3C 80 74 0E 80 3C 00 75 1C 83 C6 10 FE CB 75 .<.t..<.u......u |
And this is a view of the Standard DOS 3.30+ MBR code:
0000 FA 33 C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC .3.....|..P.P... 0010 BF 00 06 B9 00 01 F2 A5 EA 1D 06 00 00 BE BE 07 ................ 0020 B3 04 80 3C 80 74 0E 80 3C 00 75 1C 83 C6 10 FE ...<.t..<.u..... 0030 CB 75 .u |
Note how both MBRs have the same bytes in yellow after those which were added, but at different offset locations!
* The code here checks for the existence of the Hex Word A55Ah at location 077C in Memory. If it doesn't exist, then execution simply jumps to location 0630 and continues as it would for the Standard MS-DOS 3.30 code. However, if it is found, then the values previously placed into the BL and SI registers (04 and 07BE) are replaced with the alternate values of 08 and 077E instead. This clearly implies the existence of a Partition Table with eight entries beginning at location 077E (rather than the usual four entries which begin at 07BE). These entries must be set up and placed there by the same program which sets the bytes at locations 077C and 077D to 5A and A5 (i.e., the NEC FDISK) giving a Table that looks like this inside the drive's MBR sector:
0 1 2 3 4 5 6 7 8 9 A B C D E F 0770 5A A5 00 00 Z... 0780 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 07A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 07B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 07C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 07D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 07E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 ................ 07F0 01 00 24 0F FF 82 3F 00 00 00 91 D3 0D 00 55 AA ..............U. |
We tested this out by running it under a Windows version of the BOCHS x86 Emulator. And although we weren't sure how large of a partition it could create, the evidence for an 8-entry Partition Table with 8 Primary DOS partitions was irrefutable!
When we added partitions to this NEC Table, the first one was placed at offsets 07EEh through 07FDh (see the GREEN highlighted entry shown in the table above) and the next entry was added just above it. So, the entries are inserted and listed backwards from that of a normal Table. Thus, looking at such a Table with a disk editor or partition listing utility, it would show the first entry in a NEC eight-entry table as being the last one (fourth entry) in a normal Partition Table.
One interesting point about these special NEC entries is the fact they had their own Partition-Type identifier (a 24h byte; known as "NEC DOS 3.x") so any other OS attempting to boot up the drive or some utility program accessing it, wouldn't mistake it for a normal 32 MiB DOS partition in the wrong order. [For more info on Partition Types, see Andries Brouwer's page: http://www.win.tue.nl/~aeb/partitions/partition_types.html.]
For compatibility with other DOS systems, the NEC FDISK program was made so it could also create a standard four-entry Partition Table using its "DOS 3.3 Compatibility" mode.
As best we can figure out, it appears the FDISK.COM program with this version of DOS could partition a hard drive into a single partition up to somewhere higher than 443 MiB (900 cylinders x 16 heads x 63 sectors); at least as far as we could determine using the BOCHS Emulator we had at that time; it caused many problems³ when attempting to complete the task.
Furthermore, when we finally made the effort to install this DOS onto a real hard drive (of 1046 cylinders; 540 MB in size), this NEC® DOS 3.30 seemed to get confused at times about how to partition the drive. And it refused to create any partitions over 256 MiB (522 cylinders x 16 heads x 63 sectors)! This was very frustrating! It appears that the FDISK and other programs are somehow hard-coded to require a drive with less than 1024 cylinders (if even that) for obtaining the best capacity usage, or perhaps there was some problem interfacing with the BIOS chip! Under BOCHS, we got the following error message whenever first booting up the diskette (the second line below contains a 'grammatical/typo error' inside the program; so this is exactly how it appeared on screen):
Discrepancies
have been found in the information
stored the in permanent memory of this computer. You must use the Hardware System Setup to correct this information. Press any key to continue. |
Apart from all the partition-size problems we had, an important point is this:
At first we wondered how any DOS 3.30 version (given the limitations it has) could create a partition greater than 32 MiB. After checking the dates for FDISK.COM, FORMAT.COM and other files on the diskette and comparing them with those from later versions of DOS, it became apparent this diskette's abilities were highly likely to have been based upon programming from IBM®'s DOS 4.00 which had been finalized in June/July of 1988 and/or the Microsoft® MS-DOS 4.00 which came out later in October that same year. Thus the date for the FDISK program on this NEC diskette of August 8, 1988 is later than the date Microsoft had already acquired the ability to handle partitions much greater in size than just 32 MiB. In any case, there are five files on this diskette in a "SETUP" directory which are all dated "9-18-89 11:41 am" so it couldn't have been released by NEC® until at least 4 months after MS-DOS 4.01 (released April 7, 1989) was already in existence.
Quite surprising, however, was the release of COMPAQ® MS-DOS 3.31 (apparently as early as November of 19874) which could support multiple partitions of 512 MiB and was available not only long before this NEC® DOS, but also before similar versions from either IBM® or Microsoft® were finally released! We were able to borrow a "G" version (released in 1990) of COMPAQ®'s Personal Computer DOS 3.31 which uses a partition type of 06h; the normal FAT16 identifier for partitions greater than 32 MiB, and it did create a single partition of about 512 Binary MB on our 1046-cylinder test drive.
Although we found many FDISK.COM (and .EXE) programs with different MD5 signatures, the MBR code all of them create is identical to the Standard MS-DOS 3.30 version of FDISK (with the NEC version¹ being the only exception found). The MD5 sums, file dates and sizes for all copies of FDISK which we examined are listed here.
After going back even further and examining the code used in the MBRs for IBM® Personal Computer DOS versions 3.21, 3.20, 3.10, 3.00 and even version 2.00, we only found minor variations between them and the code used by DOS 3.30; mostly dealing with how the error messages were displayed. [The details of these differences are explained on our IBM® Personal Computer DOS 2.00 MBR page.]
Since what we're calling "the Standard MBR code" here at The Starman's Realm is still being used by a number of Partition Table and MBR utilities and data recovery tools, that means its history has already spanned well over two decades of hard drive innovations! So, this study has certainly brought about some justification for the phrase Standard MBR code (which is rather fitting since our first endeavor here, titled: The Standard MBR, was to understand and then share with others how an MBR was involved in booting up a computer's operating system from a hard disk)!
NEC
MS-DOS 3.30 FDISK.COM 55,029 bytes August
8, 1988 20:39.00
78fdc488f12082e47b06c3190d50cae7
*FDISK.COM
NEC |
It should be noted that we did not have access to an original diskette; only to a copy that did not have its write-protect notch covered; we know that for a fact, because the Boot Record had been 'compromised' by a Windows OS at some point having its original OEM ID replaced by an "IHC" string!
However, all the files in the Directory were in alphabetical-order, and it did not contain any deleted filenames. So, we assume it was an original FDISK.COM file we examined. If you can corroborate the data on this page from your own collection or printed materials, please let us know.
² That is, differences in code which would still run similarly to the standard PC-DOS, not a DOS version such as Zenith Data System's MS-DOS "R" version which is so different that it uses PART.EXE to set up drives (because there's no FDISK in this version), and at first glance didn't even appear to have a Partition Table (because it was changed/moved to a non-standard location)!
³ At first, when using an image that had more than 1024 cylinders, this FDISK program said there were only 514 cylinders available, and that's what it said it would use to partition it (we didn't try to actually carry out the formatting of the image at that time). Later on, we thought that was a bit strange and tried again with an image that was exactly 1024 cylinders. Well, that time it recognized all of them, and said it could make a partition of 0 to 1022 cylinders (apparently reserving 1 at the end for a "Test Cylinder"). But when we boot up the diskette again to attempt formatting after the partition was set to Active, it locked-up the BOCHS Emulator every time! Apparently either Bochs and/or this DOS running in an emulator didn't like the image it set up for some reason... FINALLY, using trial and error, we found that a partition entry of 900 cylinders was possible (and it would actually carry out the formatting process!), but using a somewhat larger setting caused various errors in BOCHS; for example, when trying 924 cylinders, this message was displayed:
>>PANIC<< prefetch: RIP > CS.limit
So, our conclusion at this time is: The NEC® DOS 3.30 (Rev. 3) diskette appears to be able to function on a hard drive image of at least 900 cylinders (we can only guess it would work on a real drive of this size since we do not have one; and wish we had access to various sized drives close to this!) We also know for sure that this DOS will have problems with a real drive of 1046 cylinders (at 16 heads, 63 sectors). If anyone has come across an article, e-mail or any other literature that describes the limits of this particular version of NEC® MS-DOS, please let us know!
4 COMPAQ® introduced Compaq DOS 3.31 in November 1987. Compaq DOS 3.31 was the first version of MS-DOS to use 32-bit sector addressing internally and in its Volume Boot Record. Note: We've read that Wyse® DOS 3.21 also supported a 32-bit FAT.
Last Update: May 18, 2007.
You can write to me using this: online
reply form. (It opens in a new window.)
MBR and Boot Records Index
The Starman's Realm Index Page