2

    Cards (35)

    • Addressing mode indicates a way of locating data or operands
    • The addressing mode describes the types of operands and the way they are accessed for executing an instruction
    • Instructions may be categorized as sequential control flow instructions and control transfer instructions based on their execution
    • Sequential control flow instructions transfer control to the next instruction appearing immediately after it in the program
    • Examples of sequential control flow instructions include arithmetic, logic, data transfer, and processor control instructions
    • Control transfer instructions transfer control to a predefined address or an address specified in the instruction after their execution
    • Examples of control transfer instructions include INT, CALL, RET, and JUMP
    • Immediate addressing mode:
      • Immediate data is a part of the instruction and appears in the form of successive byte or bytes
      • Example: MOV AX, 0005H
    • Direct addressing mode:
      • A 16-bit memory address (offset) is directly specified in the instruction
      • Example: MOV AX, [5000H]
    • Register addressing mode:
      • Data is stored in a register and referred using the particular register
      • All registers, except IP, can be used in this mode
      • Example: MOV BX, AX
    • Register indirect addressing mode:
      • The address of the memory location containing data or operands is determined indirectly using the offset registers
      • The offset address of data is in either BX or SI or DI Register, with the default segment being either DS or ES
      • Example: MOV AX, [BX]
    • Indexed addressing mode:
      • Offset of the operand is stored in one of the index registers, with DS & ES being the default segments for index registers SI & DI respectively
      • Example: MOV AX, [SI]
    • Register relative addressing mode:
      • Data is available at an effective address formed by adding an 8-bit or 16-bit displacement with the content of any one of the registers BX, BP, SI & DI in the default segment (either in DS & ES)
      • Example: MOV AX, 50H [BX]
    • Based indexed addressing mode:
      • The effective address of data is formed by adding the content of a base register (BX or BP) to the content of an index register (SI or DI), with the default segment register being ES or DS
      • Example: MOV AX, [BX][SI]
    • Intersegment direct addressing mode:
      • The address to which the control is transferred is in a different segment
      • CS and IP of the destination address are specified directly in the instruction
      • Example: JMP 5000H: 2000H
    • Intersegment indirect addressing mode:
      • The address to which the control is transferred lies in a different segment and is passed to the instruction indirectly
      • Contents of a memory block containing four bytes (IP(LSB), IP(MSB), CS(LSB), and CS(MSB)) are used to specify the address
      • Example: JMP [2000H]
    • Intrasegment direct mode:
      • The address to which the control is transferred lies in the same segment as the control transfers instruction
      • The address appears directly in the instruction as an immediate displacement value
    • Displacement is computed relative to the content of the instruction pointer
    • Effective address for control transfer is the sum of 8 or 16-bit displacement and current content of jump instruction
    • Short jump occurs when displacement is between -128 to +127, long jump occurs when displacement is between -32768 to +32767
    • In intrasegment indirect mode, the displacement for control transfer is in the same segment as the instruction and is passed directly
    • Branch address is found as the content of a register or a memory location in intrasegment indirect mode
    • Data transfer instructions are classified into 7 types for the 8086 microprocessor
    • Data transfer instructions include:
      • Data transfer from memory to internal register, internal register to memory, one register to another register, input port to internal register, internal register to output port, etc.
      • MOV instruction is a general purpose instruction for transferring byte or word between registers, memory, or with immediate addressing
    • General form of MOV instruction: MOV destination, source
      • Source and destination must be of the same size, either both 8-bit or both 16-bit
      • MOV instruction does not affect any flags
    • Examples of MOV instruction:
      • MOV BX, 00F2H: load the immediate number 00F2H into BX register
      • MOV CL, [2000H]: copy the 8-bit content of the memory location at a displacement of 2000H to the CL register
    • PUSH instruction decrements the stack pointer by two and copies a word from the source to the location where the stack pointer points
    • PUSH instruction pushes the most significant byte to SP-1 and the least significant byte to SP-2, without affecting any flags
    • Example of PUSH instruction: PUSH CX
    • POP instruction copies a word from the stack location pointed by the stack pointer to the destination, and the stack pointer is automatically incremented by two after the copy
    • Example of POP instruction: POP CX
    • IN and OUT instructions are used for copying data between ports and the accumulator, supporting both direct and indirect addressing modes
    • XCHG instruction exchanges the contents of the destination and source, where they can be registers or memory locations
    • General format of XCHG instruction: XCHG Destination, Source
    • Examples of XCHG instruction:
      • XCHG BX, CX: exchange word in CX with the word in BX
      • XCHG AL, CL: exchange byte in CL with the byte in AL
      • XCHG AX, SUM[BX]: interchange the content at physical address DS+SUM+[BX] with the content of AX
    See similar decks