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


Find The Larger Number Between Two Numbers Stored In Memory

Program: Find the larger between two numbers stored in memory.

Note:  Program starts from 8000H.
          Assuming the two numbers are stored at 9000H and 9001H.
          To store the larger number at 9002H.

Label
Memory Location
Mnemonics
Opcode
Operand



8000
LDA 9000H
3A
OO

9O

8003
MOV B, A
47




8004
LDA 9001H
3A
O1

9O

8007
CMPB
B8




8008
JNC SKIP
D2
OC

8O

800B
MOV A,B
78



 SKIP:
800C
STA 9002
32
O2

90 
800F
HLT
76


Disassemble the Nibbles of a Byte

Program: Disassemble the Nibbles of a Byte 
(E.g. XY into 0X & 0Y, where X is the higher nibble, Y is the lower nibble)

Note: Program starts from memory location 8000H.
         Assuming total no. of numbers to be added stored in 9000H,
                        numbers to be added stored from 9001H to 900AH.
         Storing sum(lower byte) at 8FFEH, carry(higher byte) at 8FFFH.

Label
Memory Location
Mnemonics
Opcode
Operand


8000
LDA 9000H
3A
OO
90

8003
ANI 0FH
E6
OF


8005
STA 9001H
32
O1
90

8008
LDA 900H
3A
OO
90

800B
RRC
OF



800C
RRC
OF



800D
RRC
OF



800E
RRC
OF



800F
ANI 0FH
E6
OF


8011
STA 9002H
32
O2
90

8014
HLT
76


Division

Program: Division with Divisor and Dividend stored in memory.

Note: Program starts from memory location 8000H.
         Assuming: Divisor stored at  9000H, Dividend stored at  9001H.
         Storing Quotient at 9002H, carry(higher byte) at 9003H.

Label
Memory Location
Mnemonics
Opcode
Operand


8000
LXI H, 9000
21
OO
9O

8003
MOV A, M
7E



8004
INX H
23



8005
MOV B,M
46



8006
MVI C, 00H
OE
OO

LOOP2:
8008
MOV D,A
57


LOOP1:
8009
DCR B
O5



800A
DCR D
15



800B
JNZ LOOP1
C2
O9
8O

800E
INR C
OC



800F
CMP B
B8



8010
JC LOOP2
DA
O8
8O

8013
JZ LOOP2
CA
O8
8O

8016
INX H
23



8017
MOV M, C
71



8018
INX H
23



8019
MOV M, B
7O



801A
HLT
76