; Program to add two 32 bit number
.model small
.stack 100
.data
num1 dd 12345678h
num2 dd 12345678h
res dw ?
.code
mov ax , @data ; initializing data segment
mov dx , ax
mov ax , word ptr num1 ; It points the first four digit of num1 i.e 5678
mov bx , word ptr num1+2 ; num + 2 it adds to the lsb address so it goes to point 1234
mov cx , word ptr num2 ; It points the first four digit of num1 i.e 5678
mov dx , word ptr num2+2 ; num + 2 it adds to the lsb address so it goes to point 1234
add ax , cx
adc bx , dx ; add with carry
mov word ptr res ,ax ; Moving lsb part
mov word ptr res+2 ,bx ; moving msb part
mov ah , 4ch ; Service routine for exit
int 21h
end
.model small
.stack 100
.data
num1 dd 12345678h
num2 dd 12345678h
res dw ?
.code
mov ax , @data ; initializing data segment
mov dx , ax
mov ax , word ptr num1 ; It points the first four digit of num1 i.e 5678
mov bx , word ptr num1+2 ; num + 2 it adds to the lsb address so it goes to point 1234
mov cx , word ptr num2 ; It points the first four digit of num1 i.e 5678
mov dx , word ptr num2+2 ; num + 2 it adds to the lsb address so it goes to point 1234
add ax , cx
adc bx , dx ; add with carry
mov word ptr res ,ax ; Moving lsb part
mov word ptr res+2 ,bx ; moving msb part
mov ah , 4ch ; Service routine for exit
int 21h
end
1 Comments:
Click here for CommentsWhat is the output?