Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views34 pages

Fahad Lab5

The document contains multiple assembly language programs that prompt the user to enter characters or numbers, then perform comparisons to determine equality, greater or lesser values, and display corresponding messages. Each program is structured similarly, utilizing DOS interrupts for input and output operations. The programs demonstrate basic control flow and arithmetic operations in assembly language.

Uploaded by

Mine Gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views34 pages

Fahad Lab5

The document contains multiple assembly language programs that prompt the user to enter characters or numbers, then perform comparisons to determine equality, greater or lesser values, and display corresponding messages. Each program is structured similarly, utilizing DOS interrupts for input and output operations. The programs demonstrate basic control flow and arithmetic operations in assembly language.

Uploaded by

Mine Gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Fahad Hussain

BSCS IV
Section E
023-23-0044
CA & AL
Instructor: Sir Riaz

1.

.model small
.stack 100h
.data
str1 db 'Enter A charcter:$'
str db 10,13,'The Entered character is A:$'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

cmp al,65

JE compare
jmp ex
compare:

mov ah,09
lea dx,str
int 21h

ex:
mov ah,4ch
int 21h
main endp
end main
2.
.model small
.stack 100h
.data
str1 db 'Enter A charcter:$'
str db 10,13,'The Entered character is not A:$'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

cmp al,65

JNE compare
jmp ex
compare:

mov ah,09
lea dx,str
int 21h

ex:
mov ah,4ch
int 21h
main endp
end main
3.
.model small
.stack 100h
.data
str1 db 'Enter A charcter:$'
str db 10,13,'The Entered character is A:$'
str2 db 10,13,'The Entered character is Not A:$'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

cmp al,65

JE compare
JNE compar

compare:
mov ah,09
lea dx,str
int 21h
jmp ex

compar:

mov ah,09
lea dx,str2
int 21h

ex:
mov ah,4ch
int 21h
main endp
end main
4.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str db 10,13,'The Absolute diffrence is:$'
.code

main proc

mov ax, @data


mov ds,ax
mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48
mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h

mov cl,al
sub cl,48

mov ah,09
lea dx,str
int 21h

cmp bl,cl

JG grtr
JL ls

grtr:

sub bl,cl
jmp ex

ls:

sub cl,bl
mov bl,cl

ex:
add bl,48

mov ah,02
mov dl,bl
int 21h

mov ah,4ch
int 21h
main endp
end main
5.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str db ' The first number is greater$'
str0 db ' The second number is greater$'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48

mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h
mov cl,al
sub cl,48

cmp bl,cl

JG grtr
JL ls

grtr:

MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21H

add bl,48

mov ah,02
mov dl,bl
int 21h

mov ah,09
lea dx,str
int 21h
jmp ex

ls:
MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21h

add cl,48

mov ah,02
mov dl,cl
int 21h

mov ah,09
lea dx,str0
int 21h

ex:

mov ah,4ch
int 21h
main endp
end main

6.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str db ' The first number is smaller$'
str0 db ' The second number is smaller$'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48

mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h

mov cl,al
sub cl,48

cmp bl,cl

JG grtr
JL ls

grtr:

MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21h

add cl,48
mov ah,02
mov dl,cl
int 21h

mov ah,09
lea dx,str0
int 21h

jmp ex
ls:

MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21H

add bl,48

mov ah,02
mov dl,bl
int 21h

mov ah,09
lea dx,str
int 21h

ex:
mov ah,4ch
int 21h
main endp
end main
7.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str db ' The first number is greater$'
str0 db ' The second number is greater$'
str4 db ' Both are Equal.$'
.code

main proc

mov ax, @data


mov ds,ax
mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48

mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h

mov cl,al
sub cl,48

cmp bl,cl
JG grtr
JL ls
JE equal

grtr:

MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21H

add bl,48

mov ah,02
mov dl,bl
int 21h

mov ah,09
lea dx,str
int 21h

jmp ex
ls:

MOV AH,02
MOV DL,13
INT 21H

MOV AH,02
MOV DL,10
INT 21h

add cl,48

mov ah,02
mov dl,cl
int 21h

mov ah,09
lea dx,str0
int 21h

jmp exe

equal:
MOV AH,02
MOV DL,13
INT 21H
MOV AH,02
MOV DL,10
INT 21h

mov ah,09
lea dx,str4
int 21h

ex:
exe:

mov ah,4ch
int 21h
main endp
end main
8.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str3 db 10,13,'Enter Third number:$'
str db 10,13,'The greatest number is: $'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48

mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h
mov cl,al
sub cl,48

cmp bl,cl

JG grtr
mov bl,cl

grtr:

mov ah,09
lea dx,str3
int 21h

mov ah,1
int 21h
sub al,48

cmp al,bl

JG grt

JMP print

grt:

mov bl,al
print:

mov ah,09
lea dx,str
int 21h

add bl,48
mov ah,02
mov dl,bl
int 21h

mov ah,4ch
int 21h
main endp
end main
9.
.model small
.stack 100h
.data
str1 db 'Enter first number:$'
str2 db 10,13,'Enter second number:$'
str3 db 10,13,'Enter Third number:$'
str db 10,13,'The smallest number is: $'
.code

main proc

mov ax, @data


mov ds,ax

mov ah,09
lea dx,str1
int 21h

mov ah,1
int 21h

mov bl,al
sub bl,48

mov ah,09
lea dx,str2
int 21h

mov ah,1
int 21h
mov cl,al
sub cl,48

cmp bl,cl

JL lees
mov bl,cl

lees:

mov ah,09
lea dx,str3
int 21h

mov ah,1
int 21h
sub al,48

cmp al,bl

JL less

JMP print

less:
mov bl,al

print:

mov ah,09
lea dx,str
int 21h

add bl,48
mov ah,02
mov dl,bl
int 21h

mov ah,4ch
int 21h
main endp
end main

You might also like