Statement: Add the contents of memory locations 2000H and 2001H and place the result in the memory locations 2002H and 2003H.
Example:
(2000H) = C3H
(2001H) = 29H
Result = C3H + A9H = 016CH
(2002H) = 6CH
(2003H) = 01H
Program:
LXI H, 2000H ; HL points to location 2000H
MOV A, M ; Move the contents of 2000H into accumulator
INX H ; HL points to location 2001H
ADD M ; Add the contents of 2001H with the contents of accumulator
INX H ; HL points to location 2002H
MOV M, A ; Store the lower byte of result at 2002H
MVI A, 00H ; Initialize higher byte result with 00H
ADC A ; Add carry in the higher byte result
INX H ; HL points to location 2003H
MOV M, A ; Store the higher byte of result at 2003H
HLT ; Terminate program execution
Comments
Post a Comment