8086 instruction system (1) data transfer instructions

1. Data transfer instructions

1. General transfer instructions

  • Format: MOV dest, src; dest←src
  • dest can be register, memory, accumulator (acc), segment register
  • src can be immediate data, memory, register, accumulator, segment register
  • Whether to transmit a byte or a word depends on whether the register is 8-bit or 16-bit. If there is no register addressing, use byte ptr or word ptr to indicate. Such as:

    MOV BYTE PTR DS:[2056H], 23

2. Stack operation instructions

  • format
    • PUSH src; push into the stack. SP ←SP-2, (SS:SP) ←src
    • POP dest。 出。。 dest ← (SS: SP), SP ← SP + 2
    • PUSHF; Flags register (Flags) into the stack
    • POPF; Flags register (Flags) out of the stack
  • src register, memory, segment register
  • The operand must be 16 bits

3. Exchange instructions

  • Format XCHG op1, op2; exchange the content of op1 and op2
  • One of the two operands must be in the register;
  • Operands cannot be segment registers and immediate data;
  • The source and destination operand types must be consistent

4. Lookup table instruction

  • Format XLAT; AL <- (BX + AL)
  • Find out the content of the corresponding code in the table according to the item number
  • When executing, first send the first address (offset address) of the table to BX, the sequence number (ie offset) of the table item is stored in AL, and the content found after executing XLAT is stored in AL

5. Input and output instructions

  • format:
    • IN acc, PORT; content of acc←port (address is PORT), PORT value is 0~255.
    • IN acc, DX; acc←port (address in DX) content.
    • OUT PORT, acc; Port (address is PORT) content ← acc
    • OUT DX, acc; Port (address in DX) content ← acc
  • Only use the accumulator AL or AX to transmit information

6. Address transfer instruction

  • format

    • LEA reg, mem; Send the 16-bit offset address of the specified memory to the specified register
    • LDS reg, mem32; DS:reg←(4 memory bytes starting from mem32)
    • LES reg, mem32; ES:reg← (4 bytes starting from mem32)
      says
  • The source operand must be a memory operand, and reg must be a 16-bit general-purpose register

    Example:
    MOV AX, 3000H
    MOV DS, AX
    MOV SI, 2000H
    LEA BX, [SI+10H]; After the LEA instruction is executed, (BX) =2010H
    LDS DI, [SI+10H]; After the LDS instruction is executed, (DI) =1234H, (DS)=5678H
    LEA BX, BUFFER; BUFFER=5FE0H
    MOV BX, OFFSET BUFFER; (BX) =5FE0H
    Insert picture description here

7. Flag transfer instructions

  • format
    • LAHF! Read flag instruction. LAHF transfers the 5 flag bits in the lower 8 bits of the flag register to the designated bits in AH
    • SAHF! Set flag command. The function of SAHF is the opposite of the function of LAHF

Note: In the data transfer instructions, except for the two instructions SAHF and POPF, all other instructions do not affect the flag bit

Guess you like

Origin blog.csdn.net/qq_45975757/article/details/108943794