Show all registers
Format:-r function: display the value of the internal registers of the CPU in hexadecimal format; display the value of each flag bit (except TF) of the sign register in symbolic form; disassembles the memory content referred to by CS: IP into an instruction, which can be considered as the instruction to be executed. For example:
-R press ENTER
Ax = 0000 BX = 0000 Cx = 0000 dx = 0000 sp = ffee BP = 0000 Si = 0000 di = 0000
DS = 0af0 es = 0af0 Ss = 0af0 cs = 0af0 IP = 0200 NV up ei pl nz Na Po NC
0af0: 0200 b238 mov DL, 38
Zhi: cs = 0af0h, IP = 0100 H
Modify registers
Format:-r register name
-R DS
DS 0af
: 0ae0
-R
The ds content is changed from 0af0h to 0ae0h.
Assembly command a (write a machine command in memory in the format of Assembly command)
Format:-A memory address
For example, call the 0-2 h function in DOS to display the character 'a' and compile the program into the memory starting from 1270: H.
-A1270: 100
1270: 0100 mov, ah, 2
1270: 0102 mov, DL, 61
1270: 0104 int 21
1270: 0106 INT 20
1270: 0108
-
Disassembly command u
Format:-u memory block
Function: display the disassembly result in three columns. The first column is the first address of the instruction, the second column is the hexadecimal instruction machine code, and the third column is the instruction mnemonic.
-U 1270: 100
1270: 0100 b402 mov ah, 02
1270: 0102 b261 mov DL, 61
1270: 0104 cd21 int 21
1270: 0106 CD20 INT 20
1270: 0108 0000 add [bx + Si], Al
1270: 010a 0000 add [bx + Si], Al
1270: 010c 0000 add [bx + Si], Al
1270: 010e 0000 add [bx + Si], Al
1270: 0110 0000 add [bx + Si], Al
1270: 0112 0000 add [bx + Si], Al
1270: 0114 0000 add [bx + Si], Al
1270: 0116 0000 add [bx + Si], Al
1270: 0118 0000 add [bx + Si], Al
1270: 011a 0000 add [bx + Si], Al
1270: 011c 0000 add [bx + Si], Al
1270: 011e 0000 add [bx + Si], Al
-
1. One-step execution
Format:-T = memory address, press ENTER
Format:-P = memory address, press ENTER
Function: Modify the Cs and IP addresses using the segment and offset addresses of the memory address in the command, and then execute a command at the memory unit pointed to by CS: IP to display the values of each register, disassembles the next command and returns the debug status.
Example:
-T = 1270: 100
Ax = 0200 BX = 0000 Cx = 0000 dx = 0000 sp = ffee BP = 0000 Si = 0000 di = 0000
DS = 0ae0 es = 0af0 Ss = 0af0 cs = 1270 IP = 0102 ov up EI ng NZ Na Po NC
1270: 0102 b261 mov DL, 61
-
Execution result: Ah = 2, Cs value unchanged, IP value increased by 2, CS: IP point to second command
2. Multi-step execution
Format:-T = number of commands executed by the memory address
Format:-P = number of commands executed by the memory address
Command T and P are different:
One: the string operation commands with the repeated prefix rep/repnz/repz and loop commands such as loop/loopz/loopn are CS-related commands. When such commands are executed with the T command, every time the Cx value is reduced by one, the system stops and returns Debug. When the p command is executed, it is always executed to Cx = 0, run the next command to return the debug
Two: Call Command and interrupt call command Int. Because these commands modify CS and IP addresses, the program structure is switched. Use the T command to stop at the Cs: IP (subroutine) entrance and return Debug. Use the T command for tracking. The p command is used to display the next command of call and Int.
For example, execute the int 21 H command at 1270: 0140h with T and P respectively.
-T = 1270: 104
Ax = 0200 BX = 0000 Cx = 0000 dx = 0000 sp = ffe8 BP = 0000 Si = 0000 di = 0000
DS = 0ae0 es = 0af0 Ss = 0af0 cs = 00a7 IP = 127c ov up di ng NZ Na Po NC
00a7: Objective C 90 NOP
-P = 1270: 104
Ax = 0200 BX = 0000 Cx = 0000 dx = 0000 sp = ffe8 BP = 0000 Si = 0000 di = 0000
DS = 0ae0 es = 0af0 Ss = 0af0 cs = 1270 IP = 0106 ov up di ng NZ Na Po NC
1270: 0106 CD20 INT 20
3. Continuous execution
-G = memory address
4. breakpoint execution
Format:-G = memory address breakpoint address
1. Display command d
Format:-d memory block
For example, d1270: 1210 h to memory blocks are displayed.
-D1270: 100 L30
1270: 0100 B4 02 B2 61 CD 21 CD 20-00 00 00 00 00 00 00... .!. ........
1270: 0110 00 00 00 00 00 00 00-00 00 00 00 00 00 00 ................
1270: 0120 00 00 00 00 00 00 00-00 00 00 00 00 00 00 ................
2. modify command e
Format 1:-e memory address character or numeric string
Format 2:-e memory address
3. Fill instruction
Format:-F memory block character or numeric string
Example:-f ds: 2000 2100 'Hello world'
4. SEARCH Command s
Format:-s memory block character or numeric string
5. Move the instruction m
Format:-M memory block 1 memory block 2 first address
Function: Copies the content of memory block 1 to memory block 2, and the content of memory block 1 remains unchanged.
6. Comparison command C
Format:-C memory block 1 memory block 2 first address
(5) read/write disks
1. Specify the file command n
Format:-N [D:] [path] file name. Extension: Press ENTER
Function: Specify the file for commands L and W. [D:] [path] indicates the disk number and path of the file.
2. Write command W
Format:-W memory address, press ENTER
Function: Write the content of the specified memory block to the file specified by command n. The first address command W of the memory block is specified, and the size of the memory block is determined by the Bx and CX registers, BX stores the high bytes of the memory block size, and CX stores the low bytes of the memory block size.
3. Load the command L Block
Format:-l memory address, press ENTER
Function: load the file specified by command n to the memory address starting with command L. The file is fixed to CS: IP address.
4. Load executable. EXE or. com files
Generally, when debugging executable. EXE or. com files, you can directly add the files to be loaded after entering the DEBUG command without using the N and l commands.
Format:> [D:] [path] Debug file name. Extension press ENTER
Function: load the specified file in the command to the Cs: IP address of the memory.
For example, write the memory block content starting from 1270: H to the AA. dat file in the root directory of drive D.
-N I: AA. dat; use command n to specify the file name
-R bx; modify the value of BX
BX 0000
: 0; BX = 0 h, high value of the length of the stored File
-R CX
CX 1, 0010
: 30; Cx = 30 h; low value of the file length
-W 1270: 100; write the specified memory block to the AA. dat file.
Writing 00030 bytes
For example, adjust the AA. dat file in the root directory of the I disk to the starting point of CS: H in the memory.
-N I: AA. dat press ENTER
-L Cs: 100 press ENTER
-U Cs: 100 press ENTER
1270: 0100 b402 mov ah, 02
1270: 0102 b261 mov DL, 61
1270: 0104 cd21 int 21
1270: 0106 CD20 INT 20
1270: 0108 0000 add [bx + Si], Al
1270: 010a 0000 add [bx + Si], Al
1270: 010c 0000 add [bx + Si], Al
1270: 010e 0000 add [bx + Si], Al
1270: 0110 0000 add [bx + Si], Al
1270: 0112 0000 add [bx + Si], Al
1270: 0114 0000 add [bx + Si], Al
1270: 0116 0000 add [bx + Si], Al
1270: 0118 0000 add [bx + Si], Al
1270: 011a 0000 add [bx + Si], Al
1270: 011c 0000 add [bx + Si], Al
1270: 011e 0000 add [bx + Si], Al
(6) I/O port address
1. Enter the command
Format:-I port address, press ENTER
Function: input the content of the specified port to the Al register and display the value.
2. Output command
Format:-O port address value: Press ENTER
Function: outputs the value in the command to the specified port.
(7) hexadecimal addition and subtraction
Format:-H value 1 value 2
(8) Exit the command
Q