My First MBR

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
abachler
Member
Member
Posts: 33
Joined: Thu Jan 15, 2009 2:21 pm

My First MBR

Post 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
Attachments

[The extension s has been deactivated and can no longer be displayed.]

User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: My First MBR

Post 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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: My First MBR

Post by quanganht »

Although there are still bugs, I have to say congratulations. It's better than doing nothing.
"Programmers are tools for converting caffeine into code."
Dhaann
Posts: 19
Joined: Fri Dec 19, 2008 1:37 pm

Re: My First MBR

Post 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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: My First MBR

Post 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.
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 ]
Post Reply