Here is my first MBR, I wrote it to enable access to >2TB drives. Any questions or comments are welcome, and especially bug/error reports.
Assembled with nasm
My First MBR
My First MBR
- Attachments
-
[The extension s has been deactivated and can no longer be displayed.]
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: My First MBR
Fist of all, this is the wrong sub-forum for such things. Next time, try "Announcements, Test Requests, & Job openings"; it really makes looking for topics a pain if we don't respect this.
Bugs:
Bugs:
- movb rep... I assume you meant rep movsb, when moving the sector.
- Why do you insist on playing with DL? You don't need to specify any drive, BIOS does that for you.
- You only check to see if the first partition is active, the rest remain unchecked.
- The CPU won't halt if an IRQ comes along. CLI first.
- You don't properly check to see if you really support EDD, only do it superficially.
- You jump to the boot sector even if there was an error on the CHS read.
- The boot sector isn't checked for a signature.
- Why do "mov ax", "add ax", "mov si", when you can simply "lea si". Note that "add si" also works, in case you didn't know about LEA
- The disk address buffer should be hardcoded. Why on earth would you make the code give it values if they are fixed? It makes no sense...
- If there's a problem on LBA reads, you may end up reading forever.
- Why are the LBA-64 fields named "partition_x_hi"?
- I can't see the reason for adding the .data and .bss sections.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: My First MBR
Although there are still bugs, I have to say congratulations. It's better than doing nothing.
"Programmers are tools for converting caffeine into code."
Re: My First MBR
Love4Boobies wrote:Fist of all, this is the wrong sub-forum for such things. Next time, try "Announcements, Test Requests, & Job openings"; it really makes looking for topics a pain if we don't respect this.
Bugs:Also, I'm not sure about the few LBA-64 lines as I am unfamiliar with the thing. AFAIK, it's still a draft so it's never implemented anyway.
- movb rep... I assume you meant rep movsb, when moving the sector.
- Why do you insist on playing with DL? You don't need to specify any drive, BIOS does that for you.
- You only check to see if the first partition is active, the rest remain unchecked.
- The CPU won't halt if an IRQ comes along. CLI first.
- You don't properly check to see if you really support EDD, only do it superficially.
- You jump to the boot sector even if there was an error on the CHS read.
- The boot sector isn't checked for a signature.
- Why do "mov ax", "add ax", "mov si", when you can simply "lea si". Note that "add si" also works, in case you didn't know about LEA
- The disk address buffer should be hardcoded. Why on earth would you make the code give it values if they are fixed? It makes no sense...
- If there's a problem on LBA reads, you may end up reading forever.
- Why are the LBA-64 fields named "partition_x_hi"?
- I can't see the reason for adding the .data and .bss sections.
Can u also FIX the bugs? I've searched for a good MBR a lot of weeks, so it would be nice if u can make this mbr without bugs
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: My First MBR
Sure, here's mine. It has support for both the legacy and EDD interfaces and very good error detection. It's commented fairly well because I also used it for a tutorial I was writing. If you're wondering why I used NASM structures, it was because I also presented some of the NASM functionaility. Let me know how it works out for you.
- Attachments
-
- mbr.asm
- (4.39 KiB) Downloaded 93 times
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]