Lab Manual 4
Lab Manual 4
ImplementationofbasicAddressingmodesusingEMU8086
TASK1: Write a program to swap the contents of Ax and Bx registers using register addressing.
Register Ax loads 01H 1st Cx loads value of Ax, Add them and store the result in a third array
Register Bx loads 02H Ax loads value of Bx
Ax replaces Bx , and Bx
replaces Ax
TASK2: Declare two byte sized integer arrays num1and num2 having 5 elements each,
num3.
Source Code:-
DATA SEGMENT
NUM1 DB 1H,2H,3H,4H,5H
NUM2 DB 4H,3H,4H,5H,1H
NUM3 DB 5 DUP (0)
ENDS
CODE SEGMENT ASSUME
DS:DATA CS:CODE START:
MOV AX,DATA
MOV DS,AX
LEA SI,NUM1
LEA DI,NUM2
LEA BX,NUM3
MOV CX,5 LOOP1:
MOV AL,[SI]
ADD AL,[DI]
MOV [BX],AL
INC BX
INC SI
INC DI
LOOP LOOP1
MOV AH,4CH
INT 21H
ENDS
END START
Before execution NUM3 array shows 0 value on each location. To see the arrays click on the
view from top tool box then select variables.
After execution :-
TASK3: Write a program to swap the contents of two word sized arrays num1 and
num2.
Source Code:-
DATA SEGMENT
NUM1 DB 9H
NUM2 DB 7H ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AL,NUM1
MOV BL,NUM2
XCHG AL,NUM2
XCHG BL,NUM1
MOV AH,4CH
INT 21H
ENDS
END START
Before execution NUM3 array shows 0 value on each location. To see the arrays click on the
view from top tool box then select variables.
After Execution: