This site is developed to help engineering students. The site is new. Right now, we have only microprocessor programs in here. We will keep including more topics on more subjects in the future.
Microprocessor 8085 Programs

Monday, June 24, 2013

Arrange Three Numbers Stored in Memory in Ascending Order

Program: Arrange in ascending order, three numbers stored in memory.

Note:  Program starts from 9000H.
          Assuming the three numbers are stored at 8000H, 8001H and 8002H.
          

Label
Memory Location
Mnemonics
Opcode
Operand


9000
MVI B, 02
6
O2

 START:
9002
LXI H 8000H
21
OO
80

9005
MVI C, 02
0E
O2

 BACK:
9007
MOV A, M
7E



9008
INX H
23



9009
CMP M
BE



900A
JC SKIP
DA
15
90

900D
JZ SKIP
CA
15
90

9010
MOV D,M
56



9011
MOV M,A
77



9012
DCX H
2B



9013
MOV M,D
72



9014
INX H
23


 SKIP:
9015
DCR C
OD



9016
JNZ BACK
C2
O7
90

9019
DCR B
O5



901A
JNZ START
C2
O2
90

901D
HLT
76


No comments:

Post a Comment