Code:
; Program to add 2 16 bit number using memory
.MODEL SMALL
.STACK 100
.DATA
NUM1 DW 8A64H ; First Number
NUM2 DW 5F98H ; Second Number
RES DW ? ; Result Variable
.CODE
MOV AX , @DATA ; Initialization of data segment
MOV DS,AX
MOV AX , NUM1 ; Load 1st number in AX
ADD AX , NUM2 ; Add 2nd number with 1st number in AX
MOV RES , AX ; Store result from AX to RES memory
MOV DX , AX ; Storing data from AX to DX
MOV AH , 2 ; Service routine to print contain of DX
INT 21H
MOV AH , 4CH ; Service routine to exit
INT 21H
END
Ouput:
; Program to add 2 16 bit number using memory
.MODEL SMALL
.STACK 100
.DATA
NUM1 DW 8A64H ; First Number
NUM2 DW 5F98H ; Second Number
RES DW ? ; Result Variable
.CODE
MOV AX , @DATA ; Initialization of data segment
MOV DS,AX
MOV AX , NUM1 ; Load 1st number in AX
ADD AX , NUM2 ; Add 2nd number with 1st number in AX
MOV RES , AX ; Store result from AX to RES memory
MOV DX , AX ; Storing data from AX to DX
MOV AH , 2 ; Service routine to print contain of DX
INT 21H
MOV AH , 4CH ; Service routine to exit
INT 21H
END