MIC Report
MIC Report
REPORT ON MICROPROJECT
Write an ALP to Program to sort the 16-bit array
elements in ascending order
----------------------------------------------------------------------------------------------------------------------------
Roll No : 16 , 17 , 18
Certificate
This is to certify that Ms./Mr Rutu Bauva , Muskan Kateja , Aniket Nikam Roll No. 16,
Title of Project : Write an ALP to Program to sort the 16-bit array elements in ascending order
Finalization of project
1 1/02/2024 15/02/2024 All
Title and Scope
Design procedure
2 15/02/2024 22/02/2024 All
(algorithm)
Converting algorithms to
6 14/03/2024 21/03/2024 All
ALP (coding)
Testing and error
7 21/03/2024 28/03/2024 All
correction
Demonstration of project
8 and final submission 28/03/2024 04/04/2024 All
Making of report
5.0 Resources Required
Teachers Signature
Mrs.Alka Prayagkar
Annexure – II A
Title of Project : Write an ALP to Program to sort the 16-bit array elements in ascending order
1.0 Rationale
Importance :
This project shows how the problem is solved using step wise procedures from defining the
problem to writing the ALP. It also tells about the processor 8086 and its functions. It also
teaches to work with unity and building good leadership qualities.
The provided assembly code segment offers a comprehensive glimpse into the intricate world of
low-level programming, delving into the realms of data manipulation, algorithm implementation, and
program control flow. Through the judicious use of assembly language constructs and directives, the
code exemplifies a practical approach to sorting data elements within an array, shedding light on
fundamental programming paradigms prevalent in the realm of computer science and software
engineering.
The initiation of the code segment within the DATA segment marks the inception of the data
manipulation process. Here, the declaration and initialization of the "ARRAY" array with
hexadecimal values epitomize the foundational step towards data organization and manipulation. The
accompanying single-byte variable "NUM" provides crucial metadata regarding the size of the array,
enabling dynamic and efficient handling of data structures.
Segment Definition and Assumption:
Incorporating the CODE segment within the program framework is a strategic move that underscores
the significance of structured programming practices. The ASSUME directive plays a pivotal role in
establishing logical associations between the code segment (CS) and the data segment (DS),
facilitating seamless data access and manipulation within the program's execution context. This
adherence to segment-based organization underscores the code's clarity and modularity, essential
attributes for scalable and maintainable software systems.
Central to the code's functionality is the adept utilization of data movement instructions and index
setup mechanisms. The MOV instruction, coupled with the LEA directive, orchestrates the seamless
transfer of data segment addresses and array indices, laying the groundwork for subsequent data
manipulation operations. The initialization of the source index register (SI) with the effective address
of the "ARRAY" array sets the stage for efficient array traversal and manipulation, underscoring the
code's optimization and efficiency.
At the heart of the code lies the meticulous implementation of the bubble sort algorithm, a
fundamental sorting technique revered for its simplicity and efficacy. The algorithm's iterative nature,
characterized by repeated comparisons and element swaps, is elegantly captured through a series of
conditional branching instructions such as CMP, JC, and JNZ. These instructions, coupled with data
exchange operations facilitated by XCHG, orchestrate the intricate dance of data manipulation
necessary for sorting array elements in ascending order.
The iterative nature of the sorting algorithm necessitates seamless data exchange and loop iteration
mechanisms. Here, instructions such as INC and DEC play a pivotal role in incrementing and
decrementing loop counters, enabling precise control over the iteration process. The XCHG
instruction, with its ability to exchange data between memory locations, emerges as a linchpin for
facilitating element swaps within the array, thereby advancing the sorting process with efficiency and
precision.
As the sorting process culminates, the program gracefully concludes with the invocation of the INT
21H instruction, symbolizing the culmination of execution. This poignant finale underscores the
code's adherence to structured programming principles and encapsulates the essence of assembly
language programming—a disciplined pursuit of computational efficiency and elegance.
Directives used:
DATA SEGMENT:
ENDS:
CODE SEGMENT:
END:
ASSUME:
● Specifies the logical segment associations for code and data segments.
● Used to inform the assembler about the segment register assumptions.
● Example: ASSUME CS:CODE, DS:DATA
Instructions Used:
MOV (Move):
● Computes the effective address of the specified memory operand and loads it into a register.
● Used to obtain the address of a memory location for indirect addressing.
● Example: LEA SI, ARRAY (loads the effective address of the ARRAY into SI register)
DEC (Decrement):
INC (Increment):
CMP (Compare):
JC (Jump if Carry):
XCHG (Exchange):
INT (Interrupt):
AX (Accumulator):
BX (Base Register):
● Used to hold a copy of the array element during comparison and swapping.
● Stores the value of the array element pointed to by SI (MOV BX, [SI]).
● Used for data manipulation and temporary storage.
These registers are essential for data manipulation, address calculation, and loop control in the
program. They facilitate efficient memory access and enable the implementation of the bubble sort
algorithm to sort the array elements in ascending order.
5.0 Actual Methodology Followed
Algorithm:
Step 1: Start
Step 2: Initialize the data segment with the array
Step 3: Load BL with 05H
Step 4: Initialize SI with the starting address of the array and CX register with 04H
Step 5: Load AX with the content of [SI]
Step 6: Compare AX with the content of [SI + 2]
Step 7: If AX is less than the content of [SI + 2], jump to DOWN, else continue to the next step
Step 8: Exchange the content of [SI] and [SI + 2] (swap values)
Step 9: DOWN: Add 2 to SI to point to the next element in the array
Step 10: Loop back to Step 5 until all elements are compared and possibly swapped
Step 11: Decrement BL
Step 12: If BL is not equal to 0, jump to STEP1, else continue to the next step
Step 13: Set AH to 4CH
Step 14: Call interrupt 21H to terminate the program
Step 15: Stop
FLOWCHART:
CODING:
DATA SEGMENT
ARRAY DW 5000H,1240H,1130H,2020H,4510H
NUM DB 05H
ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV DX,DATA
MOV DS,DX
MOV BL,05H
STEP1: LEA SI, ARRAY
MOV CX, 04H
STEP: MOV AX, [SI]
CMP AX, [SI+2]
JC DOWN
XCHG AX, [SI+2]
XCHG AX,[SI]
DOWN : ADD SI , 02H
LOOP STEP
DEC BL
JNZ STEP1
MOV AH, 4CH
INT 21H
CODE ENDS
END START
TeacherSignature
Mrs Alka Prayagkar
Annexure - III
(The marks may be allowed to the characteristics of the Micro Project by considering the suggested rubrics)
Poor Average Good Excellent
S. Characteristic to
No. be assessed ( Marks 1 - 3 ) ( Marks 4 - 5 ) ( Marks 6 - 8 ) ( Marks 9- 10 )
Relevance to the Relate to very Related to Take care of at-least Take care of more than
1
course few LOs some LOs one CO one CO
Not more than At-least 5 relevant
About 10 relevant
information two sources sources, at least 2 At –least 7 relevant
2 sources, most latest
collection very old latest sources, most latest
reference
Completion of
Completed Completed 50 Completed 60 to Completed more than
3 the Target as per
less than 50% to 60% 80% 80 %
project proposal
Sufficient and
Data neither appropriate Sufficient and
organized nor Enough data
Analysis of Data enough data appropriate enough
presented well collected and
4 and generated but not data generated
sufficient and
representation organized and not which is organized
presenting data.
presented well. and but not used.
Title of the Micro-Project:Write an ALP to Program to sort the 16-bit array elements in ascending order
Roll No.16,17,18
(A)Process & product Assessment ( Convert above total marks out of 6 marks)
1 Relevance to the course
2 Information Collection
Completion of the Target as
3
per project proposal
Analysis of Data and
4
representation
5 Quality of Prototype/Model
6 Report Preparation
(B)Individual Presentation/ Viva
7 Presentation
8 Viva
GROUP MARKS SHEET
(A)Process
and Product (B)Individual Total
Roll Name of the students Marks
assessment Presentation/
No (6 marks) Viva(4 marks) (10 marks)
16 Rutu Bauva
17 Muskan Kateja
18 Aniket Nikam
Practical outcomes:
Signature: ___________________