High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
Addressing modes
1.
2. Assembly language Programming
Low level language.
Depends on computer architecture.
Compiler converts high level language into machine language.
Assembler converts the ALP into machine language.
Machine language instructions contain only 0’s and 1’s.
Assembly language contain Mnemonics.
To study the behavior of particular architecture
Machine Language Assembly Language
B9 04 00 MOV CX,0004
B9 10 00 MOV CX,0010
3. Instructions
An instruction is divided in to two fields.
One field – Operation code (opcode)
Another field – Operands
An instruction contains an opcode and one or more operand
Mostly instructions contain only one or two operand.
Instruction size varies from 1 to 6 byte.
Assembly Language
MOV CX,0004
MOV Op-code
0004,CX Operands
ADD AX,BX
Opcode
Instruction
Operand
4. Addressing Modes
The way in which operands are specified
The operand may be mentioned directly or specified in register/memory.
7 types of Data Addressing Mode.
5. Data Addressing Modes
Immediate
Direct
Register
Register Indirect
Register Relative
Based Indexed
Relative Based Indexed
6. One of the operand is mentioned directly.
Data is available as a part of instruction.
Data is 8 0r 16 bit long.
No memory reference is needed to fetch data
Immediate Addressing Modes
7. Immediate Mode :Eg.
Example 1 : MOV CL, 03H
03 – 8 bit immediate source operand
CL – 8 bit register destination operand
Example 2: ADD AX, 0525H
0525 – 16 bit immediate source operand
AX – 16 bit register destination operand.
8. Register Addressing Mode
Both the operands are in registers
No memory access
Limited number of registers
Very small address field is needed to address registers.
Shorter instructions
Register Address
ES 00
CS 01
SS 10
DS 11
9. Example
Examples : 16 bit register instruction
MOV AX,BX
ADD AX,DI
8 bit register instructions
MOV CL,DL
ADD AL,CL
10. Direct addressing Modes
One or both the operands are in memory.
Operand in memory is specified through its effective address.
Default Segment register – DS
Data in that location will be used for specified operation.
If the instruction contain stack operation, segment register will
be SS.
12. Register indirect Mode
EA of operand(s) is/are specified in register.
Physical address is computed using segment register and EA .
Data in the physical address is an operand
13. Example
Example 1 : MOV AX, [BX]
[DS] = 5004, [BX] = 0020, PA=50060.
50060 contain 0015H
0015H is moved to memory AX
Example 2: MOV [BX],[AX]
Source and destination address is calculated by AX and BX content
respectively .
Then content of source address is moved to destination address
14. Register Relative
Effective address = [ Base/pointer register] + 8 or 16 bit
displacement
Base/Pointer register : BX or BP or SI or DI
15. Example
MOV AX, 10[BP]
[BP] = 0105 , [DS] = 2020
P.A = 20200 + 0105 + 10 = 20315
Content of memory address 20315 is moved to AX
16. Based Indexed MODE
Effective address = [Base register] + [Index register]
Base register BX or BP
Index register SI or DI
17. Example
MOV AX,[BX][SI]
[BX] = 1500 [SI] = 0020 [DS] = 2020
P.A of source : 20200 + 1500 + 0020 = 21720
Content of 21720 is moved to AX
18. Relative Based Indexed
Effective address = [Base register] + [Index register]
+ 8 or 16 bit displacement
19. Example
1. MOV CX,1010[BX][SI]
[BX] = 102B [SI] = 0003 [DS] = 2020
PA = 20200 + 102B + 0008 + 1010 = 2223E
Content of memory address 2223E is moved to CX
2.MOV 1010[BX][SI], CX
20. Which Mode is fastest? Why?
Register addressing mode
Direct addressing modes require more bits to represent address of operand
Memory reference require 20 bits
Limited number of registers
Very small address field needed
Shorter instructions
Faster instruction fetch
Register reference require only 2 or 3 bits .
21. Problem
Given that
[BP] = 5000 [SI] = 0005 [DI]=0100 [DS] = 1000
[6000] = 520A [6005] = 5402 [6100] = 0003 [6015]=065B
[6110] = 003E
[5000] = 5505 [5100] = FB05 [5005] = 060B
After the following instructions are executed, What will be the value
of registers AX,BX,CX,DX ? DS is a segment register for all instructions.
MOV AX,[BP]
MOV DX, [5100]
MOV BX,5[BP]
MOV CX,[BP][DI]
22. ALP Program
MOV AX,4343
MOV BX,1111
ADD AX,BX
MOV [2000H],AX
HLT
Note:
HLT – Halt the process.
Indicate end of the program
23. ALP for different addressing modes
Immediate mode
MOV AX, 200
ADD AX,300
MOV [2000],AX
HLT
Register mode
MOV BX,500
MOV AX,200
ADD AX,BX
MOV [5000],AX
HLT
27. Steps
Menu display – A,D,F,I,M,P,T,U
Enter A - Assembly
Enter program
Menu display – D input location
Input data in memory
Execute using Go command
Menu display – D output location