Write a program to add all this byte and store the low byte
Write a program to add all this byte and store the low byte in R3 and the hi byte in R2
Solution
It is an assembly program that works with 8086 microprocessor.
MOV R0, #40H ; R0 is a pointer starting from 40H
MOV R2, #6 ; 6 iteration
CLR A
CLR C
Again: ADDC A, @R0 ; Addition
INC R0 ; increasing pointer
DJNZ R2, Again
MOV R2, A ; Taking backup of A in R2
ANL A, #0FH ; gettling lower byte of A
MOV R3, A ; storing lower byte of A into R3
MOV A, R2 ; Storing Original A Data
ANL A, #F0H ; Getting higher bytes of A
MOV R2, A ; Storing Higher byte into R2
