![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-18 09:46 |
47,814 topics / 349,907 posts / today 0 new / 48,259 members |
| DOS开发编程 & 发展交流 (开发室) » Repost: "Collection of Practical DEBUG Mini Programs" |
| Printable Version 3,131 / 6 |
| Floor1 ko20010214 | Posted 2002-10-21 00:00 |
| 版主 Posts 1,628 Credits 7,296 | |
|
### 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 OSBOOT.COM -R CX :200 -W -Q Load the boot program Enter Debug -N A OSBOOT.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 BRUP.DAT -R CX :200 -W Restore Enter Debug -N A BRUP.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 |
|
| Floor2 么心么肺 | Posted 2002-10-22 00:00 |
| 初级用户 Posts 2 Credits 107 | |
|
I haven't seen these things for a long time, and there is a very familiar feeling.
Worth collecting |
|
| Floor3 bengou | Posted 2003-03-06 00:00 |
| 初级用户 Posts 3 Credits 116 | |
|
I feel the same!
|
|
| Floor4 bgn | Posted 2003-03-23 00:00 |
| 中级用户 Posts 78 Credits 349 | |
|
Indeed, that's the case.
![]() |
|
| Floor5 pluto_zj | Posted 2003-05-08 00:00 |
| 初级用户 Posts 19 Credits 162 | |
|
The several LOOPs in that program for reading CMOS look a bit strange. Who can explain their functions?
|
|
| Floor6 enjoy | Posted 2003-05-17 00:00 |
| 初级用户 Posts 14 Credits 146 | |
|
Thank you very much!!!
|
|
| Floor7 oyster | Posted 2003-06-07 00:00 |
| 初级用户 Posts 7 Credits 140 | |
|
An expert!
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |