Skip to main content

Program to add two 8 bit numbers

Statement: Add the contents of memory locations 2000H and 2001H and place the result in memory location 2002H.

Example:  

(2000H) = 13H
(2001H) = 15H
(2002H) = 13H + 15H =28H

Program:

LXI H, 2000H         ; HL points the location 2000H
MOV A, M              ; Load the contents of 2000H into accumulator
INX H                      ; HL points the location 2001H
ADD M                   ; Add second operand to the contents of accumulator
INX H                      ; HL points the location 2002H
MOV M, A              ; Store result at 2002H
HLT                         ; Terminate program execution

          

Comments