You are on page 1of 14

CERTIFICATE

It is certified that Mr./Miss ____________________________________


S.O./D.O __________________ Roll No ________ Of __________
Course ___________________Batch ____________ is a bonafide student of this
College. He/She has successfully performed and completed ___________________
Practical for the year _____________ according to the syllabus prescribed by the
education board

Signature of Teacher Signature of head of college

Dated:_______________ Dated:_______________
Assembly Introduction

Assembly Language is a low-level programming language. It helps in understanding the


programming language to machine code. In computers, there is an assembler that helps
in converting the assembly code into machine code executable. Assembly language is
designed to understand the instruction and provide it to machine language for further
processing. It mainly depends on the architecture of the system, whether it is the
operating system or computer architecture.

Why should you learn Assembly Language?

The learning of assembly language is still important for programmers. It helps in taking
complete control over the system and its resources. By learning assembly language, the
programmer can write the code to access registers and retrieve the memory address of
pointers and values. It mainly helps in speed optimization that increases efficiency and
performance.
Assembly Language helps in contacting the hardware directly. This language is mainly
based on computer architecture, and it recognizes a certain type of processor and its
different for different CPUs. Assembly language refers to transparency compared to
other high-level languages. It has a small number of operations, but it is helpful in
understanding the algorithms and other flow of controls. It makes the code less complex
and easy debugging as well.
Features:

 The features of the assembly language are mentioned below:


 It can use mnemonic than numeric operation code, and it also provides the
information of any error in the code.
 This language helps in specifying the symbolic operand that means it does not
need to specify the machine address of that operand. It can be represented in
the form of a symbol.
 The data can be declared by using decimal notation.
Assemblers
The assemblers are used to translate the assembly language into machine language.
Program to print a single character on screen

Dosseg
.model small
.stack 100h
.data
.code
Main Proc
Mov dl,'A'
Mov ah, 2
INT 21h
Mov ah, 4ch
INT 21h
Main endp
End Main

Program to print your name on screen with characters


Dosseg
.model small
.stack 100h
.data
.code
main proc
mov dl, 'A'
mov ah,2
INT 21h
mov dl, 'L'
mov ah,2
INT 21h
mov dl, 'I'
mov ah,2
INT 21h
mov ah, 4ch
INT 21h
main endp
end main

Program to take input character and print on screen

Dosseg
.model small
.stack 100h
.data
.code
main proc
mov ah,1
INT 21h
mov dl, al
mov ah,2
INT 21h
mov ah,4ch
INT 21h
main endp
end main
Program to add two numbers
.model small
.stack 100h
.data
.code
main proc
mov bl,2
mov dl,1
add dl,bl
add dl,48
mov ah,2
INT 21h
mov ah,4ch
INT 21h
main endp
end main

Program to print A to Z in small and capital letters using loop

Dosseg
.model small
.stack 100h
.data
.code
main proc
mov cx, 26
mov ah, 2
mov dl, 65
L1:
int 21h
inc dl
loop L1
mov dl, 10
mov ah,2
INT 21h
mov dl, 13
mov ah,2
INT 21h
mov cx, 26
mov dl, 97
mov ah, 2
L2:
int 21h
inc dl
loop L2
mov ah,4ch
INT 21h
main endp
end main

Program to print helloworld string on screen


Dosseg
.model small
.stack 100h
.data
S1 db "Helloworld$"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,s1
mov ah,9
INT 21h
mov ah,4ch
INT 21h
main endp
end main

Program to print two different strings in two different lines

Dosseg
.model small
.stack 100h
.data
String_1 db 'ali$'
String_2 db 'soomro$'
.code
Main proc
Mov ax, @data
Mov ds, ax
Lea dx, string_1
Mov ah, 9
Int 21h
Mov ah, 2
Mov dl, 10
Int 21h
Mov dl, 13
Int 21h
Lea dx, string_2
Mov ah, 9
Int 21h
Mov ah, 4ch
Int 21h
Main endp
End main

Program to input a capital letter from user and convert it into small letter (uppercase to
lowercase)
dosseg
.model small
.stack 100h
.data
.code
main proc
mov ah, 1
int 21h
mov dl, al
add dl,32
mov ah, 2
int 21h
mov ah,4ch
int 21h
main endp
end main

Program to input a small letter from user and convert it into capital letter (lowercase to
uppercase)
dosseg
.model small
.stack 100h
.data
.code
main proc
mov ah, 1
int 21h
mov dl, al
sub dl,32
mov ah, 2
int 21h
mov ah,4ch
int 21h
main endp
end main

Get an integer from user and display whether the number is even or odd.
; get an integer display the even or odd.
dosseg
.model small
.stack 100h
.data
ev db 'Even$'
od db 'Odd$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,1
int 21h
mov bl,2
div bl
cmp ah,0
je IsEven
mov dx,10
mov ah,2
int 21h
mov dx,13
mov ah,2
int 21h
mov dx,offset od
mov ah,9
int 21h
mov ah,4ch
int 21h
IsEven:
mov dx,10
mov ah,2
int 21h
mov dx,13
mov ah,2
int 21h
mov dx,offset ev
mov ah,9
int 21h
mov ah,4ch
int 21h
main endp
end main

Display the sum of all odd numbers between 1 and 100


dosseg
.model small
.stack 100h
.data
.code
main proc
mov ax,@data
mov ds,ax
mov cx,1
mov ax,0
l1:
add ax,cx
add cl,2
cmp cl,100
jl l1
mov dx,0
mov bx,10
mov cx,0
l2:
div bx
push dx
mov dx,0
mov ah,0
inc cx
cmp ax,0
jne l2
mov ah,02h
l3:
pop dx
add dx,48
int 21h
loop l3
mov ah,4ch
int 21h
main endp
end main

Display the sum of all even numbers between 1 and 100


dosseg
.model small
.stack 100h
.data
.code
main proc
mov ax,@data
mov ds,ax
mov cx,0
mov ax,0
l1:
add ax,cx
add cl,2
cmp cl,100
jle l1
mov dx,0
mov bx,10
mov cx,0
l2:
div bx
push dx
mov dx,0
mov ah,0
inc cx
cmp ax,0
jne l2
mov ah,02h
l3:
pop dx
add dx,48
int 21h
loop l3
mov ah,4ch
int 21h
main endp
end main

You might also like