Assembly debug instruction and analysis

1. Debug environment configuration under win10

Refer to https://ask.dobunkan.com/article-4935.html for installation and configuration. This article mainly explains how to use it under debug.

Two, assembly debug common instructions

Insert picture description here
Example of instruction usage (not case sensitive):
(1) r instruction
such as r to view the content of the cpu register,
Insert picture description here
r ax to modify the content of the ax register, other registers are similarly modified.
Insert picture description here
(2) d instruction, view the memory content
Insert picture description here
(3) u instruction, the machine code of the memory is translated into assembly language
Insert picture description here
(4) e instruction, modify the content of the memory
Insert picture description here
After modification:
Insert picture description here
(5) t instruction, execute the next machine instruction
Insert picture description here
(6) a, write a machine instruction in memory in assembly form

Insert picture description here

Three, AX, BX, CX, DX, SP, BP, SI, DI, DS, ES, SS, IP register details

Insert picture description here
As shown in the figure above, what is the specific meaning of the registers of AX, BX, CX, DX, SP, BP, SI, DI, DS, ES, SS, and IP?

AX――累加器(Accumulator),使用频度最高
BX――基址寄存器(Base Register),常存放存储器地址
CX――计数器(Count Register),常作为计数器
DX――数据寄存器(Data Register),存放数据

DS is called data segment register. It points to the segment of the data used by the running program. You can point this to anywhere you want as long as it contains the desired data.

DS is called the segment register, which points to the data segment of the currently running program. You can point it to any place you want, as long as that place has the data you want.

ES is called extra segment register. It is usually used with DI and doing pointers things. The couple DS:SI and ES:DI are commonly used to do string operations.

ES is called the extra segment register (additional segment register). It is usually used as a pointer together with DI. DS:SI and ES:DI are usually used to perform some string operations when paired.

SS is called stack segment register. It points to stack segment.

SS is called the stack segment register, which points to the stack segment.

The register SI and DI are called index registers. These registers are usually used to process arrays or strings.

The two registers SI and DI are called index registers. These two registers are usually used to process arrays or strings.

SI is called source index and DI is destination index. As the name follows, SI is always pointed to the source array and DI is always pointed to the destination. This is usually used to move a block of data, such as records (or structures ) and arrays. These registers are commonly coupled with DS and ES.
SI is called the source index register, and DI is called the destination index register. As they are named, SI usually points to the source array, and DI usually points to the destination array. They are usually used in blocks Move data locally, such as moving arrays or structures. SI and DI are usually used together with DS and ES.

The register BP, SP, and IP are called pointer registers.

BP, SP, and IP are called pointer registers.

BP is base pointer, SP is stack pointer, and IP is instruction pointer. Usually BP is used for preserving space to use local variables.

BP is the base pointer, SP is the stack pointer, and IP is the instruction pointer. Usually BP is used to store the address of the local variable.

SP is used to point the current stack. Although SP can be modified easily, you must be cautious. It’s because doing the wrong thing with this register could cause your program in ruin.

SP is used to point to the current stack. Although SP can be easily modified, you must be very careful. Because if this register is wrong, your program will be ruined.

IP denotes the current pointer of the running program. It is always coupled with CS and it is NOT modifiable.

IP is used to indicate the current pointer of the currently running program. Usually used with CS, IP is not allowed to be modified.

So, the couple of CS:IP is a pointer pointing to the current instruction of running program. You can NOT access CS nor IP directly.

Therefore, CS:IP pairing is used to indicate the address of the command currently running. You cannot directly access CS, nor can you directly access IP.

Fourth, the meaning of NV UP EI PL NZ NA PE NC

Insert picture description here
As shown in the picture above, the meaning of NV UP EI PL NZ NA PE NC can be viewed and analyzed by referring to a good article on the Internet:
https://www.cnblogs.com/AI-Algorithms/p/3919845.html

Guess you like

Origin blog.csdn.net/u014470361/article/details/100548752
Recommended