Assembly language program for adding 10 numbers stored in memory using loop and store the MSB in D and LSB in A

Program:

;<ALP adding 10 numbers stored in memory using loop >
;<and store the MSB in D and LSB in A >

MVI C,10 ;counter
MVI D,00 ;MSB Byte
MVI A,00 ;LSB Byte
LXI H,2051    
BACK: MOV B,M 
ADD B
JNC NEXT
INR D
NEXT: INX H
DCR C
JNZ BACK
STA 2061
MOV A,D
STA 2062
HLT

Result: 

Memory Location
Data value
2051
1
2052
2
2053
3
2054
4
2055
5
2056
6
2057
7
2058
8
2059
9
2060
10
2061
55
2062
0

Comments

Popular posts from this blog

Preamble to the Constitution of India:

Designing a calculator using HTML and JavaScript