Examples With Solutions
Examples With Solutions
Examples With Solutions
The data words 6FC7H, BAC0H and 90D4H are stored in data memory starting
with address 0090:20. Write an assembly language program that copies these words
from this memory to registers AX, CX and DX respectively. Then the program
copies the numbers from these registers to the stack memory.
0080:0
0090:20
MOV AX,0090
MOV DS,AX
MOV AX,[0020]
MOV CX,[0022]
MOV DX,[0024]
PUSH AX
PUSH CX
PUSH DX
INT 7
DW 6FC7, BAC0, 90D4
Another Solution:
0080:0
0090:20
MOV AX,0090
MOV DS,AX
MOV BX,0020
MOV AX,[BX]
MOV CX,[BX+2]
MOV DX,[BX+4]
PUSH AX
PUSH CX
PUSH DX
INT 7
DW 6FC7, BAC0, 90D4
Another Solution:
0080:0
0090:20
MOV AX,0090
MOV DS,AX
MOV BX,0020
MOV AX,[BX]
INC BX
INC BX
MOV CX,[BX]
INC BX
INC BX
MOV DX,[BX]
PUSH AX
PUSH CX
PUSH DX
INT 7
DW 6FC7, BAC0, 90D4
2. What will be the results when the following program is assembled and executed by
Intel 8088 microprocessor.
0080:0
MOV AX,0090
MOV DS,AX
MOV SI,0000
MOV BX,[SI+2]
MOV [SI],BX
MOV DX,SI
INT 7
0090:00
DW CCAA, BBFF
Results:
DX
M 0090:03
M 0090:02
0000
BB
FF
M 0090:01
BB
M 0090:00
FF
3. What will be the results when the following program is assembled and executed by
Intel 8088 microprocessor.
MOV AX,0090
MOV DS,AX
MOV SI,50
MOV CX,1000
SUB [SI], CX
MOV CX, [SI+2]
INT 7
0090:50
DW 2050, 2000
Results:
CX
M 0090:53
M 0090:52
2000
20
00
0080:0
M 0090:51
10
M 0090:50
50
4. Two unsigned data words 65DAH and C84ABH are stored in data memory starting
with address 0090:40.
Write a program that divides each word by the unsigned byte B5H. The program stores the
results in any registers.
0080:0
0090:40
MOV AX,0090
MOV DS,AX
MOV CL,B5
MOV AX,[0040]
DIV CL
MOV BX,AX
MOV AX,[0042]
DIV CL
MOV DX,AX
INT 7
DW 65DA, C84AB
Another Method
0080:0
0090:40
0090:44
MOV AX,0090
MOV DS,AX
MOV AX,[0040]
DIV BYTE PTR [0044]
MOV BX,AX
MOV AX,[0042]
DIV BYTE PTR [0044]
MOV DX,AX
INT 7
DW 65DA, C84AB
DB B5
0080:0
MOV AX,0090
MOV DS,AX
MOV AX,5FF7
SUB AX,BA65
MOV [0],AX
MOV AX,D406
SBB AX,90EC
MOV [2],AX
INT 7
Another Method:
0080:0
MOV AX,0090
MOV DS,AX
MOV AX,5FF7
MOB BX,BA65
SUB AX,BX
MOV [0],AX
MOV CX,D406
MOV DX,90EC
SBB CX,DX
MOV [2],CX
INT 7
6. What will be the results when the following program is assembled and executed by
Intel 8088 microprocessor.
0080:0
MOV DX,0090
MOV DS,DX
MOV BX,0030
MOV CX,0010
MOV [BX+2],CX
MOV BX,CX
MOV [0030],BX
INT 7
0090:30
DW CCAA, BBFF
Results:
BX
M 0090:33
M 0090:32
0010
00
10
M 0090:31
00
M 0090:30
10
7. Assume that the variables A, B, C, D and E are unsigned byte valued numbers
stored in data memory started with address 0090:10. The assigned values for these
variables are:
A= 60H , B=1FH, C=20H D=5FH, E=45H
Write a program that calculates the value of the variable X from the following
equation:
X= (AB+ 8E+C2)/ ( 77+D)
Store the result and the remainder in the data memory starting with address
0090:20.
0090:10
MOV DX,0090
MOV DS,DX
MOV AL,[0010]
MUL BYTE PTR [0011]
MOV BX,AX
MOV AL,8
MUL BYTE PTR [0014]
ADD BX, AX
MOV AL,[0012]
MUL AL
ADD AX,BX
MOV CL,[0013]
ADD CL,77
DIV CL
MOV [0020], AX
INT 7
DB 60 , 1F, 20 , 5F, 45
BX
M 0090:43
M 0090:42
M 0090:41
M 0090:40
2042
0040
08
00
EE
BB
N1:
END:
MOV DH,75
MOV CL,3
ROL DH,CL
OR DH,48
MOV BL,FF
NOT BL
JNZ N1
MOV BL,77
JMP END
MOV BL,88
INT 7
BL
77
DH
EB
M 0090:13
92
M 0090:12
A0
M 0090:11
51
5
M 0090:10
00
11. Three data words 67BAH, CE89H and 4F07H are stored in data memory starting
with address 0090:50. Write a program that Exclusive-ORs each of these words
with the word CF75H and stores the results in data memory starting with address
0090:00.
MOV AX,0090
MOV DS,AX
MOV AX,[50]
XOR AX,CF75
MOV [0],AX
MOV AX,[52]
XOR AX,CF75
MOV [2],AX
MOV AX,[54]
XOR AX,CF75
MOV [4],AX
INT 7
0090:50
DW 67BA, CE89,4F07
12. What are the results of the following program:
N2:
N1:
END:
CX
2365
M 0090:53
23
M 0090:52
65
13. Assume that the variables A, B, C and D are unsigned byte valued numbers stored
in data memory starting with address 0090:30. The assigned values for these
variables are:
A= 2EH , B=37H, C=44H, D=DCH.
Write a program that calculates the value of the variable X from the following
equation:
X= (4BC - A2)/ (D)
Assume that no borrow will result from the subtraction operation and the result of
calculating the value of 4BC will be a word only. The program stores the result
and the remainder in the data memory starting with address 0090:40.
MOV DX,0090
MOV DS,DX
MOV AL,4
MUL BYTE PTR [0031]
MUL BYTE PTR [0032]
MOV BX,AX
MOV AL,[0030]
MUL AL
SUB BX,AX
MOV AX,BX
DIV BYTE PTR [0033]
MOV [0040], AX
INT 7
0090:30
DB 2E,37,44, DC
14. The numbers N1=CAB0H and N2= 540FH are stored in data memory starting
with location 0090:0. Write a program the finds the value of the number N and
stores it in data memory 0090:10 where:
N=
0090:0
MOV DX,0090
MOV DS,DX
MOV AX,[0]
XOR AX,[2]
MOV CX,[0]
AND CX,[2]
NOT CX
OR AX,CX
NOT AX
MOV [10],AX
INT 7
DW CAB0,540F