Lecture-4 (8086 Memory Address Space Partition - Addressing Modes and Machine Coes) Notes
Lecture-4 (8086 Memory Address Space Partition - Addressing Modes and Machine Coes) Notes
HLT ; no operand
V. Base-plus-index addressing
MOV AL, BX
IV. Register [indirect] addressing
Register supplies the address of the required data
II. Indirect
III. Relative
CALL 1000:0000
CALL doagain ; doagain is a procedure in code
or indirect addressing
OUT DX, AL ; DX contains the address of I/O port
BYTE 3 BYTE 4
BYTE 5 BYTE 6
If the other operand is memory location, there are 24 ways of specifying how the
execution unit should compute the effective address of the operand in the main
memory.
If the effective address specified in the instruction contains displacement less than
256 along with the reference to the contents of the register then put in 01 as the
MOD bits.
If the expression for the effective address contains a displacement which is too
large to fit in 8 bits then out in 10 in MOD bits.
CSE – 341: Microprocessors
BRAC University
REG Field
REG field is used to identify the register of the one operand
6 bits of
MOV, ADD etc OPCODE D W MOD REG R/M
D - direction
If D=0, then direction is from a register (source)
If D=1, then direction is to a register (destination)
W - word
If W=0, then only a byte is being transferred (8 bits)
If W=1, them a whole word is being transferred (16 bits)
1 0 0 0 1 0 0 0 1 0
OPCODE D W MOD REG R/M
Therefore D=0
MODE OPERAND NATURE
source-- 8 bits (not a word size) 00 Memory with no displacement
MOV [SI + 8B43H] , DH Therefore W=0 01 Memory with 8-bit displacement
10 Memory with 16-bit displacement
11 Both are registers
BYTE 3 BYTE 4
1 0 0 0 1 0 0 0 1 0 1 1 0
OPCODE D W MOD REG R/M
1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0
OPCODE D W MOD REG R/M
1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0
OPCODE D W MOD REG R/M
BYTE 3 BYTE 4
0 1 0 0 0 0 1 1 1 0 0 0 1 0 1 1
LOW BYTE DISPLACEMENT HIGH BYTE DISPLACEMENT
Machine Code: 1000 1000 1011 0100 0100 0011 1000 10112 or 88 B4 43 8B16
CSE – 341: Microprocessors
BRAC University
Example 2
MOV AX, BX: given the opcode for MOV=100010
BYTE 1 BYTE 2
1 0 0 0 1 0 1 1 1 1
OPCODE D W MOD REG R/M
AX considered which is a
destination operand,
therefore D = 0
1 0 0 0 1 0 1 1 1 1 0 0 0
OPCODE D W MOD REG R/M
BYTE 1 BYTE 2
1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1
OPCODE D W MOD REG R/M