Assembly language notes 03_80x86 register group (summary of small turtle notes)

1. General Register

Registers can be divided into two categories : registers visible to the program and registers invisible to the program .

The registers visible to the program can be divided into the following three categories:

  • General register
  • Special register
  • Segment register

Data register

AX, BX, CX, DX can be called data registers, used to temporarily store the operands used in the calculation process. They are 16 bits, but they can also be accessed in bytes, such as AH (high byte) and AL (low byte).

AX

(Accumulator), used as an accumulator, so it is the main register for arithmetic operations.

BX

(Base), when calculating the memory address, it is often used as the base address register.

CX

(Count), often used to save the count value, such as used as an implicit counter in shift instructions, loop instructions, and string processing instructions.

DX

(Data). Generally, DX and AX are combined to store a double-word-length number when doing double-word-length operations. DX is used to store high-order words.

Pointer register

Operands can be stored, but they can only be used in units of words .

SP

(Stack pointer), the stack pointer register.

BP

(Base pointer), the base address pointer register. It can be used in conjunction with the stack segment register SS to determine the address of a certain storage unit in the stack segment.

AND

(Source index), the source index register, generally used in conjunction with the data segment register DS, to determine the address of a storage unit in the data segment.

OF

(Destination index), the destination index register, generally used in conjunction with the data segment register DS to determine the address of a storage unit in the data segment.

※SI and DI have automatic increment and automatic decrement functions.

In the serial processing instructions , SI and DI are used as the implicit source and destination index registers. At this time, SI and DS are used together, and DI and additional segment register ES are used together to achieve addressing in the data segment and the additional segment, respectively. the goal of.

2. Special Register

IP

(Instruction pointer), instruction pointer register, it is used to store the offset address in the code segment.

In the process of program running, it always points to the first address of the next instruction , and it is used in conjunction with the segment register CS to determine the physical address of the next instruction.

SP

(Stack pointer), stack pointer register, storage stack offset address , in combination with the stack segment register SS to determine the address of the stack segment in the top of the stack.

FLAGS

Flag register, also known as a program status register (program status word, PSW).

Condition flag

  • Overflow flag

    (Overflow flag, OF), when the operation overflows, it is 1, otherwise it is 0.

  • Symbol sign

    (Sign flag, SF), when the operation result is negative, it is 1, otherwise it is 0.

  • Zero flag

    (Zero flag, ZF), when the operation result is 0, it is 1, otherwise it is 0.

  • Carry flag

    (Carry flag, CF), record the carry value generated from the most significant bit during operation. It is 1 when there is a carry, otherwise it is 0.

  • Auxiliary carry flag

    (auxiliary carry flag,AF),……

  • Parity flag

    (Parity flag, PF), when the number of 1 in the result operand is an even number, it is 1 , otherwise it is set to 0 .

Control flag

The direction flag is used to control the direction of processing information in a string processing instruction.

When DF is 1, the high address to the low address is reversed.

When DF is 0, the low address to the high address is just coming.

System logo

  • Trap sign

    (Trap flag, TF), used for single-step operation during debugging .

    When TF is 1, a trap is generated; otherwise, no trap is generated.

  • Interrupt flag

    (Interrupt flag, IF). When it is 1, the CPU is allowed to respond to interrupts; otherwise, it is not allowed.

3. Segment register

The segment register is also a special register, dedicated to memory addressing , used to directly or indirectly store the segment address .

  • Code snippet

    (Code segment, CS), which stores the currently running program.

  • Data segment

    (Data segment, DS), which stores the data used by the currently running program.

    If the program uses string processing instructions, its source operands are also stored in the data segment.

  • Stack segment

    (stack segment,SS)

  • Additional paragraph

    (Extra segment, ES), the additional data segment, as an auxiliary data area, is also the destination operand storage area for string processing instructions.

Guess you like

Origin blog.csdn.net/david2000999/article/details/115199230