### Debug Common Command Set
| Name | Explanation | Format |
| ---- | ---- | ---- |
| a (Assemble) | Assemble line by line | a [address] |
| c (Compare) | Compare two memory blocks | c range address |
| d (Dump) | Display memory in hexadecimal | d [address] or d [range] |
| e (Enter) | Modify memory bytes | e address |
| f (fill) | Preset a segment of memory | f range list |
| g (Go) | Execute program | g [=address][address...] |
| h (Hexavithmetic) | Hexadecimal arithmetic operation | h value value |
| i (Input) | Input from specified port address | i portaddress |
| l (Load) | Read disk | l [address [driver seetor> |
| m (Move) | Transfer memory block | m range address |
| n (Name) | Set file name | n filespec [filespec...] |
| o (Output) | Output to specified port address | o portaddress byte |
| q (Quit) | Exit | q |
| r (Register) | Display and modify registers | r [register name] |
| s (Search) | Search for byte string | s range list |
| t (Trace) | Trace execution | t [=address] [value] |
| u (Unassemble) | Unassemble | u [address] or range |
| w (Write) | Save disk | w [address[driver sector secnum]] |
### Debug Small Assembly a Command
The Debug small assembly a command is a very useful function, and many small programs need it to be done.
It is more convenient and faster to compile some small programs than assembly.
In Debug, interrupts are very useful. First, let's understand interrupts.
The so-called interrupt, in fact, is that when you are doing something, someone comes to you with other things, you put down what you are doing first (in the computer, it is called protecting the scene), and then go to do things with the person who calls you. When it is over, you come back and continue to do the things you were doing just now. This is a very popular explanation.
When the computer is running, this situation will also occur, and we call it an interrupt.
The following is a detailed explanation of the entry values of some of its common interrupt vectors: (Remember, it's very useful... Hehe)
### Instruction Name Explanation
**call instruction (procedure call) (control instruction - long jump)**
Detailed explanation:
- Intra-segment direct call
- Intra-segment indirect call (register)
- Intra-segment indirect call (memory)
- Inter-segment direct call
- Inter-segment indirect call
**jmp instruction (unconditional jump instruction) (control instruction - long jump)**
Detailed explanation:
- Intra-segment direct jump
- Short intra-segment direct jump
- Intra-segment indirect jump (register)
- Intra-segment indirect jump (memory)
- Inter-segment direct jump
- Inter-segment indirect jump
**ret instruction (procedure return) (control instruction - long jump)**
Detailed explanation:
- Intra-segment return
- Intra-segment return with immediate number added to sp
- Inter-segment return
- Inter-segment return with immediate number added to sp
**na/jnbe instruction (control instruction - short jump) Jump when not less than or not equal**
**jae/jnb instruction (control instruction - short jump) Jump when greater than or equal**
**jb/jnae instruction (control instruction - short jump) Jump when less**
**jbe/jna instruction (control instruction - short jump) Jump when less than or equal**
**jg/jnle instruction (control instruction - short jump) Jump when greater**
**jge/jnl instruction (control instruction - short jump) Jump when greater than or equal**
**jl/jnge instruction (control instruction - short jump) Jump when less**
**jle/jng instruction (control instruction - short jump) Jump when less than or equal**
**je/jz instruction (control instruction - short jump) Jump when equal**
**jne/jnz instruction (control instruction - short jump) Jump when not equal**
**jc instruction (control instruction - short jump) Jump when carry**
**jnc instruction (control instruction - short jump) Jump when no carry**
**jno instruction (control instruction - short jump) Jump when not overflow**
**jnp/jpo instruction (control instruction - short jump) Jump when parity is odd**
**jns instruction (control instruction - short jump) Jump when sign bit is "0"**
**jo instruction (control instruction - short jump) Jump when overflow**
**jp/jpe instruction (control instruction - short jump) Jump when parity is even**
**js instruction (control instruction - short jump) Jump when sign bit is "1"**
**loop instruction (loop control instruction - short jump) Loop when cx is not 0**
**loope/loopz instruction (loop control instruction - short jump) Loop when cx is not 0 and flag z = 1**
**loopne/loopnz instruction (loop control instruction - short jump) Loop when cx is not 0 and flag z = 0**
**jcxz instruction (loop control instruction - short jump) Jump when cx is 0**
**★int instruction (interrupt instruction) Interrupt instruction (detailed explanation later)**
**into instruction (interrupt instruction) Overflow interrupt**
**iret instruction (interrupt instruction) Interrupt return**
**shl instruction (logical left shift)**
**sal instruction (arithmetic left shift)**
**shr instruction (logical right shift)**
**sar instruction (arithmetic right shift) Register, 1**
**rol instruction (rotate left) Register, cl**
**ror instruction (rotate right) Memory, 1**
**rcl instruction (rotate left through carry) Memory, cl**
**rcr instruction (rotate right through carry) (logical operation)**
**not instruction (negation operation) Register negation**
(logical operation) Memory negation
**and instruction (AND operation) (logical operation)**
Register and register → register
Register and memory → register
Memory and register → memory
Immediate number and memory → memory
Immediate number and accumulator → accumulator
**or instruction (OR operation) (logical operation)**
Register or register → register
Register or memory → register
Memory or register → memory
Immediate number or memory → memory
Immediate number or accumulator → accumulator
**test instruction (test) (logical operation)**
Register test register
Register test memory
Register test immediate number
Memory test immediate number
Accumulator test immediate number
**movs instruction (string transfer) (string operation instruction)**
Single transfer
Repeat transfer
**cmps instruction (string compare) (string operation instruction)**
Single compare
Repeat compare
**scas instruction (string scan) (string operation instruction)**
Single search
Repeat search
**lods instruction (load string) (string operation instruction)**
Single load
Repeat load
**stos instruction (store string) (string operation instruction)**
Single store
Repeat store
**mov instruction (transfer word or byte) (data transfer command)**
Transfer between registers and registers
Transfer between memory and registers
Immediate number transfer to memory
Immediate number transfer to register
Memory transfer to accumulator
Accumulator transfer to memory
Register transfer to segment register
Memory transfer to segment register
Segment register transfer to register
Segment register transfer to memory
**pop instruction (pop word from stack) (data transfer command)**
**push instruction (push word onto stack)**
Memory
Register
Segment register
**xchg instruction (exchange word or byte) (data transfer command)**
Exchange between registers and registers
Exchange between memory and registers
Exchange between register and accumulator
**in instruction (port input) (data transfer command)**
Direct input
Indirect input
**out instruction (port output) (data transfer instruction)**
Direct output
Indirect output
**add instruction (addition) (arithmetic instruction)**
**adc instruction (add with carry)**
Register + register → register
Register + memory → register
Memory + register → memory
Immediate number + memory → memory
Immediate number + accumulator → accumulator
**inc instruction (increment by 1) (arithmetic instruction)**
Memory increment
Register increment
**sub instruction (subtraction) (arithmetic instruction)**
**sbb instruction (subtract with borrow)**
Register - register → register
Register - memory → register
Memory - register → memory
Immediate number - memory → memory
Immediate number - accumulator → accumulator
**dec instruction (decrement by 1) (arithmetic instruction)**
Memory decrement
Register decrement
**nec instruction (negate, subtract from 0)**
Register complement
Memory complement
**cmp instruction (compare) (arithmetic instruction)**
Register and register compare
Register and memory compare
Register and immediate number compare
Memory and immediate number compare
Accumulator and immediate number compare
**mul instruction (unsigned multiplication) (arithmetic instruction)**
**imul instruction (integer multiplication)**
Multiply with 8-bit register
Multiply with 16-bit register
Multiply with 8-bit memory unit
Multiply with 16-bit memory unit
**div instruction (unsigned division) (arithmetic instruction)**
**idiv instruction (integer division)**
Divide by 8-bit register
Divide by 16-bit register
Divide by 8-bit memory unit
Divide by 16-bit memory unit
### Debug Practice
1. View the production date and version of the motherboard
D ffff:05
D fe00:0e
2. Simulate the Rest key function
A
:100 jmp ffff:0000
:105
g
3. Quick format floppy disk
L 100 0 0 * 'Insert a formatted floppy disk
W 100 0 0 * 'Put in a floppy disk to be formatted
Note: * are respectively: 720K e |1.2M id |1.44M 21
4. Two methods for hard disk formatting
(1) G=c800:05
(2) A 100
mov ax,0703
mov cx,0001
mov dx,0080
int 13
int 3
g 100
5. Speed up the keyboard
A
mov ax,0305
mov bx,0000
int 16
int 20
rcx
10
n fast.com
w
q
6. Turn off the monitor (press any key to restore)
A
mov ax,1201
mov bl,36
int 10
mov ah,0
int 16
mov ax,1200
int 10
rcx
10
n crt-of.com
w
q
7. Repair the hard disk DOS boot record
Put a formatted floppy disk in the floppy drive
debug
-l 100 2 0 1
-w 100 0 50 1
Put the floppy disk in the floppy drive of the faulty machine
debug
-l 100 0 50 1
-w 100 2 0 1
-q
8. Clear the setup password in coms
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 machines, because its password is placed at the 4ch-51h address in coms, just change: mov bx,0038 to: mov
bx,004c can be
9. Cancel the password in coms (clear the coms data to initialization)
-o 70,10
-o 71,10
-g
-q
10. Save the hard disk master boot record to a 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 an interrupt to realize restarting the computer (can be made into a file)
debug
-a
int 19
int 20
-rcx
:2
-nreset.com
-w
-q
| Name | Explanation | Format |
| ---- | ---- | ---- |
| a (Assemble) | Assemble line by line | a [address] |
| c (Compare) | Compare two memory blocks | c range address |
| d (Dump) | Display memory in hexadecimal | d [address] or d [range] |
| e (Enter) | Modify memory bytes | e address |
| f (fill) | Preset a segment of memory | f range list |
| g (Go) | Execute program | g [=address][address...] |
| h (Hexavithmetic) | Hexadecimal arithmetic operation | h value value |
| i (Input) | Input from specified port address | i portaddress |
| l (Load) | Read disk | l [address [driver seetor> |
| m (Move) | Transfer memory block | m range address |
| n (Name) | Set file name | n filespec [filespec...] |
| o (Output) | Output to specified port address | o portaddress byte |
| q (Quit) | Exit | q |
| r (Register) | Display and modify registers | r [register name] |
| s (Search) | Search for byte string | s range list |
| t (Trace) | Trace execution | t [=address] [value] |
| u (Unassemble) | Unassemble | u [address] or range |
| w (Write) | Save disk | w [address[driver sector secnum]] |
### Debug Small Assembly a Command
The Debug small assembly a command is a very useful function, and many small programs need it to be done.
It is more convenient and faster to compile some small programs than assembly.
In Debug, interrupts are very useful. First, let's understand interrupts.
The so-called interrupt, in fact, is that when you are doing something, someone comes to you with other things, you put down what you are doing first (in the computer, it is called protecting the scene), and then go to do things with the person who calls you. When it is over, you come back and continue to do the things you were doing just now. This is a very popular explanation.
When the computer is running, this situation will also occur, and we call it an interrupt.
The following is a detailed explanation of the entry values of some of its common interrupt vectors: (Remember, it's very useful... Hehe)
### Instruction Name Explanation
**call instruction (procedure call) (control instruction - long jump)**
Detailed explanation:
- Intra-segment direct call
- Intra-segment indirect call (register)
- Intra-segment indirect call (memory)
- Inter-segment direct call
- Inter-segment indirect call
**jmp instruction (unconditional jump instruction) (control instruction - long jump)**
Detailed explanation:
- Intra-segment direct jump
- Short intra-segment direct jump
- Intra-segment indirect jump (register)
- Intra-segment indirect jump (memory)
- Inter-segment direct jump
- Inter-segment indirect jump
**ret instruction (procedure return) (control instruction - long jump)**
Detailed explanation:
- Intra-segment return
- Intra-segment return with immediate number added to sp
- Inter-segment return
- Inter-segment return with immediate number added to sp
**na/jnbe instruction (control instruction - short jump) Jump when not less than or not equal**
**jae/jnb instruction (control instruction - short jump) Jump when greater than or equal**
**jb/jnae instruction (control instruction - short jump) Jump when less**
**jbe/jna instruction (control instruction - short jump) Jump when less than or equal**
**jg/jnle instruction (control instruction - short jump) Jump when greater**
**jge/jnl instruction (control instruction - short jump) Jump when greater than or equal**
**jl/jnge instruction (control instruction - short jump) Jump when less**
**jle/jng instruction (control instruction - short jump) Jump when less than or equal**
**je/jz instruction (control instruction - short jump) Jump when equal**
**jne/jnz instruction (control instruction - short jump) Jump when not equal**
**jc instruction (control instruction - short jump) Jump when carry**
**jnc instruction (control instruction - short jump) Jump when no carry**
**jno instruction (control instruction - short jump) Jump when not overflow**
**jnp/jpo instruction (control instruction - short jump) Jump when parity is odd**
**jns instruction (control instruction - short jump) Jump when sign bit is "0"**
**jo instruction (control instruction - short jump) Jump when overflow**
**jp/jpe instruction (control instruction - short jump) Jump when parity is even**
**js instruction (control instruction - short jump) Jump when sign bit is "1"**
**loop instruction (loop control instruction - short jump) Loop when cx is not 0**
**loope/loopz instruction (loop control instruction - short jump) Loop when cx is not 0 and flag z = 1**
**loopne/loopnz instruction (loop control instruction - short jump) Loop when cx is not 0 and flag z = 0**
**jcxz instruction (loop control instruction - short jump) Jump when cx is 0**
**★int instruction (interrupt instruction) Interrupt instruction (detailed explanation later)**
**into instruction (interrupt instruction) Overflow interrupt**
**iret instruction (interrupt instruction) Interrupt return**
**shl instruction (logical left shift)**
**sal instruction (arithmetic left shift)**
**shr instruction (logical right shift)**
**sar instruction (arithmetic right shift) Register, 1**
**rol instruction (rotate left) Register, cl**
**ror instruction (rotate right) Memory, 1**
**rcl instruction (rotate left through carry) Memory, cl**
**rcr instruction (rotate right through carry) (logical operation)**
**not instruction (negation operation) Register negation**
(logical operation) Memory negation
**and instruction (AND operation) (logical operation)**
Register and register → register
Register and memory → register
Memory and register → memory
Immediate number and memory → memory
Immediate number and accumulator → accumulator
**or instruction (OR operation) (logical operation)**
Register or register → register
Register or memory → register
Memory or register → memory
Immediate number or memory → memory
Immediate number or accumulator → accumulator
**test instruction (test) (logical operation)**
Register test register
Register test memory
Register test immediate number
Memory test immediate number
Accumulator test immediate number
**movs instruction (string transfer) (string operation instruction)**
Single transfer
Repeat transfer
**cmps instruction (string compare) (string operation instruction)**
Single compare
Repeat compare
**scas instruction (string scan) (string operation instruction)**
Single search
Repeat search
**lods instruction (load string) (string operation instruction)**
Single load
Repeat load
**stos instruction (store string) (string operation instruction)**
Single store
Repeat store
**mov instruction (transfer word or byte) (data transfer command)**
Transfer between registers and registers
Transfer between memory and registers
Immediate number transfer to memory
Immediate number transfer to register
Memory transfer to accumulator
Accumulator transfer to memory
Register transfer to segment register
Memory transfer to segment register
Segment register transfer to register
Segment register transfer to memory
**pop instruction (pop word from stack) (data transfer command)**
**push instruction (push word onto stack)**
Memory
Register
Segment register
**xchg instruction (exchange word or byte) (data transfer command)**
Exchange between registers and registers
Exchange between memory and registers
Exchange between register and accumulator
**in instruction (port input) (data transfer command)**
Direct input
Indirect input
**out instruction (port output) (data transfer instruction)**
Direct output
Indirect output
**add instruction (addition) (arithmetic instruction)**
**adc instruction (add with carry)**
Register + register → register
Register + memory → register
Memory + register → memory
Immediate number + memory → memory
Immediate number + accumulator → accumulator
**inc instruction (increment by 1) (arithmetic instruction)**
Memory increment
Register increment
**sub instruction (subtraction) (arithmetic instruction)**
**sbb instruction (subtract with borrow)**
Register - register → register
Register - memory → register
Memory - register → memory
Immediate number - memory → memory
Immediate number - accumulator → accumulator
**dec instruction (decrement by 1) (arithmetic instruction)**
Memory decrement
Register decrement
**nec instruction (negate, subtract from 0)**
Register complement
Memory complement
**cmp instruction (compare) (arithmetic instruction)**
Register and register compare
Register and memory compare
Register and immediate number compare
Memory and immediate number compare
Accumulator and immediate number compare
**mul instruction (unsigned multiplication) (arithmetic instruction)**
**imul instruction (integer multiplication)**
Multiply with 8-bit register
Multiply with 16-bit register
Multiply with 8-bit memory unit
Multiply with 16-bit memory unit
**div instruction (unsigned division) (arithmetic instruction)**
**idiv instruction (integer division)**
Divide by 8-bit register
Divide by 16-bit register
Divide by 8-bit memory unit
Divide by 16-bit memory unit
### Debug Practice
1. View the production date and version of the motherboard
D ffff:05
D fe00:0e
2. Simulate the Rest key function
A
:100 jmp ffff:0000
:105
g
3. Quick format floppy disk
L 100 0 0 * 'Insert a formatted floppy disk
W 100 0 0 * 'Put in a floppy disk to be formatted
Note: * are respectively: 720K e |1.2M id |1.44M 21
4. Two methods for hard disk formatting
(1) G=c800:05
(2) A 100
mov ax,0703
mov cx,0001
mov dx,0080
int 13
int 3
g 100
5. Speed up the keyboard
A
mov ax,0305
mov bx,0000
int 16
int 20
rcx
10
n fast.com
w
q
6. Turn off the monitor (press any key to restore)
A
mov ax,1201
mov bl,36
int 10
mov ah,0
int 16
mov ax,1200
int 10
rcx
10
n crt-of.com
w
q
7. Repair the hard disk DOS boot record
Put a formatted floppy disk in the floppy drive
debug
-l 100 2 0 1
-w 100 0 50 1
Put the floppy disk in the floppy drive of the faulty machine
debug
-l 100 0 50 1
-w 100 2 0 1
-q
8. Clear the setup password in coms
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 machines, because its password is placed at the 4ch-51h address in coms, just change: mov bx,0038 to: mov
bx,004c can be
9. Cancel the password in coms (clear the coms data to initialization)
-o 70,10
-o 71,10
-g
-q
10. Save the hard disk master boot record to a 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 an interrupt to realize restarting the computer (can be made into a file)
debug
-a
int 19
int 20
-rcx
:2
-nreset.com
-w
-q
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| zzz19760225 | +2 | 2017-11-13 18:37 |
