Amrutvahini Polytechnic Sangamner
Computer Technology Department
List of Practical’s for Summer 2024
Subject : MIC (22215)
1) Write ALP to add two given 8 bit and 16 bit numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db 2h Num1 dw 2h
Num2 db 4h Num2 dw 4h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
add al,Num2 add ax,Num2
mov Result,ax mov Result,ax
ends ends
end end
2) Write ALP to subtract two given 8 bit and 16 bit numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db 2h Num1 dw 0022h
Num2 db 4h Num2 dw 0044h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
sub al,Num2 sub ax,Num2
mov Result,ax mov Result,ax
ends ends
end end
3) Write ALP to multiply two given 8 bit and 16 bit unsigned numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db 2h Num1 dw 0022h
Num2 db 4h Num2 dw 0044h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
mov bl,Num2 mov bx,Num2
mul al mul ax
mov Result,ax mov Result,ax
ends ends
end end
4) Write ALP to multiply two given 8 bit and 16 bit signed numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db -2h Num1 dw -0022h
Num2 db -4h Num2 dw -0044h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
mov bl,Num2 mov bx,Num2
imul al imul ax
mov Result,ax mov Result,ax
ends ends
end end
5) Write ALP to perform block transfer of data.
.model small
.data
Block1 db 10dup(20h)
Block2 db 10dup(30h)
.code
mov ax,@data
mov ds,ax
mov si,Block1 ; Initiallize memory pointer For Source block
mov di,Block2 ;Initiallize memory pointer For destination block
Mov cx,0A ;Initiallize Counter
Up:
mov AH,[SI] ; Read number From Source Array
mov [DI],AX ; Write Number To Destination Array
ADD SI,2
ADD DI,2
Loop Up
Ends
end
6) Write ALP to divide two given 8 bit and 16 bit unsigned numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db 2h Num1 dw 0022h
Num2 db 4h Num2 dw 0044h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
mov bl,Num2 mov bx,Num2
div al div ax
mov Result,ax mov Result,ax
ends ends
end end
7) Write ALP to divide two given 8 bit and 16 bit signed numbers.
8 Bit: 16 Bit:
.model small .model small
.data .data
Num1 db -2h Num1 dw -0022h
Num2 db -4h Num2 dw -0044h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov ax,Num1
mov bl,Num2 mov bx,Num2
idiv al idiv ax
mov Result,ax mov Result,ax
ends ends
end end
8) Write ALP to add two BCD numbers.
9) Write ALP to Sub two BCD Numbers
ADDITION: SUBTRACTION:
.model small .model small
.data .data
Num1 db 2h Num1 db 2h
Num2 db 4h Num2 db 4h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov al,Num1
add al,Num2 sub al,Num2
DAA DAS
mov Result,ax mov Result,ax
ends ends
end end
10) Write A Program To Multiply two BCD Numbers:
11) Write A Program To Divide two BCD Numbers:
MULTIPLICATION: DIVISION:
.model small .model small
.data .data
Num1 db 2h Num1 db 2h
Num2 db 4h Num2 db 4h
Result dw ? Result dw ?
.code .code
mov ax,@data mov ax,@data
mov ds,ax mov ds,ax
mov al,Num1 mov al,Num1
mov bl,Num2 mov bl,Num2
mul al div al
DAM DAD
mov Result,ax mov Result,ax
ends ends
end end
12) Write ALP to find smallest number.
.model small
.data
Arr db 12h,31h,02h,45h,65h
Small db 0
.code
Mov ax,@data
Mov ds,ax
Mov cx,5
Mov SI,offset Arr
Mov al,[SI]
Dec cx
Up:
Inc SI
Cmp al,[SI]
Jc next
Mov al,[SI]
Next:
Loop Up
Mov Small,al
Ends
End
13) Write ALP to find smallest number.
.model small
.data
Arr db 12h,31h,02h,45h,65h
Large db 0
.code
Mov ax,@data
Mov ds,ax
Mov cx,5
Mov SI,offset Arr
Mov al,[SI]
Dec cx
Up:
Inc SI
Cmp al,[SI]
Jnc next
Mov al,[SI]
Next:
Loop Up
Mov Large,al
Ends
End
14) Write ALP to arrange numbers from array in the ascending order.
.model small
.data
arr db 12h,11h,21h,09h,19h
.code
mov ax,@data
mov ds,ax
mov bx,5
a:
mov SI,offset arr
mov cx,4
b:
mov ax,[SI]
cmp ax[SI+2]
jc c
xchg ax,[SI+2]
xchg ax,[SI]
c:
add SI,2
loop b
dec bx
jnz a
ends
end
15) Write ALP to arrange numbers from array in the descending order.
.model small
.data
arr db 12h,11h,21h,09h,19h
.code
mov ax,@data
mov ds,ax
mov bx,5
a:
mov SI,offset arr
mov cx,4
b:
mov ax,[SI]
cmp ax[SI+2]
jnc c
xchg ax,[SI+2]
xchg ax,[SI]
c:
add SI,2
loop b
dec bx
jnz a
ends
end
16) Write ALP to count number of 1's in the given number.
17) Write ALP to count number of 0's in the given number.
.model small
.data
Number dw 0008h
Zero_count db 00h
One_count db 00h
.code
Mov ax,@data
Mov ds ,ax
Mov cx,16
Mov ax,Number
Next:
ROR AX,1
Jc Down
Inc Zero_count
Jmp Down1
Down:
Inc One_count
Down1:
Loop Next
Ends
End
18) Write ALP to find positive number.
19) Write ALP to find negative number.
.model small
.data
Num db 89h
Pos db 0
Neg db 0
.code
Mov ax,@data
Mov ds ,ax
Mov al,Num
ROL al,1
Jnc Dn
ROR al,1
Mov neg,al
Jmp exit
Dn:
ROR al,1
Mov Pos,al
Exit:
Ends
End
20) Write a Program To Find Length of String:
.model small
.data
Str db ‘computer$’
Len db 0
.code
Mov ax,@data
Mov ds,ax
Mov SI,offset str
Next:
Mov al,[SI]
Cmp al,$
Je exit
Inc SI
Inc len
Jmp next
Exit:
Ends
End
21) Write ALP to Display reverse of given String
22) Write ALP For Count of Even And Odd Numbers In Given Array