[Assembly] commonly used registers in intel core cpu

1、EAX

Number: 0

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: accumulator

2 、 ECX

Number: 1

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: counting

3、EDX

Number: 2

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: I/O pointer

4、EBX

Number: 3

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: Data pointer of DS segment

5、ESP

Number: 4

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: stack pointer

6、EBP

Number: 5

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: Data pointer of SS segment

7 、 ESI

Number: 6

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: source pointer for string operations, data pointer for SS segment

8 、 EDI

Number: 7

Storage data range: 0x00000000-0xFFFFFFFF

Purpose: target pointer for string operations, data pointer for ES segment

Note that the above use is the recommended use of the CPU when designing, and it does not have to be used in this way.

It is best to learn EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI and their corresponding numbers for these 8 32-bit general-purpose registers.

Let’s briefly introduce 16-bit and 8-bit registers

register Number (binary) Number (decimal)
32nd place 16th place 8th place  
EAX AX AL 000 0
ECX CX CL 001 1
EDX DX DL 010 2
EBX BX BL 011 3
ESP SP AH 100 4
EBP BP CH 101 5
ESI OF DH 110 6
I KNOW AND BH 111 7

Do you see anything in the table above? These 32-bit registers are expanded from 16 bits, and the front E is removed to 16 bits. 16-bit means a cut from the middle of the 32-bit, and 8-bit means a cut from the middle of the 16-bit. There are high 8 bits and low 8 bits in 8 bits. Taking EAX as an example, the high 8 bits are AH, and the low 8 bits are AL. ECX and EDX are the same. If we use the mov ax,0x1 instruction in assembly, it will change the value of the last 4 bits (note that it is hexadecimal), and use the move ah,0x1 instruction in assembly, it will change the value of the third and fourth bits (from Count from right to left).

Guess you like

Origin blog.csdn.net/mid_Faker/article/details/112181565