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

ADD ARBITRARY NO. OF NUMBERS STORED IN CONTIGUOUS MEMORY LOCATIONS

Program: Add arbitrary numbers stored in contiguous memory locations.

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 Locations
Mnemonics
Opcode
Operand


8000
MVI C, 00
OE
OO


8002
LXI H, 9000H
21
O1
90
8005
MOV B, M
46
8006
DCR B
05
8007
INX  H
23

8008
MOV A,M
7E


LOOP:
8009
INX H
23



800A
ADD M
86



800B
JNC SKIP
D2
0F
80

800E
INR C
OC


SKIP:
800F
DCR B
O5


8010
JNZ LOOP
C2
O9
80
8013
STA 8FFEH
32
FE
8F
8016
MOV A, C
79


8017
STA 8FFFH
32
FF
8F
801A
HLT
76


No comments:

Post a Comment