Add Two Binary Numbers in Assembly Language


Write and run a program using 8086 assembly language that adds two binary numbers of 8 bits stored in two consecutive memory locations. Store the result in another memory location. You may assume that no overflow occurs. [Dec 2014, Set-3]

DATA SEGMENT
    NUM1 DB 00001010B ; 
    NUM2 DB 01010000B ;
    NUM3 DB ?
DATA ENDS

CODE SEGMENT
START:

    ASSUME CS:CODE, DS:DATA 
    MOV AX, DATA
    MOV DS, AX

    MOV AL, NUM1
    ADD AL, NUM2  
    MOV NUM3, AL
    
    MOV AX, 4C00H
    INT 21H    
CODE ENDS

END START