BIOS MBR sector dumper

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
User avatar
Demindiro
Member
Member
Posts: 166
Joined: Fri Jun 11, 2021 6:02 am
Libera.chat IRC: demindiro
Location: Belgium
Contact:

BIOS MBR sector dumper

Post by Demindiro »

Hello

I've made a very simple program which does nothing but print out 512 bytes starting from 0x7c00, i.e. the MBR on boot.
This is because I encountered very strange behavior when trying to get my OS running on real HW.

The source can be found here: https://codeberg.org/Demindiro/bios-mbr-dump (or Github: https://github.com/Demindiro/bios-mbr-dump)

Here are examples (note: nibbles are swapped in the pictures. Fixed in latest version):
2026-01-06-173321_699x415_scrot.png
2026-01-06-173321_699x415_scrot.png (6.08 KiB) Viewed 16451 times
ga-ax370m-gaming-3.jpg
Note the differences :evil:

If other people could run it on real HW I'd appreciate it. I wonder how many BIOSes are broken like this.
GeneSYS exokernel (Codeberg)
Lemmings! micro-/multikernel (Github, Codeberg)
Waddle container tool (Codeberg)
Octocontrabass
Member
Member
Posts: 6258
Joined: Mon Mar 25, 2013 7:01 pm

Re: BIOS MBR sector dumper

Post by Octocontrabass »

When booting from a USB flash drive, most BIOSes examine the contents of LBA 0 to decide whether INT 0x13 should emulate a hard drive or a floppy drive (or boot in the first place). When emulating a floppy drive, some BIOSes will try to correct mistakes in the BPB after loading LBA 0, presumably to work around issues caused by software that doesn't fill out the BPB correctly when making a bootable USB flash drive.

Your MBR doesn't have a valid partition table, so your PC's BIOS gives you the floppy drive treatment, including "corrections" to your nonexistent BPB.
User avatar
BenLunt
Member
Member
Posts: 1034
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: BIOS MBR sector dumper

Post by BenLunt »

Demindiro, may I point you to a conversation once had a while back about this exact issue. Hopefully it will explain a bit more.
Post Reply