0% found this document useful (0 votes)
137 views9 pages

8085 Assembly: Find Largest & Smallest

The document details two experiments using 8085 assembly language instructions to find the largest and smallest numbers in an array - it provides the aim, theory, algorithm, flowchart, program code, input and output for finding the largest number in the first experiment and then repeats this for finding the smallest number in the second experiment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views9 pages

8085 Assembly: Find Largest & Smallest

The document details two experiments using 8085 assembly language instructions to find the largest and smallest numbers in an array - it provides the aim, theory, algorithm, flowchart, program code, input and output for finding the largest number in the first experiment and then repeats this for finding the smallest number in the second experiment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Delhi Technological University

Government of NCT of Delhi


Shahbad Daulatpur, Bawana Road Delhi-110042

EE272-Automotive Electrical and Electronics


Practical File
To find the largest number in an array of data using 8085 instruction set & to find the
smallest number in an array of data using 8085 instruction set

Submitted by -: Submitted to -:
Abhishek Prajapati (2K19/AE/001) Asst. Prof. Himanshu singh
EXPERIMENT 5(i)

Aim: To find the largest number in an array of data using 8085 instruction set.
Apparatus: Microprocessor 8085, keyboard, mouse etc.
Theory:
Algorithm:
Step 1: load the address of the first element of the array in hl pair
Step 2: move the count to b – reg.
Step 3: increment the pointer
Step 4: get the first data in a – reg.
Step 5: decrement the count.
Step 6: increment the pointer
Step 7: compare the content of memory addressed by hl pair with that of a - reg.
Step 8: if carry = 0, go to step 10 or if carry = 1 go to step 9
Step 9: move the content of memory addressed by hl to a – reg.
Step 10: decrement the count
Step 11: check for zero of the count. If zf = 0, go to step 6, or if zf = 1 go to next step.
Step 12: store the largest data in memory.
Step 13: Terminate the program.
Flowchart:
Program:
Address HEX Labels Mnemonics Comments
Codes

F000 21, 00, 80 LXI Point to get array size


H,8000H

F003 4E MOV C, M Get the size of array

F004 23 INX H Point to actual array

F005 46 MOV B, M Load the first number into B

F006 0D DCR C Decrease C

F007 23 LOOP INX H Point to next location

F008 7E MOV A, M Get the next number from memory


to Accumulator

F009 B8 CMP B Compare Accumulator and B

F00A DA, 0E, JC SKIP if B > A,then skip


F0

F00D 47 MOV B, A If CY is 0, update B

F00E 0D SKIP DCR C Decrease C

F00F C2, 07, JNZ LOOP When count is not 0, go to LOOP


F0

F012 21, 00, 90 LXI Point to destination address


H,9000H

F015 70 MOV M, B Store the minimum number

F016 76 HLT Terminate the program


Input
Address Data

8000 06

8001 55

8002 22

8003 44

8004 11

8005 33

8006 66

Output

Address Data

9000 66

Result: Thus the program to find the largest number in an array of data was executed
successfully.
Experiment 5(ii)

Aim: To find the smallest number in an array of data using 8085 instruction set..
Apparatus: Microprocessor 8085, keyboard, mouse etc.
Theory:
Algorithm:
Step 1: Load the address of the first element of the array in HL pair
Step 2: Move the count to B – reg.
Step 3: Increment the pointer
Step 4: Get the first data in A – reg.
Step 5: Decrement the count.
Step 6: Increment the pointer
Step 7: Compare the content of memory addressed by HL pair with that of A - reg.
Step 8: If carry = 1, go to step 10 or if Carry = 0 go to step 9
Step 9: Move the content of memory addressed by HL to A – reg.
Step 10: Decrement the count
Step 11: Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to next
step.
Step 12: Store the smallest data in memory.
Step 13: Terminate the program
Flowchart:

PROGRAM:
Address HEX Labels Mnemonics Comments
Codes

F000 21, 00, 80 LXI Point to get array size


H,8000H

F003 4E MOV C, M Get the size of array

F004 23 INX H Point to actual array

F005 46 MOV B, M Load the first number into B

F006 0D DCR C Decrease C

F007 23 LOOP INX H Point to next location

F008 7E MOV A, M Get the next number from memory


to Accumulator

F009 B8 CMP B Compare Accumulator and B

F00A D2, 0E, JNC SKIP if B <= A, then skip


F0

F00D 47 MOV B, A If CY is 1, update B

F00E 0D SKIP DCR C Decrease C

F00F C2, 07, JNZ LOOP When count is not 0, go to LOOP


F0

F012 21, 00, 90 LXI Point to destination address


H,9000H

F015 70 MOV M, B Store the minimum number

F016 76 HLT Terminate the program


Input

Address Data

8000 06

8001 55

8002 22

8003 44

8004 11

8005 33

8006 66

Output

Address Data

9000 11

Result: Thus the program to find the smallest number in an array of data was executed
successfully.

You might also like