Debug is originally to kill. Here is the machine debugging tool.
In fact, the origin of Debug, there is also a statement, in the early United States, a computer room, scientists are working in nervousness. At the same time, many large computers are still running. It is probably due to overheating the machine, causing a small bug, so that the computer cannot operate normally. Scientific, I had to stop, catching insects ... The bug is caught, the computer is running normally. Later, this noun is still used to this ....
Although now, there are more and more software, but some, we only need to do it, use Debug to solve, and fast! Next, we learn Debug in all aspects! (In anti-virus, addess, system ...) I will learn some, debug's usage, although, now good software is getting more and more, but some, we only need to do it, you can solve it with Debug. And fast!
DEBUG common command set
Name Interpretation Format
A (askEMBLE) Assembly A [Address]
C (Compare) Compare two memory block C Range Address
D (DUMP) memory 16 credit display D [address] or d [Range]
e (enter) Modify memory byte e address [list]
F (FIN) Preset a memory F Range List
G (GO) execution program g [= address] [address ...]
H (HEXAVITHMETIC) Argumentation H value Value
i (input) Enter i Pataddress from the specified port address
l (loading) read disk L [Address [Driver Seto "
M (MOVE) memory block transmits M Range Address
N (Name) place name n filespec [filespec ...]
o (output) output from the specified port address o portadress byte
Q (quit) end Q
R (register) display and modify register R [register name]
S (SEARCH) Find byte Skew Stroke List
T (trace) tracking execution T [= address] [value]
u (UNASSEMBLE) disassembly U [Address] or Range
W (WRITE) Save W [Address [Driver SECNUM "
? Canadage help?
Debug small assembly a command
The Debug Small Compilation A command is a very useful feature, and many applets have to do it.
Compare some small procedures than compilation, fast.
In Debug, the interrupt is very useful, first let us first understand the interrupt.
The so-called interruption, in fact, that is, when you do something, some people come over to find you, you put down your hand first (in your computer, called protection site)
, Go to the person who calls you, wait, you will return, then do just now. This is a very popular speech.
This will happen when the computer is running, and we call it.
Here is some of his usual interrupt vectors detailed: (Remember, very useful ... huh)
IBM PC interrupt INT10
OOH screen mode settings
Entrance: AH = 0, Al = Display mode code (0--6) 0: 40 * 25 black and white
1: 40 * 25 color
2: 80 * 25 black and white
3: 80 * 25 color text
4: 320 * 200 color
5: 320 * 200 black and white
6: 640 * 200 black and white graphics mode
7: 80 * 25 monochrome characters (monochrome display)
0BH color setting
Entrance: AH = 0b, BL = 0 set background color, BH = 0--15 BL = 1 set color code, BH = 0--1
0Ch written graphic point
Entrance: AH = 0C, CX: DX = Column Number: Line number, Al = Color
ODH readings
Entrance: AH = 0D, CX: DX = Column Number: Line
Return: Al = color
0EH in the current page, writing characters at the current cursor
Entrance: AH = 0E, Al = Character ASCII code, BL = foreground color
OFH display status
Entrance: AH = 0F
Returns: Al = Current display mode, AH = screen column number, BH = current page number
01H cursor settings
Entrance: AH = 1, CH = cursor start line number (00--0C), CL = cursor end line number (00--0C)
Note: CH> CL
02H cursor positioning
Entrance: AH = 2, BH = Page number, DH: DL = starting line: Column
03H read cursor position
Entrance: AH = 3, BH = page number.
Return: DH: DL = starting line: column
06h window on the window
入 品: AH = 6, Al = window upper volume, CH: CL-DH: DL window coordinate
Note: Al = 0 rolled out the window
07H window
Entrance: AH = 7, Al = window Row, CH: CL-DH: DL window coordinates
08H read the current cursor character and attribute
Entrance: AH = 8, BH = page number.
Returns: AH: Al = Character Color: ASCII code for characters
Note: The color code is shown in the comparison table
09h: Writing characters and attributes at the current cursor
Note: The cursor is not moved
Entrance: AH = 9, BH = Page number, BL: Al = Character color: Character's ASCII code, CX = number of repetitions
1 2 3 4 5 6 7 8
BL R G B I R G B
Flashing character base color bright character color
Interrupt vector number
Interrupt number interpretation interrupt number explanation
0 divisor is 0 wrong 19 boot loader
1 Switch Interrupt 1A Call
2 Get control when the NMI 1B keyboard is not masked
3 Discharge Interrupt (CCH) 1C clock interruption is controlled
4 overflow interrupt 1D pointing to the initial parameter table of CRT
5 Screen print interrupt 1e pointing to the box with parameter table
6-7 Reserved 1F 1KB graphics mode
8 timer interrupt (18.2 seconds) 20 End DOS program
9 keyboard interrupt 21 DOS function call
A-D retains 22 end addresses (EXEC)
E-flop disc server interrupt 23 DOS CRTL-BREAK Exit Address
F Reserved 24 DOS Deadly Map Vector
10 screen I / O call 25 DOS absolute disk read
11 Equipment Check Call 26 DOS absolute disk write
12 Memory Check Call 27 End Procedure and resides (Consecution 31H)
13 Floor Panper I / O Call 28-3F DOS Reserved
14 RS-233i / O call 40-7f unused
15-box tape machine I / O call 80-85 Basic reservation
16 Keyboard I / O call 86-F0 Basic Interpretation
17 printer I / O calls F1-FF unused
18 ROM-Basic entrance
Detailed instruction
Call instruction (process call) (Control instruction - long transfer)
Detailed explanation:
Direct calls
Indirect calls (registers)
Indirect calls (memory)
Direct calls
Intercount interconnection
Instruction name
JMP instruction (unconditional transfer instruction) (Control Directive - Long Transfer)
Detailed explanation:
Direct jump directly
Direct jump in short sections
Indirect jump (register)
Indirect jump in the section (memory)
Direct jump
Interior jump
Instruction name
RET instruction (process return) (Control instruction - long transfer)
Detailed explanation:
Segment return
Return to SP within the segment
Segment return
Return to SP during the period
NA / JNBE instruction (control instruction - short transfer) is not less than or not equal to time transfer
JAE / JNB instruction (control instruction - short transfer) is greater than or equal to time transfer
JB / JNAE directive (control instruction - short transfer) is less than transfer
JBE / JNA instruction (control instruction - short transfer) is less than or equal to transfer
JG / JNLE instruction (control instruction - short transfer) is greater than the transfer
JGE / JNL instruction (control instruction - short transfer) is greater than or equal to transfer
JL / JNGE instruction (control instruction - short transfer) is less than transfer
JLE / JNG instruction (control instruction - short transfer) is less than or equal to transfer
JE / JZ instruction (control instruction - short transfer) is equal to transfer
JNE / JNZ instruction (control instruction - short transfer) is not equal to transfer
JC instruction (control instruction - short transfer) is transferred
JNC Directive (Control Command - Short Transfer) Column Transfer
JNO instruction (control instruction - short transfer) does not overflow
JNP / JPO Directive (Control Command - Short Transfer) Package is odd-when
JNS instruction (control instruction - short transfer) symbol bit is "0" Transfer JO instruction (control command - short transfer) overflow transfer
JP / JPE instruction (control instruction - short transfer) parity is even when even
JS instruction (Control Command - Short Transfer) Symbol Bits Transfer when "1"
LOOP instruction (loop control instruction - short transfer) CX is not 0 time loop
LOOPE / LOOPZ directive (loop control command - short transfer) CX is not 0 and log z = 1 cycle
Loopne / loopnz command (loop control instruction - short transfer) CX is not 0 and log z = 0 cycle
JCXZ instruction (cyclic control command - short transfer) CX is 0
★ INT command (interrupt instruction) interrupt command (after detailed)
INTO instruction (interrupt instruction) overflow interrupt
IRET Directive (Interrupt Direction) Interrupt Back
Instruction name
SHL instruction (logical left)
SAL command (arithmetic left shift)
SHR instruction (logic right shift)
SAR directive (calculation right shift) register, 1
ROL instruction (loop left shift) register, CL
ROR directive (loop right shift) memory, 1
RCL instruction (transmissive by transmissive loop) memory, CL
RCR instructions (through the loop right shift) (logical operation)
NOT command (refueling operation) register
(Logical operation) memory
AND Directive (and calculation) (logical operation)
Register and register register
Register and memory register
Memory and register memory
Summer and memory memory
Some and accumulator accumulator
OR instruction (or calculation) (logical operation)
Register OR register register
Register or memory register
Memory OR register memory
MUM Memory Memory
MUSE OR Cumulator Cumulator
TEST Directive (Test) (Logical Operation)
Register TEST register
Register TEST memory
Register TEST immediately
Memory Test
Cumulator TEST immediately
MOVS instruction (string transfer) (string operation instruction)
Single transfer
Repeat transfer
CMPS instruction (string comparison) (string operation instruction)
Single comparison
Repeated comparison
SCAS instruction (string scan) (string operation instruction)
Single search
Repeated search
LODS directive (load string)
(String Operation Directive)
Single loading
Repeated loading
STOS instruction (save string) (String Operation Directive)
Single storage
Repeat storage
MOV command (transfer words or bytes) (Data Transfer Command)
Transfer between registers and registers
Memory and register send an immediate number to the memory
Immediately send to the register
Memory is transmitted to the accumulator
Cumulator transfer memory
Register transfer to segment register
Memory delivery to segment register
Segment register transfer to the register
Segment register transmits to the memory
POP instruction (pop up the word popping) (Data Transfer Command)
Push directive (put the word into the stack)
Memory
register
Segment message
XCHG instruction (exchange word or byte) (data transfer command)
Register and register exchange
Memory and register exchange
Register and accumulator exchange
IN command (port input) (data transfer command)
Direct input
Indirect input
OUT command (port output) (Data Transfer Directive)
Direct output
Indirect output
Add instruction (addition) (arithmetic directive)
ADC directive (with carrying)
Register Register Register
Register memory register
Memory Register Memory
Immediately memory memory
Immediate accumulator accumulator
INC instructions (plus 1) (arithmetic directive)
Memory increment
Register increment
SUB instruction (subtraction) (arithmetic directive)
SBB instruction (with borrowing subtraction)
Register-Register Register
Register - Memory Register
Memory-Register Memory
Immediately - Memory Memory
Immediately - accumulator accumulator
Dec instruction (minus 1) (arithmetic directive)
Memory reduction
Register reduction
NEC directive (seeking anti-reverse, decrease in 0)
Register
Memory
CMP instruction (comparison) (arithmetic directive)
Comparison of registers and registers
Comparison of registers and memory
Register and immediate comparison
Memory and immediate comparison
Cumulator and immediate
MUL instruction (no symbol multiplication) (arithmetic directive)
IMUL Directive (Integer Multiplication)
Multiplier with 8 registers
Multiplier with 16-bit registers
Multiplion with 8 storage units
Multiplied with 16-bit storage unit
DIV instruction (no symbol division) (arithmetic directive)
IDIV instruction (integer division)
Except for 8-bit registers
Divided by 16-bit registers
Except for 8-bit storage unit
Sedently by 16-bit storage unit
Debug actual combat
1. View the production date, version of the motherboard
D fff: 05
D fe00: 0e
2. Simulate the REST key function
A
: 100 JMP ffff: 0000
: 105
G
3. Fast formatting floppy disk
L 100 0 0 * 'Insert a finished floppy disk
W 100 0 0 * 'put in a formatting floppy disk
Note: *: 720K E | 1.2M ID | 1.44M 21
4. Hard disk formatting two methods
(1) g = c800: 05
(2) a 100
Mov AX, 0703
MOV CX, 0001
MOV DX, 0080
INT 13
INT 3
G 100
5. Accelerate keyboard
A
Mov AX, 0305
MOV BX, 0000
INT 16
INT 20
RCX
10
n fast.com
w
Qi
6. Turn off the display (press any key when recover)
A
MOV AX, 1201
MOV BL, 36
INT 10MOV AH, 0
INT 16
MOV AX, 1200
INT 10
RCX
10
n CRT-OF.COM
w
Qi
7. Repair of hard disk DOS boot record
Add a formatting floppy disk in the floppy drive
Debug
-L 100 2 0 1
-w 100 0 50 1
Put the floppy disk into the failed flush
Debug
-L 100 0 50 1
-w 100 2 0 1
-Q
8. Clear COMS setup password
Debug
-A
MOV BX, 0038
MOV CX, 0000
MOV AX, BX
OUT 70, Al
INC CX
CMP CX, 0006
JNZ 0106
INT 20
-RCX
: 20
-nclearpassword.com
-w
-Q
Note: The above is suitable for Super and DTK machines, for AST, because his password is placed at COMS 4ch-51h address, as long as it is: MOV BX, 0038 is changed to: MOV
BX, 004c can
9. Cancel the password of the COMS (initialize the COMS data)
-o 70, 10
-o 71, 10
-g
-Q
10. Save the hard disk main boot record to the file
Debug
-A
Mov AX, 0201
MOV BX, 0200
MOV CX, 0001
MOV DX, 0080
Mov Int 13
INT 3
-RCX
: 200
-nboot.dat
-w
-Q
11. Call the interrupt to restart the computer (can be file)
Debug
-A
INT 19
INT 20
-RCX
:2
-nreset.com
-w
-Q
Debug main order
Debug is a highly tool for assembly language design, which provides a very effective debugging means for assembly language programmers by single-step, setting breakpoints, etc.
First, the call of Debug program
At the DOS prompt, you can type commands:
C: / debug [d:] [PATH] [filename [.ext> [PARM1] [PARM2]
Where the file name is the name of the debug file. If the user typed file, DEBUG loads the specified file into the memory, and the user can debug it. If the file name is not typed, the user can work with the content of the current memory, or put the required files into the memory with the debug command n and l and then debug. The D specified drive path is path, PARM1 and PARM2, the command parameters required to run the debug file.
After the Debug program is transferred, a prompt will appear, and the debug command can be used to debug the program.
Second, the main order of Debug
1. Display the command d (DUMP) of the storage unit, the format is:
_D [address] or _d [Range]
For example, the method of displaying the content of the storage unit is:
-D100 120
18E4: 0100 C7 06 04 02 38 01 C7 06-06 02 00 02 C7 06 08 02 g ... 8.g ..... g ...
18E $: 0110 02 02 BB 04 02 E8 02 00-CD 20 50 51 56 57 8B 37 ..; .. h..m Pqvw.
Seduce
18E4: 0120 8B
Where 0100 to 0120 are the unit content displayed by Debug, and the left side is expressed with each byte, and the right side is used to represent each byte, indicating that the unplanable character is used. There is no specified segment address here, and the D command automatically displays the contents of the DS segment. If only the first address is specified, the 80-byte content starting from the first address is displayed. If there is no specified address at all, the content after the last unit displayed on the previous D command is displayed.
2. There are two commands to modify the content of the storage unit.
· Enter the command E (Enter), there are two formats as follows: The first format can replace the designated range of storage units with a given content table. Command format is: -e address [list]
For example, -e ds: 100 f3'xyz'8d
Where F3, 'X', 'Y', 'Z' and each byte can be used in this five bytes to replace the original content of the storage unit DS: 0100 to 0104.
The second format is a method of modifying a unit-by-unit unit. The command format is:
-E address
For example, -E DS: 100
It may be displayed as:
18E4: 0100 89.-
If you need to modify the contents of the unit to 78, the user can type 78 directly, then press the "Space" button to display the content of the next unit, as follows:
18E4: 0100 89.78 1B.-
In this way, the user can constantly modify the contents of the successive unit until the command is ended with the ENTER key.
· Fill in the command F (Fill), its format:
-F Range List
For example: -f 4ba: 0100 5 f3'xyz'8d
The 04ba: 0100 ~ 0104 unit contains the contents of the designated five bytes. If the number of bytes in the list exceeds the specified range, the exceeding item is ignored; if the number of bytes of the LIST is less than the specified range, repeatedly fill it until all the specified units are filled.
3) Check and modify the command R (Register) of the register content, and it has three formats as follows:
· Display all registers content and flag bits in the CPU, which format is:
-R
For example, -r
AX = 0000 bx = 0000 cx = 010A dx = 0000 sp = fffe bp = 0000 Si = 0000 di = 0000
DS = 18e4 es = 18e4 ss = 18e4 cs = 18e4 ip = 0100 NV UP DI PL NZ NA PO NC
18E4: 0100 C70604023801 MOV WORD PTR [0204], 0138 DS: 0204 = 0000
· Display and modify a register content, format:
-Rregister name
For example, type
-R AX
The system will respond as follows:
AX F1F4
:
That is, the current content of the AX register is F1F4. If you do not modify, press Enter, otherwise, you can type the content you want to modify, such as:
-R bx
BX 0369
: 059F
Then modify the contents of the BX register to 059F.
· Display and modify the flag status, the command format is:
The -RF system will respond, such as:
OV DN EI NG ZR AC PE CY-
At this point, if you do not modify its content, press Enter, otherwise, click on the content you want to modify, such as:
OV DN EI NG ZR AC PE CY-PONZDINV
That is, it can be seen that the order of typing can be arbitrary.
4) Run the command G, its format is:
-G [= address1] [address2 [address3 ...>
Among them, address 1 specifies the starting address of the run, if not specified, starting from the current CS: IP. The following address is a breakpoint address. When the instruction is executed, the content of all registers and flags, and the instructions to be executed will be stopped. 5) Tracking Commands T (Trace), there are two formats:
· A command track
-T [= address]
After executing a command from the specified address, stop, display all registers content and flags of the flag. If the address is not specified, execute from the current CS: IP.
· Multiple instructions track
-T [= address] [value]
Stop from the specified address to execute the N instruction, N is specified by value.
6) Assemble Command A (Assemble), its format is:
-A [address]
This command allows you to enter the assembly language statement, and can edit them into machine code and store them in the storage area starting from the specified address. Must note: Debug looks into a hexadecimal number of numbers, so if you want to type a decimal number, then it should be described, such as 100D.
7) There are two formats in the disassembly command u (UNASSEMBLE).
· Starting from the designated address, anti-assembly 32 bytes, format:
-U [address]
E.g:
-U100
18E4: 0100 C70604023801 MOV Word PTR [0204], 0138
18E4: 0106 C70606020002 MOV WORD PTR [0206], 0200
18E4: 010C C70606020202 MOV WORD PTR [0208], 0202
18E4: 0112 BBO4O2 MOV BX, 0204
18E4: 0115 E80200 Call 011a
18E4: 0118 CD20 INT 20
18E4: 011A 50 Push AX
18E4: 011B 51 PUSH CX
18E4: 011C 56 Push Si
18E4: 011D 57 Push Di
18E4: 011E 8B37 MOV SI, [BX]
If the address is omitted, 32 bytes will be displayed from the next unit of the last U command.
· A disassembly of memory cells within the specified range, format:
-U [range]
E.g:
-U100 10C
18E4: 0100 C70604023801 MOV Word PTR [0204], 0138
18E4: 0106 C70606020002 MOV WORD PTR [0206], 0200
18E4: 010C C70606020202 MOV WORD PTR [0208], 0202
or
-u100 112
18E4: 0100 C70604023801 MOV Word PTR [0204], 0138
18E4: 0106 C70606020002 MOV WORD PTR [0206], 0200
18E4: 010C C70606020202 MOV WORD PTR [0208], 0202
It can be seen that these two formats are equivalent.
8) Name Command N (Name), its format is:
-N filespecs [filespecs]
The commands format the two file identifiers in the two file control blocks of CS: 5ch and CS: 6ch so that the file is loaded with the file with the L or W command. Filespecs formats can be:
[D:] [PATH] filename [.ext]
E.g,
-N myprog
-L
-
The file MyProg can be loaded into the memory.
9) Load Command (LOAD), there are two functions.
• Mount the contents of the specified sector range on the disk to the area starting from the specified address. The format is:
-L [Address [Drive Sector Sector] · Load the specified file, its format:
-L [Address]
This command is loaded into the file specified by the file control block in CS: 5ch. If an address is not specified, it is loaded into the storage area starting with CS: 0100.
10) Write command W (Write), there are two functions.
· Write the data to the specified sector of the disk. The format is:
-W Address Drive Sector Sector
· Write data into the specified file. The format is:
-W [address]
This command writes data in the specified storage area in the file specified by the file control block at CS: 5CH. If the address is not specified, the data starts from CS: 0100. The number of bytes to be written should be placed in BX and CX first.
11) Exit the Debug Command Q (QUIT), which is:
-Q
It exits Debug and returns DOS. This command does not have a storage function, if the save disk should be used first.
Question: The beginner asked a low-level issue, after executing Debug-a, if there is a line of input errors, how to change this line?
Reply:
Join the following input:
D: / PWIN95 / Desktop> Debug
-A
2129: 0100MovaX, 200
2129: 0103MOVBX, 200
2129: 0106MoVCX, 200
2129: 0109
At this time, I found MOVBX, 200 sentences, should be MOVBX, 20, can knock back to the "-" status, then enter:
-a103
2129: 0103MOVBX, 20
If you are more or less, you don't have to re-enter, you can use the m command to move the rear program to remove or add program space.