『楼 主』:
转贴《DEBUG实用小程序集锦》
使用 LLM 解释/回答一下
DEBUG实用小程序集锦 --此贴为转贴
1. 非物理0磁道坏软盘的修复
此种损坏从软盘盘面上来看并没有明显的划伤和霉变。一般可以恢复其数据,也可是软盘重新在利用。
处理方法如下:
Ⅰ. 进入debug
Ⅱ. 取一张引导区没有损坏的好磁盘,插入软驱
-L 100 0 0 1
Ⅲ. 插入损坏的磁盘到软驱
-W 100 0 0 1
-Q
注意:好盘与坏盘容量必须相同
2. 物理0磁道坏软盘中的数据读取
对于0磁道损坏的磁盘,一般来说是应该抛弃了,当你也不妨试一试已下方法:
磁化处理:用较强的磁铁在靠近坏磁盘的表面处反复移动,切不可碰到磁盘介质,以免划伤表面,然后在试试格式化。
软盘换面:小心的将磁盘打开,坚磁片与金属芯片分开,方面后再按原来的方法粘在一起即可,在重新格式化。
Diskfix:对于diskfix想必大家都用的比较多了,里面的磁盘修复功能很好用的。能修复大多数磁盘表面错误。
3. 硬盘启动失败处理
在正常机上格式化一张软盘,无其它数据
进入debug
-L 0 2 0 1
-W 0 0 0 1
-Q
用系统盘启动故障机后
在进入debug
-L 0 0 0 1
-w 0 2 0 1
-Q
4. 软盘不能正确读取解决方法
如果使用软盘时出现如下提示
General failure error reading drive A
可以用以下方法解决:
将一张好盘插入软驱
进入debug
-A 100
****:*100 MOV AL,0
****:**** MOV CX,1
****:**** MOV DX,0
****:**** MOV BX,1000
****:**** INT 25
****:**** INT 20
回车
-G=0100
插入坏盘并进入Debug
-A 200
****:*100 MOV AL,1
****:**** MOV CX,1
****:**** MOV DX,0
****:**** MOV BX,1000
****:**** INT 26
****:**** INT 20
回车
-G=200
5. CMOS 数据的保存,恢复
CMOSRAM的'地址口'的口地址为 70H '数据口'的口地址为 71H 读取时只需将读的CMOSRAM的地址送到70H,随后就可以从71 H中得到所需数据。
(1)读取CMOS数据 进入Debug
-A 100
****:*100 MOV BX,1000
****:**** MOV CX,0040
****:**** MOV AX,0000
****:0109 MOV DX,CX
****:**** MOV CX,0005
****:010E LOOP 010E
****:**** OUT 70,AL
****:**** MOV CX,0005
****:0115 LOOP 0115
****:**** IN AL,71
****:**** MOV ,AL
****:**** CMP AH,0E
****:**** JB 0123
****:**** ADD AH,80
****:0123 INC AH
****:**** INC BX
****:**** MOV CX,DX
****:**** MOV AL,AH
****:**** LOOP 0109
****:**** MOV AH,3C
****:**** MOV DX,0150
****:**** MOV CX,0020
****:**** INT 21
****:**** MOV BX,AX
****:**** MOV DX,1000
****:**** MOV CX,0040
****:**** MOV AH,40
****:**** INT 21
****:**** MOV AH,4C
****:**** INT 21
-A 150
****:0150 DB "CMOS.DAT",0
****:0159
-R CX
CX 0000
:60
-N SAVE CMOS.COM
-W
-Q
-W 100 2 0 1
-Q
(2)恢复CMOS数据 进入Debug
-A 100
****:*100 MOV CX,0150
****:**** MOV AH,3D
****:**** MOV AL,00
****:**** INT 21
****:**** MOV DX,1000
****:**** MOV BX,AX
****:**** MOV CX,0040
****:**** MOV AH,3F
****:**** INT 21
****:**** MOV AX,0000
****:**** MOV BX,DX
****:**** MOV DX,CX
****:**** MOV CX,0005
****:**** LOOP 011F
****:**** MOV AL,AH
****:**** OUT 70,AL
****:**** MOV CX,0005
****:**** LOOP 0128
****:**** MOV AL,
****:**** OUT 71,AL
****:**** JB 0136
****:**** ADD AH,80
****:**** INC AH
****:**** INC BX
****:**** MOV CX,DX
****:**** LOOP 011A
****:**** MOV AX,0040
****:**** MOV DS,AX
****:**** MOV AX,1234
****:**** MOV ,AX
****:**** JMP FFFF:0000
-A 150
****:0150 DB "CMOS.DAT",0
****:0159
-R CX
CX 0000
:60
-N WRITE CMOS.COM
-W
-Q
6. DOS 引导扇区数据的保存与恢复
DOS引导程序是被读到内存0000:7C00初开始执行的
获得正常的引导程序
进入Debug
-L 100 2 0 1
-N A<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0">OSBOOT.COM
-R CX
:200
-W
-Q
装入引导程序
进入Debug
-N A<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0">OSBOOT.COM
-L
-R CX
:200
-W 100 2 0 1
-Q
7. 硬盘主引导扇区数据的保存与恢复
硬盘工作正常时读取主引导扇区信息
注意:当分区改变时不能用此数据恢复
保存主引导扇区数据进入Debug
-A 100
MOV AX,0201
MOV BX,0110
MOV CX,0001
MOV DX,0080
INT 13
INT 3
-G=100
-E 102 3
-E 10E C3
-R BX
BX 0110
:0
-R CX
CX 0001
:210
-N A:RBOOT.COM
-W
-Q
恢复主引导扇区数据:只需运行A盘的RBOOT.COM
8. 硬盘非分配表备份与恢复
计算机运行正常时分配表备份
进入Debug
-L 100 2 0 1
-N A<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0">BRUP.DAT
-R CX
:200
-W
恢复
进入Debug
-N A<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0">BRUP.DAT
-L
-W 100 2 0 1
-Q
9. 硬盘保护卡内幕
对于经常在外边上机的人来说,计算机维护人员一旦设置硬盘保护卡,自己作一些事来特别麻烦,想不想屏蔽掉硬盘保护卡,用以下方法或许可以借鉴:
进入Debug
-A 100
MOV AH,0
MOV DL,0
INT 13
-T
一直按T知道找到 CS=F000 记下此时 DS 的值 如:1234
-E E0:4C
34 12 00 F0
-Q
10. 用Debuf作硬盘低级格式化
硬盘低级格式化一般用DM,但Debug也可以低级格式化硬盘
进入Debug
-A 100
MOV AX,500
MOV BX,180
MOV CX,0
MOV DX,80
INT 13
INT 3
-E 180 0 0 0 2
-Q
11. 冷启动与热启动
用Debug实现系统冷启动与热启动程序
冷启动:
-A 100
JMP FFFF:0
INT 20
-N A:RESET.COM
-R CX
:0007
-w
-Q
热启动:
-A 100
MOV AX,0040
MOV DS,AX
MOV AX,1234
MOV SI,0072
MOV (SI),AX
JMP FFFF:0
-N A:RSET.COM
-R CX
:0014
-W
-Q
12. DOS内部命令加密
如加密 dir
用pctools或diskedit找 C:下的COMMAND.COM文件
编辑该文件
PCTOOLS中:F-----F1 然后找所有03 44 49 52 找到后按F5修改成你所要的值 如: foo 以后只有输入foo 才能列出文件或文件目录。
diskfix 有良好的界面,操作起来和pctools差不多。
注意:如果不能修改,则解开文件的锁定 luck
其它命令代码
type 04 54 59 50 45
cd 02 43 44
del 03 44 45 44
copy 04 43 49 50 59
### Collection of DEBUG Practical Mini Programs
--This post is a reprint
### 1. Repair of Non-Physically Damaged Track 0 Floppy Disks
Such damage does not have obvious scratches or mildew on the floppy disk surface. Generally, its data can be restored, and the floppy disk can be reused.
The processing method is as follows:
Ⅰ. Enter DEBUG
Ⅱ. Take a good disk with an undamaged boot sector, insert it into the floppy drive
-L 100 0 0 1
Ⅲ. Insert the damaged disk into the floppy drive
-W 100 0 0 1
-Q
Note: The capacities of the good disk and the bad disk must be the same
### 2. Reading Data from Physically Damaged Track 0 Floppy Disks
For a disk with track 0 damaged, generally, it should be discarded. But you may as well try the following methods:
Magnetization treatment: Use a strong magnet to repeatedly move near the surface of the bad disk, but be careful not to touch the disk medium to avoid scratching the surface, then try formatting again.
Floppy disk flipping: Carefully open the disk, separate the magnetic sheet from the metal chip, then stick them together according to the original method, and then reformat.
Diskfix: I believe everyone uses Diskfix more, and its disk repair function is very useful. It can repair most disk surface errors.
### 3. Handling of Hard Disk Boot Failure
Format a floppy disk on a normal machine with no other data
Enter DEBUG
-L 0 2 0 1
-W 0 0 0 1
-Q
After booting the faulty machine with the system disk
Enter DEBUG again
-L 0 0 0 1
-w 0 2 0 1
-Q
### 4. Solution to Incorrect Floppy Disk Reading
If the following prompt appears when using a floppy disk
General failure error reading drive A
The following method can be used to solve it:
Insert a good disk into the floppy drive
Enter DEBUG
-A 100
****: *100 MOV AL,0
****: **** MOV CX,1
****: **** MOV DX,0
****: **** MOV BX,1000
****: **** INT 25
****: **** INT 20
Press Enter
-G=0100
Insert the bad disk and enter Debug
-A 200
****: *100 MOV AL,1
****: **** MOV CX,1
****: **** MOV DX,0
****: **** MOV BX,1000
****: **** INT 26
****: **** INT 20
Press Enter
-G=200
### 5. Saving and Restoring CMOS Data
The 'address port' of CMOSRAM has an I/O port address of 70H, and the 'data port' has an I/O port address of 71H. When reading, just send the address of the CMOSRAM to be read to 70H, and then you can get the required data from 71H.
(1) Reading CMOS data Enter Debug
-A 100
****: *100 MOV BX,1000
****: **** MOV CX,0040
****: **** MOV AX,0000
****: 0109 MOV DX,CX
****: **** MOV CX,0005
****: 010E LOOP 010E
****: **** OUT 70,AL
****: **** MOV CX,0005
****: 0115 LOOP 0115
****: **** IN AL,71
****: **** MOV ,AL
****: **** CMP AH,0E
****: **** JB 0123
****: **** ADD AH,80
****: 0123 INC AH
****: **** INC BX
****: **** MOV CX,DX
****: **** MOV AL,AH
****: **** LOOP 0109
****: **** MOV AH,3C
****: **** MOV DX,0150
****: **** MOV CX,0020
****: **** INT 21
****: **** MOV BX,AX
****: **** MOV DX,1000
****: **** MOV CX,0040
****: **** MOV AH,40
****: **** INT 21
****: **** MOV AH,4C
****: **** INT 21
-A 150
****: 0150 DB "CMOS.DAT",0
****: 0159
-R CX
CX 0000
:60
-N SAVE CMOS.COM
-W
-Q
-W 100 2 0 1
-Q
(2) Restoring CMOS data Enter Debug
-A 100
****: *100 MOV CX,0150
****: **** MOV AH,3D
****: **** MOV AL,00
****: **** INT 21
****: **** MOV DX,1000
****: **** MOV BX,AX
****: **** MOV CX,0040
****: **** MOV AH,3F
****: **** INT 21
****: **** MOV AX,0000
****: **** MOV BX,DX
****: **** MOV DX,CX
****: **** MOV CX,0005
****: **** LOOP 011F
****: **** MOV AL,AH
****: **** OUT 70,AL
****: **** MOV CX,0005
****: **** LOOP 0128
****: **** MOV AL,
****: **** OUT 71,AL
****: **** JB 0136
****: **** ADD AH,80
****: **** INC AH
****: **** INC BX
****: **** MOV CX,DX
****: **** LOOP 011A
****: **** MOV AX,0040
****: **** MOV DS,AX
****: **** MOV AX,1234
****: **** MOV ,AX
****: **** JMP FFFF:0000
-A 150
****: 0150 DB "CMOS.DAT",0
****: 0159
-R CX
CX 0000
:60
-N WRITE CMOS.COM
-W
-Q
### 6. Saving and Restoring DOS Boot Sector Data
The DOS boot program is read and starts executing from memory 0000:7C00
Obtain the normal boot program
Enter Debug
-L 100 2 0 1
-N A:DOSBOOT.COM
-R CX
:200
-W
-Q
Load the boot program
Enter Debug
-N A:DOSBOOT.COM
-L
-R CX
:200
-W 100 2 0 1
-Q
### 7. Saving and Restoring Hard Disk Master Boot Sector Data
Read the master boot sector information when the hard disk is working normally
Note: This data cannot be used for restoration when the partition is changed
Save the master boot sector data Enter Debug
-A 100
MOV AX,0201
MOV BX,0110
MOV CX,0001
MOV DX,0080
INT 13
INT 3
-G=100
-E 102 3
-E 10E C3
-R BX
BX 0110
:0
-R CX
CX 0001
:210
-N A:RBOOT.COM
-W
-Q
Restore the master boot sector data: Just run RBOOT.COM on drive A
### 8. Backup and Restoration of Hard Disk Non-Allocation Table
Backup the allocation table when the computer is running normally
Enter Debug
-L 100 2 0 1
-N A:DBRUP.DAT
-R CX
:200
-W
Restore
Enter Debug
-N A:DBRUP.DAT
-L
-W 100 2 0 1
-Q
### 9. Inside Information of Hard Disk Protection Card
For people who often use computers outside, once the computer maintenance personnel set up a hard disk protection card, it is very troublesome to do some things by themselves. Do you want to shield the hard disk protection card? The following method may be referable:
Enter Debug
-A 100
MOV AH,0
MOV DL,0
INT 13
-T
Press T continuously until CS=F000, then record the value of DS at this time, such as: 1234
-E E0:4C
34 12 00 F0
-Q
### 10. Low-Level Formatting of Hard Disk with Debuf
Hard disk low-level formatting is generally done with DM, but DEBUG can also be used for low-level formatting of the hard disk
Enter Debug
-A 100
MOV AX,500
MOV BX,180
MOV CX,0
MOV DX,80
INT 13
INT 3
-E 180 0 0 0 2
-Q
### 11. Cold Boot and Hot Boot
Use DEBUG to implement system cold boot and hot boot programs
Cold boot:
-A 100
JMP FFFF:0
INT 20
-N A:RESET.COM
-R CX
:0007
-w
-Q
Hot boot:
-A 100
MOV AX,0040
MOV DS,AX
MOV AX,1234
MOV SI,0072
MOV (SI),AX
JMP FFFF:0
-N A:RSET.COM
-R CX
:0014
-W
-Q
### 12. Encryption of DOS Internal Commands
For example, encrypt dir
Find the COMMAND.COM file under C: with pctools or diskedit
Edit this file
In PCTOOLS: F-----F1 Then find all 03 44 49 52, and then press F5 to modify it to the value you want. For example: foo, then only by entering foo can the files or file directories be listed.
Diskfix has a good interface, and the operation is similar to pctools.
Note: If it cannot be modified, unlock the file's lock luck
Other command codes
type 04 54 59 50 45
cd 02 43 44
del 03 44 45 44
copy 04 43 49 50 59
|