Page 1 of 1

My First MBR

Posted: Fri Jan 23, 2009 4:21 pm
by abachler
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

Re: My First MBR

Posted: Sat Jan 24, 2009 2:37 pm
by Love4Boobies
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:
  • 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 :wink:
  • 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... :roll:
  • 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.
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.

Re: My First MBR

Posted: Sun Jan 25, 2009 12:39 am
by quanganht
Although there are still bugs, I have to say congratulations. It's better than doing nothing.

Re: My First MBR

Posted: Sat Feb 14, 2009 7:49 am
by Dhaann
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:
  • 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 :wink:
  • 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... :roll:
  • 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.
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.

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 :D

Re: My First MBR

Posted: Sat Feb 14, 2009 8:18 am
by Love4Boobies
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.