Professional Documents
Culture Documents
Mic PRC
Mic PRC
.model small
.data
Num1 db 10h
Num2 db 20h
Res db ?
.code
Mov ax,@data
Mov ds,ax
Mov al,num1
Mov bl,num2
Add al,bl
Mov res,al
Int o3
Ends
End
2. Addi on of two 16-bit nos.
.model small
.data
Num1 dw 10h
Num2 dw 20h
Res db ?
.code
Mov ax,@data
Mov ds,ax
Mov ax,num1
Mov bx,num2
Add ax,bx
Mov res,ax
Int o3
Ends
End
3. Subtrac on of two 8-bit nos.
.model small
.data
num1 db 22h
num2 db 11h
res db ?
.code
mov ax,@data
mov ds,ax
mov al,num1
mov bl,num2
sub al,bl
mov res,al
int 03
ends
end
.data
num1 dw 2222h
num2 dw 1111h
res dw ?
.code
mov ax,@data
mov ds,ax
mov ax,num1
mov bx,num2
sub ax,bx
mov res,ax
int 03
ends
end
.data
num1 db 22h
num2 db 11h
res dw ?
.code
mov ax,@data
mov ds,ax
mov al,num1
mov bl,num2
mul bl
mov res,ax
int 03
ends
end
.data
num1 dw 22h
num2 dw 11h
res dd ?
.code
mov ax,@data
mov ds,ax
mov ax,num1
mov bx,num2
mul bx
int 03
ends
end
.data
d1 dw 0428h
d2 db 0Ah
quo db ?
rem db ?
.code
mov ax,@data
mov ds,ax
mov ax,d1
mov bl,d2
div bl
mov quo,al
mov rem,ah
int 03
ends
end
.data
num1 db 11h,22h,33h,44h,55h
num2 db 5 dup(0)
.code
mov ax,@data
mov ds,ax
mov cx,05h
up:
mov al,[si]
mov [di],al
inc si
inc di
loop up
int 03
ends
end
.data
num1 dw 1111h,2222h,3333h,4444h,5555h
num2 dw 5 dup(0)
.code
mov ax,@data
mov ds,ax
mov cx,05h
up:
mov ax,[si]
mov [di],ax
inc si
inc si
inc di
inc di
loop up
int 03
ends
end
.data
n1 db 11h,22h,33h,44h,55h
sum db 00h
carry db 00h
.code
mov ax,@data
mov ds,ax
mov si,offset n1
mov cx,05h
up:
mov al,[si]
add sum,al
inc si
jnc exit
inc carry
exit:
loop up
int 03
ends
end
.data
n1 dw 1111h,2222h,3333h,4444h,5555h
sum dw 00h
carry db 00h
.code
mov ax,@data
mov ds,ax
mov si,offset n1
mov cx,05h
up:
mov ax,[si]
add sum,ax
inc si
inc si
jnc exit
inc carry
exit:
loop up
int 03
ends
end
.data
n1 db 11,22,33,44,55
sum db 00
carry db 00h
.code
mov ax,@data
mov ds,ax
mov si,offset n1
mov cx,05h
up:
mov al,[si]
add sum,al
daa
inc si
jnc exit
inc carry
exit:
loop up
int 03
ends
end
loop up
exit:
dec si
mov di, offset str2
mov cx, l
up1:
mov al, [si]
mov [di], al
dec si
inc di
loop up1
mov si, offset str1
mov di, offset str2
mov cx, l
up2:
mov al, [si]
cmp al, [di]
jne exit1
loop up2
mov ah, 09h
lea dx, msg1
int 21h
jmp exit2
exit1:
mov ah, 09h
lea dx, msg2
int 21h
exit2:
end
ends
l2 dw 0000h
msg1 db 'Strings are equal$'
msg2 db 'Strings are not equal$'
.code
mov ax, @data
mov ds, ax
mov si, offset str1
up:
mov al, [si]
cmp al, '$'
je exit
inc l1
inc si
loop up
exit:
mov si, offset str2
up1:
mov al, [si]
cmp al, '$'
je exit1
inc l2
inc si
loop up1
exit1:
mov ax, l1
cmp ax, l2
jne exit2
mov si, offset str1
mov di, offset str2
mov cx, l1
up2:
mov al, [si]
cmp al, [di]
jne exit2
inc si
inc di
loop up2
mov ah, 09h
lea dx, msg1
int 21h
jmp exit3
exit2:
mov ah, 09h
lea dx, msg2
int 21h
exit3:
end
ends
29) Find Reverse of a String
.model small
.data
str1 db 'micro$'
l dw 0000h
str2 db ?
.code
mov ax, @data
mov ds, ax
mov si, offset str1
up:
mov al, [si]
cmp al, '$'
je exit
inc l
inc si
loop up
exit:
dec si
mov di, offset str2
mov cx, l
up1:
mov al, [si]
mov [di], al
dec si
inc di
loop up1
int 3
ends end