Advance processor programs
by : - Hardik H. Kothadia C.E. R.K. UNIVERSITY
CONT...... 8 00 00 4 99 53
____________________________________________________________________________
CONT...... 8 00 00 4 99 53
____________________________________________________________________________
1. Write a program to add two 16-bit number.
data segment
n1 dw 1234h
n2 dw 0321h
result dw 01 dup(?)
data ends
code segment
assume cs:code ds:data
start:mov ax,data
mov ds,ax
mov ax,n1
mov bx,n2
add ax,bx
mov di,offset result
mov [di],ax
mov ah,4ch
int 21h
code ends
end start
_____________________________________________________
2. Write a program to add two 32-bit number.
data segment
n1 dw 1234h
n2 dw 5678h
n3 dw 8765h
n4 dw 4321h
result dw 01 dup(?)
data ends
code segment
assume cs:code ds:data
start:mov ax,data
mov ds,ax
mov ax,n2
mov bx,n4
add ax,bx
mov di,offset result
mov [di],ax
mov ax,n1
mov bx,n3
acd ax,bx
mov di,[offset result + 2]
mov [di],ax
mov ah,4ch
int 21h
code ends
end start
__________________________________________________________________
3. Write a program to subtract two 16-bit number.
data segment
n1 dw 1234h
n2 dw 0321h
result dw 01 dup(?)
data ends
code segment
assume cs:code ds:data
start:mov ax,data
mov ds,ax
mov ax,n1
mov bx,n2
sub ax,bx
mov di,offset result
mov [di],ax
mov ah,4ch
int 21h
code ends
end start
___________________________________________________________
4. Write a program to subtract two 32-bit number.
data segment
n1 dw 1234h
n2 dw 5678h
n3 dw 8765h
n4 dw 4321h
result dw 01 dup(?)
data ends
code segment
assume cs:code ds:data
start:mov ax,data
mov ds,ax
mov ax,n2
mov bx,n4
sub ax,bx
mov di,offset result
mov [di],ax
mov ax,n1
mov bx,n3
sbb ax,bx
mov di,[offset result + 2]
mov [di],ax
mov ah,4ch
int 21h
code ends
end start
____________________________________________________________