Problem Set-1
Problem Set-1
EC-373 Microprocessor
Engineering Lab
PROBLEM NO. 1 :
Write an assembly-level code to perform multiplication and division of two given
numbers, and store the result in two consecutive external memory locations
pointed by a base address present in the Destination Index Register.
PROPOSED SOLUTION :
SOLUTION :
PROBLEM SET-1 1
Move AX into DS to set data
7213H 8E D8 mov ds, ax
segment.
Divide AX by BL . Result:
722CH F6 F3 div bl
quotient in AL , remainder in AH .
FINAL OUTPUT :
0720:2000 1B 27
0720:2001 03 003
Problem No. 2 :
The following infinite series in termed as a Fibonacci series in Mathematics,
where every number in the series is a sum of the preceding two numbers in the
infinite series:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34,........
PROBLEM SET-1 2
Write an Assembly-level code for an 8086-CPU, to generate a Fibonacci
series upto 20-terms. You are required to store the 20-terms as hexadecimal
numbers in consecutive locations within the data-segment of the external
memory.
Proposed Solution :
SOLUTION :
7215H 8A 1C mov bl, [si] Move the byte from address [SI]
PROBLEM SET-1 3
into BL .
mov di,
7217H 8B 3E 02 00 baseadd
Load 2000h into DI .
FINAL OUTPUT :
0720:2000 00 000
0720:2001 1 1
PROBLEM SET-1 4
0720:2003 1 1
0720:2005 2 2
0720:2007 3 3
0720:2009 5 5
0720:200B 8 8
0720:200D D 13
0720:200F 15 21
0720:2011 22 34
0720:2013 37 55
0720:2015 59 89
0720:2017 90 144
0720:2019 E9 233
0720:201B 79 121
0720:201C 1 1
0720:201D 62 98
0720:201E 02 2
0720:201F DB 219
0720:2020 2 2
0720:2021 3D 61
0720:2022 3 3
0720:2023 18 24
0720:2024 4 4
0720:2025 55 85
0720:2026 4 4
0720:2027 6D 109
0720:2028 4 4
0720:2029 C2 194
0720:202A 4 4
PROBLEM SET-1 5
Problem No. 3 :
Proposed Solution :
SOLUTION :
Memory
Machine Code Mnemonic Comment
Location
PROBLEM SET-1 6
baseadd
RESULTS :
0720:2000 01 001
0720:2001 00 000
0720:2002 02 002
0720:2003 00 000
0720:2004 06 006
0720:2005 00 000
0720:2006 18 024
0720:2007 00 000
PROBLEM SET-1 7
0720:2008 78 120
0720:2009 00 000
0720:200A D0 208
0720:200B 02 002
0720:200C B0 176
0720:200D 05 005
0720:200E 80 128
0720:200F 05 005
0720:2010 80 128
0720:2011 04 004
Problem No. 4 :
Consider the following equation from Classical Mechanics, referred to as
the Second-equation of Motion, which is used to calculate the displacement
(s) of an object:
s = u.t + (1/2) at2
where, u is the initial velocity of the object, t is time taken and a is the
acceleration. Write a program in EMU-8086 emulator to receive inputs
from the user for the parameters, namely: Initial Velocity, Time and
Acceleration. Use the 8086 microprocessor to help you compute the
Displacement (s) value, based on the user inputs. Display the computed
Displacement value in the output terminal of the EMU-8086 emulator.
PROPOSED SOLUTION :
PROBLEM SET-1 8
SOLUTION :
PROBLEM SET-1 9
Convert ASCII to numeric by
0721Dh 2C 30 sub al, 48
subtracting 48.
PROBLEM SET-1 10
Interrupt 21h to output line
07245h CD 21 int 21h
feed.
print 'Value of Print prompt for acceleration
07247h B4 09 acceleration is :' input.
PROBLEM SET-1 11
Multiply t again to get t^2
0726Bh F6 E3 mul bh
(AX).
RESULTS :
input value of
BL 1H 1
initial velocity
input value of
BH 2H 2
time
input value of
CL 2H 2
acceleration
calculated
CH 2H 2
value of u.t
PROBLEM SET-1 12
54(54 in ASCII = 6 in answer(in
DL 36H
decimal) ASCII)
Problem No. 5 :
The following table indicates the average temperature recorded at Varanasi (in
degree celsius) during various days of a year:
Jan-23 200 C
Jan-31 240 C
Feb-21 320 C
Feb-28 340 C
Mar-23 380 C
May-24 420 C
May-31 450 C
Jul-24 360 C
Aug-24 330 C
Dec-13 230 C
PROPOSED SOLUTION :
PROBLEM SET-1 13
SOLUTION :
PROBLEM SET-1 14
0721:0014 C7 05 22 00 mov [di], 34 Store 34 at next address
RESULTS :
AL 2D 45
PROBLEM SET-1 15