Experiment 8: Write an ALP for 8085 to find sum of series of n consecutive numbers


AIM

Write an ALP for 8085 to find sum of series of n consecutive numbers

Objective:

To learn and understand the assembly instructions

To draw flow chart for addition of a series of numbers

To develop an 8085 assembly language program to add series of number

Flowchart

 

Program to add series of numbers

Address

OP-CODE

Label

Mnemonic

Comments

4200

C3 10 42

JMP start

4203

0A

N:

DB 10

;Number of bytes

4204

19 2D 43 57 44 4A 2C 4E 56 27

X:

DB 25,45,67,87,68,74,44,78,86,39

420E

00 00

y:

DB 00,00

;result

;code

4210

00

start:

nop

4211

21 03 042

LXI H,N

;Pointer to number of bytes

4214

4E

MOV C,M

; NO.OF DIGITS SET AS COUNT

4215

AF

XRA A

;Clear Accumulator

4216

06 00

MVI B,00

;Clear B to save carry

4218

23

INX H

Pointing in data (numbers)

4219

86

LOOP1:

ADD M

421A

D2 1E 42

JNC SKIP

Jump if no carry

421D

04

INR B

421E

23

SKIP:

INX H

421F

0D

DCR C

;Decrement counter

4220

C2

JNZ LOOP1

;Jump to LOOP1 if all numbers not been added

4223

77

MOV M,A

;Save result

4224

23

INX H

4225

70

MOV M,B

;Save carry

4226

76

HLT

; Stop

OUTPUT

error: Content is protected !!