Q. Two set of ten data bytes are stored at memory location staring from C000H to C009H
and memory location D000H to D009H. Write a program to add the data bytes of
corresponding locations and store the result at memory locations E000H to E009H.
(Hint: add the data of C000H with D000H and store the result at E000H, similarly
C001H with D001H and store the result at E001H and so on…)
Solution:
LXI H, C000H
LXI D, D000H
LXI B, E000H
LABEL1: LDAX D
ADD M
STAX D
INX H
INX D
INX B
MOV A, L
CPI 0AH
JNZ LABEL1
HLT
and memory location D000H to D009H. Write a program to add the data bytes of
corresponding locations and store the result at memory locations E000H to E009H.
(Hint: add the data of C000H with D000H and store the result at E000H, similarly
C001H with D001H and store the result at E001H and so on…)
Solution:
LXI H, C000H
LXI D, D000H
LXI B, E000H
LABEL1: LDAX D
ADD M
STAX D
INX H
INX D
INX B
MOV A, L
CPI 0AH
JNZ LABEL1
HLT
Comments
Post a Comment