Dell Debug command used and how to restore/recover data

gph19a

Distinguished
Sep 22, 2011
1
0
18,510
Hello,
Dell tech guy used the DEBUG command on the laptop despite our telling him repeatedly that my system/ windows/ softwares are running fine and there is a lot of data in different partitions of the drive. The only issue was that the pc health checkup program suggested Harddisk test failed. The tech did not even once tell us to take the databackup and only suggested that he is moving the bad sectors by the command and the system will be fine after it. And since then the system is lying with "boot drive not found message". Now how to get the data restored/recoverd. GPH.
The commands used were:
debug
-F 200 L1000 0
-A CS:100
xxxx:0100 MOV AX,301
xxxx:0103 MOV BX,200
xxxx:0106 MOV CX,1
xxxx:0109 MOV DX,80
xxxx:010C INT 13
xxxx:010E INT 20
xxxx:0110
-G
 
Short answer:

The Debug code has zeroed out your MBR and partition table in LBA 0.

You should be able to rebuild it using TestDisk (freeware):
http://www.cgsecurity.org/wiki/TestDisk


Long answer:

The Debug commands do the following:

1/ (F)ill a block of memory of (L)ength 0x1000 bytes beginning at address 0x200 with a value of 0

2/ (A)ssemble a program beginning at address 0x100

3/ (G)o to address 0x100 and execute the program

Debug's command options can be listed by typing "?" at the prompt.

The program code loads CPU registers AX, BX, CX, and DX, and then executes an INT13 instruction. INT20 returns control to the system.

The following article explains the INT13 services:
http://en.wikipedia.org/wiki/INT_13H

AX is preloaded with a value 0x0301. This means that AH = 0x03 and AL = 0x01.

According to the Function Table, AH = 03h executes a "Write Sectors To Drive" function:
http://en.wikipedia.org/wiki/INT_13H#INT_13h_AH.3D03h:_Write_Sectors_To_Drive

Now ...

BX = 0x0200
CX = 0x0001, CH = 0x00, CL = 0x01
DX = 0x0080, DH = 0x00, DL = 0x80

So the INT13 code writes 1 sector of information to sector 1, track 0, head 0 on the first hard disk (DL = 80h).

http://en.wikipedia.org/wiki/INT_13H#Drive_Table

BX is the "Buffer Address Pointer", so this means that the data from address 0x200 to 0x3FF will be written to LBA 0 of the HDD. Therefore the partition table and MBR code will be replaced with zeros.