You are on page 1of 4

Experiment 10: Smallest number in an Array.

Student Name: Yash Gautam UID: 20BCS7550


Branch: CSE Section/Group: 718 B
Semester: 4th Date of Performance:22/04/2022
Subject Name: MPI Lab Subject Code:20CSP-153

1. Aim/Overview of the practical: Write a program to find the smallest number in an


array.

2. Task to be done: We have to write a program to find the smallest number in an array.

3. Apparatus/Simulator used (For applied/experimental sciences/materials based labs):


 Jubin 8085 Simulator
 Java Language
 JDK
4. Algorithm/Flowchart:
To find the smallest number in the array:
 Begin.
 Load the HL pair with address 3000H.
 Move value of counter from memory to C.
 Increment HL pair.
 Move the 1st number from memory to Accumulator.
 Decrement counter.
 LOOP: Increment HL pair.
 Move next number from memory to B.
 Compare B with A using CMP command.
 Jump to LABEL if no carry.
 Move smallest value from B to A.
 LABEL: decrement counter C.
 Jump to LOOP if counter C is not zero.
 Increment HL pair.
 Move result from accumulator to memory.
 Store content of A at 3006H location.
 Halt the program.
5. Description/ Code:
 To find the smallest number in the array:

LXI H,3000H
MOV C,M
INX H
MOV A,M
DCR C

LOOP:INX H
MOV B,M
CMP B
JC LABEL
MOV A,B

LABEL: DCR C
JNZ LOOP
INX H
MOV M,A
STA 3006H
HLT

#ORG 3000H
#DB 05H, 50H, 25H, 20H, 30H, 55H

6. Result/Output/Writing Summary:

 To find the smallest number in the array:


Learning outcomes (What I have learnt):

1. Learnt CMP and DCR commands.

2. Learnt JNZ and JC commands.


3. Learnt how to find smallest number in an array.

4. Learnt how to initialize an array in Jubin 8085 programming.

5. Learnt how to use labels for jumping.

Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):

Sr. No. Parameters Marks Obtained Maximum Marks


1.
2.
3.

You might also like