L3 8086 Addressing
L3 8086 Addressing
Microprocessor
Data Addressing
Modes
Assembly Level Programming
Opcode Operand
s
o opcode (stands for operational code) corresponds to the
operation the processor needs to carry out
o And the operations are carried out on operations
o Again, coming back to the definition of software as collection of
code and data, opcodes corresponds to the code portion and
operands corresponds to the data portion 5
Sample 8086 Assembly program
7
Addressing modes
MOV AL,BL
Copies 8-bit data from BL register to AL register
MOV CH,AL
Copies 8-bit data from AL register to CH register
MOV AL,BX
Trying to move 16-bit data from BX to AL (8-bit register)
May be no syntax error but should not use 10
Register Addressing
MOV AX,CX
MOV between general purpose register
MOV CS,BX
MOV between general purpose and segment registers
MOV DS,CS
11
MOV between segment registers is illegal
Immediate Addressing
MOV AL,22
Copies data 22H to AL register (1 Byte data transfer)
MOV BX,49FE
Copies data 49FEH to BX register (2 Bytes (one word) data
transfer)
MOV CH,145
12
Error since CH (1 byte register) cannot store 145H (2 bytes)
Immediate Addressing
Memory
Immediate Addressing
MOV AX,[23FE]
o Copies 16-bit data (word) from address 23FE to AX register. Since
16-bit data, data in 23FE will get copied to AL register and 23FF to
AH
MOV [12FC],AL
o Copies 8-bit data from AL register to address DS:12FC
17
Displacement Addressing
MOV CX,[23FE]
o Copies 16-bit data (word) from address 23FE to CX register. Since 16-
bit data, data in 23FE will get copied to CL register and 23FF to CH
19
Register Indirect Addressing
20
Register Indirect Addressing
o Instructions such as
MOV [DI],10
also creates ambiguity regarding size of data (whether 1-byte or 2-
bytes)
o Will have to use size specification
MOV byte ptr [DI],10 ;move 1 byte
MOV word ptr [DI],10 ;move 1 word
MOV dword ptr [DI],10 ;move 1 dword
o The qualifiers byte ptr, word ptr etc. are assembler directives,
which help assembler to choose the proper machine code
21
Base Plus Index Addressing
MOV AX,[BX+SI+100]
24
Thank you
any questions
25