0% found this document useful (0 votes)
37 views1 page

Microprocessor 8085 Appendix A

The document describes how to sum the numbers in a series stored in memory locations using an 8085 microprocessor. It initializes a counter with the length of the series, sets the accumulator to 0 to store the running sum, and uses a pointer register to step through each number, adding it to the accumulator. It increments the pointer, decrements the counter, and repeats until the counter reaches 0. Finally, it stores the final sum in a result location.

Uploaded by

manpreet kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Microprocessor 8085 Appendix A

The document describes how to sum the numbers in a series stored in memory locations using an 8085 microprocessor. It initializes a counter with the length of the series, sets the accumulator to 0 to store the running sum, and uses a pointer register to step through each number, adding it to the accumulator. It increments the pointer, decrements the counter, and repeats until the counter reaches 0. Finally, it stores the final sum in a result location.

Uploaded by

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

Microprocessor 8085

Appendix A

Explanation :
We are given a series of numbers. The length of series is stored at memory location D000 H. We will
initialise register C as counter with the length of the series.
We will initialise the accumulator with 00 H, so that the sum can be stored in the accumulator.
The series begins at D001 H. So, we will initialise HL the register pair as memory pointer to point the
series.
Using add instruction, add the contents, of the accumulator with the contents of memory location
pointed by HL register pair. The result of this addition will be stored in the A register.
Then we will increment HL to point to next memory location of the series. Decrement the count in
register C. Continue this process till the count is zero i.e. all the numbers in the series are added.
Store the result at memory location E000 H.
Example : Let D000 = 05 H i.e. series is of 5 numbers.
D001 = 08 H
D002 = 12 H
D003 = 74 H
D004 = 34 H
D005 = 04 H
Result = 08 H + 12 H + 74 H + 34 H + 04 H = C6 H
E000 H = C6 H.

Algorithm :

Step I
Step II
Step III

: Initialize the register C with count.


: Initialize sum in accumulator = 0.
: Initialize the pointer to memory location
D001 H i.e. first number of series.
Step IV : Add the numbers in series.
Step V
: Increment memory pointer to
next memory location.
Step VI : Decrement count
Step VII : Check if count = 0, if not goto step IV
Step VIII : Store the result at memory location E000 H.
Step IX : Stop.
Flowchart : Refer flowchart 15.
Program :
Instruction
Comment
LDA
D000
; A = contents of location D000 H
MOV
C, A
; Initialize counter
XRA
A ; sum = 0
LXI H, D001H
; Initialize HL as memory pointer
; for the series
L1: ADD M
; SUM in A= SUM in A + M
INX H
; Increment pointer
DCR
C ; Decrement counter
JNZ L1
; if counter 0 repeat
STA E000H
; store the result at memory location E000 H
HLT
; Terminate program execution
Flowchart 15

You might also like