Statement: Calculate the sum of series of numbers. The length of the series is in memory location 4200H and the series begins from memory location 4201H.
a. Consider the sum to be 8 bit number. So, ignore carries. Store the sum at memory location 4300H.
b. Consider the sum to be 16 bit number. Store the sum at memory locations 4300H and 4301H.
a. Sample problem

4200H  = 04H
4201H  = 10H
4202H  = 45H
4203H  = 33H
4204H  = 22H
Result = 10 +41 + 30 + 12 =  H
4300H  =  H

Source program:

LDA 4200H
MOV C, A                : Initialize counter
SUB A                        : sum = 0
LXI H, 420lH                : Initialize pointer
BACK:        ADD M                : SUM = SUM + data
INX H                        : increment pointer
DCR C                        : Decrement counter
JNZ BACK                : if counter  0 repeat
STA 4300H                : Store sum
HLT                        : Terminate program execution


Home
8085 Forum
8085 Free Projects
8085 Free Programs
8085 Tutorials
8085 details
Interfacing Techniques
Electronic Tutorials
Electronic Projects
Assembler/ IDE
Datasheets
Guest Book
About Me
b. Sample problem

4200H =  04H        
420lH  = 9AH
4202H = 52H
4203H = 89H
4204H = 3EH
Result = 9AH + 52H + 89H + 3EH = H
4300H = B3H Lower byte
4301H = 0lH Higher byte

Source program:

               LDA 4200H
               MOV C, A                : Initialize counter
               LXI H, 4201H                : Initialize pointer
               SUB A                        :Sum low = 0
               MOV B, A                : Sum high = 0
       BACK: ADD M                        : Sum = sum + data
               JNC SKIP                
               INR B                        : Add carry to MSB of SUM
       SKIP: INX H                        : Increment pointer
               DCR C                        : Decrement counter
               JNZ BACK                : Check if counter 0 repeat
               STA 4300H                : Store lower byte
               MOV A, B
               STA 4301H                : Store higher byte
               HLT                        :Terminate program execution




                                                       



FLOWCHART