0% found this document useful (0 votes)
100 views2 pages

To Find The Largest Number

The program finds the largest number stored in memory addresses 0000H to 0004H. It loads the first value into register E, then uses a loop to compare the value in register A to the number at the current memory address. If A is smaller, its value is updated. After the loop, register A contains the largest number, which is stored back to memory address 0005H.

Uploaded by

Aniket Safari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views2 pages

To Find The Largest Number

The program finds the largest number stored in memory addresses 0000H to 0004H. It loads the first value into register E, then uses a loop to compare the value in register A to the number at the current memory address. If A is smaller, its value is updated. After the loop, register A contains the largest number, which is stored back to memory address 0005H.

Uploaded by

Aniket Safari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PRACTICAL-7

AIM: write an assembly program to find the largest number


SOFTWARE: GNU 8085
Program Input: Before execution

REGISTER MEMORY
ADDRESS
HEX DATA
A=00H 0000 05
B=00H 0001 07
C=00H 0002 09
L=00H 0003 11
0004 02
0005 00

MEMORY OPCODE OPERAND HEXCODE COMMENT


ADDRESS
4200 MVI E, 05H 1E 05h data
moves in
register E
4201 05
4202 LXI H, 0000H 21 Load register
pair
immediately
4203 00
4204 00
4205 MOV A, M 7E Move from
M to A
4206 DCR E 1D Decrement
register by 1
4207 L1:INX H 23 Increment
register pair
by 1
4208 MOV B, M 46 Move from
M to B
4209 CMP B B8 Compare
register with
accumulator
420A JNC L2 D2 Jump on no
carry
420B 0E
420C 042
420D MOV A, B 78 Move from B
to A
420E L2: DCR E 1D Decrement
register by 1
420F JNC L1 C2 Jump on no
zero
4210 07
4211 042
4212 STA 0005H 32 Stores data
in 0005h
memory
address
4213 05
4214 00
4215 HLT 76 Stop
execution

Program output: after execution

REGISTE MEMORY
R
HEX DATA
A=08H 0000 05
B=02H 0001 07
C=00H 0002 09
L=04H 0003 11
0004 02
0005 11

You might also like