Professional Documents
Culture Documents
Cod PBL Report
Cod PBL Report
(DEEMED TO BE UNIVERSITY)
Project Report
For the fulfilment of Project Based Learning
At
COLLEGE OF ENGINEERING, PUNE – 43
1
TOPIC
Submitted By:
2
ACKNOWLEDGEMENT
At the outset of this project-based learning we want to extend my
whole hearted gratitude to all the faculty members without the help of
whom this project could’ t have been possible. We want to extend our
heartily regard to Prof. Shruti mam, under the guidance of whom we
have completed this report and which also helped us in doing a lot of
research and also we have learned many new things. We would also
like to thank other faculty members for their whole hearted
cooperation and valuable guidance. We would also like to thank our
friends for their valuable suggestions and guidance to make this report
a successful one.
3
CONTENTS
1. Introduction 5
5. CODE OUTPUT 10
7. Features 12
9. Conclusion 14
4
INTRODUCTION
Each personal computer has a microprocessor that manages the
computer's arithmetical, logical, and control activities.
Each family of processors has its own set of instructions for handling
various operations such as getting input from keyboard, displaying
information on screen, and performing various other jobs. These set of
instructions are called 'machine language instructions'.
5
WHAT IS ASSEMBLY LANGUAGE?
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.
6
WHAT IS BINARY SEARCH?
Binary Search is a searching algorithm used in a sorted array
by repeatedly dividing the search interval in half. The idea of binary
search is to use the information that the array is sorted and reduce
the time complexity to O (Log n).
7
Binary Search using Assembly Language:
CODE:
.model small
.data
arr dw
0000h,1111h,2222h,3333h,4444h,5555h,6666h,7777h,8888h
len dw ($-arr)/2 ;len=(last_index - first_index)/2
key equ 4444h ;key to Search
msg1 db "key is found at ";If found then the message executes
res db " position", 0, "$";determines the position of the element
where it is found
msg2 db 'key not found!!!!!!!!!!!!!. $';If not found then the message
executes
.code
start:
mov ax,@data;Initializing the data segment
mov ds,ax ;it is ds, not dx
mov bx,00 ;low
mov dx,len ;high
mov cx,key ;key
again:
cmp bx,dx ;while(low<high)
ja fail ;if(low<high) then its not found case
mov ax,bx
add ax,dx;low+high
shr ax,1 ;(low+high)/2
mov si,ax ;have an index
add si,si ;for 16 bit data
cmp cx,arr[si] ;if(key==array[mid])
jae big ;search in the RIGHT part of the array
dec ax ;dec high(search in the LEFT part of the array)
mov dx,ax ;make this as new high
jmp again ;continue searching
big:
je success ;found case
inc ax ;inc low
mov bx,ax ;make this as new low
8
jmp again ;continue searching
success:
add al,01
add al,30h ;add 30h (or '0') to the position(AL)
;(just to convert to ASCII)
lea si,res
mov [si],al ;move the position to our variable
lea dx,msg1 ;load the Effective Address to DX
jmp disp ;display the result
fail:
lea dx,msg2 ;load the msg2 and display it
disp:
mov ah,09h ;to terminate
int 21h;Using DOS interrupt 21h
mov ah,4ch ;to terminate
int 21h;Using DOS interrupt 21h
end
9
CODE OUTPUT:
10
BENEFITS OF LEARNING 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.
11
FEATURES
The features of the assembly language are mentioned below:
12
ADVANTAGES
4. It is mainly hardware-oriented.
DISADVANTAGES
1. It takes a lot of time and effort to write the code for the same.
computer architectures.
13
CONCLUSION
Assembly language is very important for understanding the computer
processor as well, then assembly language is the one that solves the
continue.
14