Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

COAA – Lab Assignment 5

Name: Shubham Waghule


Roll No- 94
GR No : 12120127
Div: CS - D
Batch : B3

Aim: Write an assembly language program to accept 5 numbers from user and arrange numbers
in ascending order, descending order and display them.

Memory Models in 8086 –


The memory models in 8086 specify the size of memory assigned to the different parts of a program.
The. MODEL directive is used at the start to specify which model is going to be used. There is total 6
memory models:
1. TINY – In this model both code and data occupy a single physical segment of memory. On linking
a file with this model, it automatically generates a com file which is smaller than exe file.
2. SMALL – In this model, the code and data occupy individual physical segments from memory.
3. COMPACT – In this model the code occupies a single physical segment while the contents of
data can be given their own separate segments.
4. MEDIUM – In this model the data occupies a single segment.
5. LARGE – In this model, both code and data are stored in different physical statements.
6. HUGE – It is similar to LARGE with the only difference that a data array may have a size that
exceeds one physical segment.

Instructions used –
1. ADD: The contents of the register or memory are added to the contents of the accumulator and the
result is stored in the accumulator.
2. SUB: The contents of the register or the memory are subtracted from the contents of the
accumulator, and the result is stored in the accumulator.
3. JLE: Used to jump if less than/equal/if not greater than instruction satisfies
4. CMP: Used to compare 2 provided byte/word.

Commands used –
1. 09h: Displays the string until “$” is reached.
2. Int 21h: Interrupt used to exit the program.
3. .data: This Command is used only when we want to store data in a Data Segment, basically, it is
the memory access of the Data Segment. Whatever we want to print must be written here.Also, the
variables are declared here.
4. 10, 13: They work as Escape Sequence Character
5. $: It states the end of a Statement
6. Db (Define Byte): It acts as an Assembler Directive
7. . code: Full Logical Program is written here
8. 01h: Read single character from standard input
• Echoes the input character
• Waits for input if the buffer is empty
• Checks for Ctrl-Break (^C)
• Acts on control codes such as horizontal Tab
9. 02h: Display single character from standard output

Display character in D2 at current cursor position. The tab, carriage return and line feed characters act
normally and the operation automatically advances the cursor.
10. Tasm – Used for Compilation
11. tlink– Perform linking operation

Screenshots of Source Code and Output:


Source Code –
1. Ascending order:
Output:

2. Descending Order:
Output:

You might also like