8 March 2004 Fixing the MBR code I'd better pull out a flaming skull again — a smaller one this time. Warning: ![]() This software is dangerous if misused. Do NOT run it just to see what happens. It will destroy your boot manager if you have one installed. This software is less dangerous than my previous MBR experimental code, but it should still be treated with respect. It also overwrites the master boot record — but it takes care to preserve the partition table. It overwrites the first 446 bytes of the master boot record, where the executable code resides. If you have a system with a boot manager or boot menu installed on your hard disk, this software will destroy that boot manager or menu. I wrote this to restore the MBR code I destroyed in a previous experiment. If you don't need this code, don't run it. I'm feeling lazy tonight, so here's the code. It should be self-explanatory for the most part. The floppy boot sector (BS.ASM) loads the MBR code from the floppy (MBR.ASM), combines it with the partition table on the hard disk, and writes the combination back to the hard disk. The code puts up a short message warning of what's going to happen and waits until you press the Y key before committing the deed. I should also mention that the MBR code is simply a translation into NASM syntax of code disassembled by Hale Landis. In the near future, I'll write a real installer — one that looks for a Karig partition (or a DOS partition that can be converted into a Karig partition) and copies sectors from the floppy into the partition. Check the index for other entries. |