当前位置:网站首页>Basic knowledge of assembly language (2) -debug

Basic knowledge of assembly language (2) -debug

2022-06-25 01:14:00 Day-3

Basic knowledge of

Machine language is difficult to understand , And the length is long .
Assembly instruction is a writing format that is easy to memorize .
register : Simply put, yes CPU A device that can store data in .
Assembly language consists of three instructions :
(1) Assembly instruction : Mnemonics for machine codes , There is a corresponding machine code .( The core )
(2) Pseudo instruction : No corresponding machine code , By compiler , No corresponding machine code .
(3) Other symbols : Such as +、-、*、/ etc. , Recognized by compiler , No corresponding machine code .
Memory chips can be divided into two categories in terms of read-write properties :RAM( Ram ) and ROM( read-only memory ).

register

Different CPU, The number of registers 、 The structure is different .
General registers :AX、BX、CX、DX.
Physical address : Physical address = Segment address × \times ×+ offset
X Hexadecimal digits move one digit to the left , amount to × \times ×X
The segment address is stored in four segment registers CS、DS、SS、ES.
CS:IP Access address instruction .
jmp Instructions , modify CSip.

Debug

I installed a xp Virtual machine to achieve access debug Function of .
(1) use R Command view 、 change CPU The contents of the register .
We already know that AX BX CX DX CS IP These six registers , Now take a look at them .
 Insert picture description here
Modify the contents of the register .
 Insert picture description here
In this figure ,CS:IP Point to )0AE3:0100, The machine code stored here is 40, The corresponding assembly instructions are INC AX;
have access to r Command to cs and ip Make changes .
 Insert picture description here
(2) use debug Of d Command to view the contents of memory
If we want to know 10000H The content of , have access to “d Segment address : offset ” To view .
 Insert picture description here
The data in the middle is the content stored in each address , On the left is the starting address of each line , On the right is the data in each memory unit that can be displayed ASCII code .
(3) use debug Of e Command to rewrite the contents of memory
-e Then add the address , Plus the number to be modified , Number customization
 Insert picture description here
Or use -e You can also add addresses .
 Insert picture description here
(4) use E Command to write machine code to memory , use U Command to view the meaning of machine code in memory , use T The command executes the machine code in memory . Insert picture description here
-u Add address , Show assembly language ;
 Insert picture description here
-t It can be done in one step .
 Insert picture description here

原网站

版权声明
本文为[Day-3]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206242024382325.html