0% found this document useful (0 votes)
10 views3 pages

Largest Number

The document outlines an algorithm for finding the largest number from a list using assembly language. It includes a step-by-step process with specific instructions for initializing registers, comparing numbers, and storing the largest value. A flowchart and program code are also provided to illustrate the implementation of the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Largest Number

The document outlines an algorithm for finding the largest number from a list using assembly language. It includes a step-by-step process with specific instructions for initializing registers, comparing numbers, and storing the largest value. A flowchart and program code are also provided to illustrate the implementation of the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Largest Number

Algorithm:

Step 1 : Initialize Accumulator with smallest number (i.e) with 00H

Step 2 : Initialize HL pair with the address of count.

Step 3 : Get the count into Reg C.

Step 4 : Get the address of next number into HL pair.

Step 5 : Compare the next number.

Step 6 : Check for Carry. If carry doesn’t exist, larger number will be in Accumulator. Hence go to
step No8 .

Step 7 : Move the larger number from memory to Accumulator

Step 8 : Decrement Count.

Step 9 : Check whether count is Zero or not. If count is non-zero go to step No. 5.

Step 10: Store largest number in memory.

Step 11: Halt.


Flow Chart:
Start A

Initialize Accumulator with Store largest


Smallest number 00H number

Initialize HL pair with End


address of Count.

Get the count into


Reg C.

Get the address of next


number into HL pair

Compare the
next Number

Is
there any
Carry?

Move the number from


memory to Accumulator

Decrement
Count

Is
Count
Zero?

A
Program:
Address Machine Label Mnemon Operands Comment
Codes ics
2000 3E MVI A, 00H Initialize Accumulator with smallest
number 00H
2001 00
2002 21 LXI H, 2500H Initialize HL pair with the address Count
2003 00
2004 25
2005 4E MOV C,M Move count into Reg C.
2006 23 BACK INX H Increment HL pair for address of next No/.
2007 BE CMP M Compare the numbers
2008 D2 JNC AHEAD Jump if carry doesn’t exist
2009 0C
200A 20
200B 7E MOV A,M Move the number into Accumulator
200C 0D AHEAD DCR C Decrement Count
200D C2 JNZ BACK Jump if Count is non-Zero
200E 06
200F 20
2010 32 STA 24FF Store largest number in Memory
2011 FF
2012 24
2013 76 HLT Halt

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy