Assembly language program for adding 5 numbers stored in consecutive memory
Program:
;<To add 5 numbers stored in consecutive memory>
LDA 2051 ;A=1
MOV B,A ;B=1
LDA 2052 ;A=2
ADD B;A=3
MOV B,A ;B=3
LDA 2053 ;A=3
ADD B ;A=6
MOV B,A ;B=6
LDA 2054 ;A=4
ADD B ;A=10
MOV B,A ;B=10
LDA 2055 ;A=5
ADD B ;A=15
STA 2056
HLT
Result:
Memory
Location
Data
value
2051
1
2052
2
2053
3
2054
4
2055
5
2056
15
Memory
Location
Data
value
2051
1
2052
2
2053
3
2054
4
2055
5
2056
15
Comments
Post a Comment