Subscribe to Windows IT Pro
May 15, 1999 12:00 AM

Blasting MBRs

Windows IT Pro
InstantDoc ID #5327
Rating: (3)

Each of these lines begins with Mov, Xor, or Int, followed by a space, and followed by one or more parameters separated by commas. Type the first line as Mov, followed by a space, and followed by dx,9000 without a space between dx and 9000. If you mistype a command, DEBUG responds with ^ Error. The circumflex (^) points to the parameter that it doesn't understand. (If you've entered assembly language with an earlier DOS version of DEBUG, you'll be pleased that the DEBUG version that comes with Win98 is a lot more forgiving. You can type movdx,9000 without any spaces, and DEBUG still figures out the exact syntax of the assembly language command.)

After you type the above lines, press Enter twice to return to the hyphen. You can check your work by typing

u 100 L 12

which stands for unassemble the 18 (hex 12) bytes starting at address 100. Press Enter, and you'll see what DEBUG thinks you typed. If you really messed up and you want to start over, type q (for quit) and press Enter; you'll return to the C prompt.

If you like what you see, you can activate the program by typing g (for go) at the hyphen and pressing Enter. You'll receive the message Program terminated normally. Your MBR is now wiped clean, and you can start installing NT, Win98, or another OS as if the hard disk were brand new.

I know the first few lines of the program look tortured: The first Mov dx,9000 places the value 9000 hex into the DX register; the next line puts the value of DX into the ES register. Why not just put the value 9000 into ES? Because of a quirk in the Intel architecture, you can't directly place data into the ES register except through other registers. The next line, Xor bx,bx, is a quick way to put the value 0 into the BX register. After ES contains 9000 and BX contains 0, then INT 13 knows where to get the data: ES, BX, or 9000:0. The next command, Mov cx,0001, is necessary because INT 13 expects the cylinder number (0) and the sector number (1) packed together into CX in that way: cylinder/sector. Similarly, Mov dx,0080 packs both the target head (0) and drive (80) into register DX. INT 13 refers to the first physical hard disk as 80, the second as 81, and so on. Mov ax,0301 once more packs two pieces of information into one register. INT 13 identifies the write sector command as function number 3. INT 13 needs to know how many sectors to write—one—and those two get packed together into 0301.

I figured out how to complete this process about 10 years ago. I don't use DEBUG often, but it saves me a couple of times a year; I hope it's useful for you. One more thing—please don't email me for Linux advice. I'm just starting out myself and couldn't be of much help. Happy MBR blasting!

Related Content:

ARTICLE TOOLS

Comments
  • John
    5 years ago
    Nov 26, 2007

    Is that all in this article? The dots at the end suggest more content, but can't find it. Not impressed.

  • Anonymous User
    7 years ago
    Jan 12, 2005

    great!
    old school style works great...
    fixmbr, fdisk /mbr, lilo, etc...etc... did not
    report any error - but still my drive was NOT bootable...

    until I found this superbe article!

    cheerio from switzerland
    guschti

  • Anonymous User
    7 years ago
    Jan 09, 2005

    Of all articles that I have read in search of help, this one is superior to all. This article shows that the writer knows his stuff. thanks a million

  • Anonymous User
    8 years ago
    Dec 23, 2004

    To Whom Wrote This:

    You are great!

    Thanks A Lot!!!!!!!!!!!!!

  • Anonymous User
    8 years ago
    Nov 01, 2004

    I tryed the debug code, but it did not clean the MBR

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.