0% found this document useful (0 votes)
132 views3 pages

Object:: Student'S Id: Lab 4 Student'S Name

Here are the key differences between LEA and Offset: - LEA (Load Effective Address) loads the effective address of an operand into a register without accessing memory. Offset returns the offset (distance in memory) of an operand. - LEA is used to calculate addresses, while Offset is used to return the distance between labels or variables in memory. - LEA allows accessing memory indirectly through a register, while Offset only provides the distance and does not access memory. Addressing modes are required in microprocessors because: - They allow accessing operands in memory using efficient addressing techniques rather than directly specifying absolute addresses. This provides flexibility. - Different addressing modes access memory in different ways (register, immediate

Uploaded by

Arsalan Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views3 pages

Object:: Student'S Id: Lab 4 Student'S Name

Here are the key differences between LEA and Offset: - LEA (Load Effective Address) loads the effective address of an operand into a register without accessing memory. Offset returns the offset (distance in memory) of an operand. - LEA is used to calculate addresses, while Offset is used to return the distance between labels or variables in memory. - LEA allows accessing memory indirectly through a register, while Offset only provides the distance and does not access memory. Addressing modes are required in microprocessors because: - They allow accessing operands in memory using efficient addressing techniques rather than directly specifying absolute addresses. This provides flexibility. - Different addressing modes access memory in different ways (register, immediate

Uploaded by

Arsalan Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Student’s ID: Lab 4 Student’s Name:

Object:

To learn how operands are processed by using Addressing Modes.

;This program reads two numbers from the keynoard and


;displays their sum,
;This program uses memory to store the variables

.model small
.stack 200
.data
crlf db 0dh,0ah,'$'
prompt1 db 'Enter the first positive integer: ','$'
prompt2 db 'Enter the second positive integer: ','$'
prompt3 db 'The sum of the two numbers is: ','$'
.code
.startup
lea dx,prompt1 ;display prompt1
mov ah,09h
int 21h

mov ah,01h ;read first number


int 21h
sub al,30h ;convert character to number
mov cl,al ;save the number in cl

lea dx,crlf ;move cursor to next line


mov ah,09h
int 21h
lea dx,prompt2 ;display prompt2
mov ah,09h
int 21h

mov ah,01h ;read second number


int 21h
sub al,30h ;convert character to number
add al,cl ;perform addition and save result in cl

mov cl,al
add cl,30h ;convert digit to character

lea dx,crlf ;move curcor to next line


mov ah,09h
int 21h
lea dx,prompt3 ;display prompt3
mov ah,09h
int 21h

mov dl,cl ;display sum


mov ah,02h
int 21h

.exit
End

____________________________________________________________________________

;This program reads two numbers from the keynoard and


;displays their sum,
;This program uses internal registers to store the variables
.model small
.stack 200
.data
crlf db 0dh,0ah,'$'
prompt1 db 'Enter the first positive integer: ','$'
prompt2 db 'Enter the second positive integer: ','$'
prompt3 db 'The sum of the two numbers is: ','$'
num1 db ?
num2 db ?
res db ?
.code
.startup
lea dx,prompt1 ;display prompt1
mov ah,09h
int 21h

mov ah,01h ;read first number


int 21h
sub al,30h ;convert character to number
mov num1,al ;save num1

lea dx,crlf ;move cursor to next line


mov ah,09h
int 21h
lea dx,prompt2 ;display prompt2
mov ah,09h
int 21h

mov ah,01h ;read second number


int 21h
sub al,30h ;convert character to number
mov num2,al ;save num2
add al,num1 ;perform addition
mov res,al ;save result in res

lea dx,crlf ;move curcor to next line


mov ah,09h
int 21h
lea dx,prompt3 ;display prompt3
mov ah,09h
int 21h

mov dl,res ;retreive res from memory


add dl,30h ;convert digit to character
mov ah,02h
int 21h
.exit
end

Assignment:
 What is the difference between LEA and Offset?
 Why addressing modes are required in Microprocessor? 
 Differentiate between Effective Address and Physical Address.

You might also like