You are on page 1of 36

Micro-Project Proposal Micro Project for information

about

Assembly Language Programing


1.0 Aims of the Micro-Project

a) To create various types of report and get more knowledge about how to make report. We have chosen this
micro project to get knowledge about detect the amount of alcohol.

2.0 Course Outcomes Addressed

1. The goal of preventing or reducing alcohol use among young adolescents by using
a multilevel, communitywide approach

2. . project Addition ,Sub, Mul,Div

3.0 Proposed Methodology


This project is to develop a system that would detect the amount of alcohol that is consumed by the
driver of the vehicle. The proposed system aims at preventing the user from driving when drunk and
thereby intends to reduce the number of accidents occurring due to drunk driving.

4.0 Action Plan

S Details of activity Planned Planne Name of Responsible


r. Start Date d Finish Team Members
N date
o
.
Decide individual micro project Pokharkar Sangram
1 Pokharkar Omkar
Pawar Om
2 Search micro project topics Pokharkar Sangram
related To Pokharkar Omkar
subject.
Pawar Om
3 Selection of micro project Pokharkar Sangram
title Pokharkar Omkar
Pawar Om

4 Search information related Pokharkar Sangram


to selected
Pokharkar Omkar
topic
Pawar Om
5 Pokharkar Sangram
Collect information related to Pokharkar Omkar
selected topic
Pawar Om

Completion of micro project Pokharkar Sangram


topic Pokharkar Omkar
6
Proposal
Pawar Om

7 Pokharkar Sangram
Analyze collected data For microProject Pokharkar Omkar
report. Pawar Om

Pokharkar Sangram
8 Pokharkar Omkar
Finalize collected data For micro-
Pawar Om
Project report.

Pokharkar Sangram
9 Finalize Design & flow of Pokharkar Omkar
Implementation Pawar Om

10 Pokharkar Sangram
Flow of Implementation Pokharkar Omkar
Pawar Om

11 Pokharkar Sangram
Implementation of report. Pokharkar Omkar
Pawar Om

Pokharkar Sangram
12 Report preparation Pokharkar Omkar
Pawar Om

Pokharkar Sangram
13 Finalization of report Pokharkar Omkar
Pawar Om

Submission of report Pokharkar Sangram


14 Pokharkar Omkar
Pawar Om
Names of Team Members with Roll No. Roll No.
Pokharkar Sangram Gulab 41
Pokharkar Omkar Kiran 39
Pawar Om Vijay 36

(To be Approved by the concerned teacher)

*************
A
PROJECT REPORT

ON

“Assembly Language Programing”


SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD
OF

DIPLOMA IN

COMPUTER ENGINEERING

SUBMITTED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION, MUMBAI

SUBMITTED BY

Name of Student Enrollment Number


Pokharkar Sangram
Pawar Om
Pokharkar Omkar
GUIDED BY
(Prof. Thorat S.R )

SAMARTH POLYTECHNIC, BELHE


SAMARTH POLYTECHNIC, BELHE

CERTIFICATE
This is to vertify that the project report entitled “Assembly Language Programing” Was
successfully completed by Student of fourth semester Diploma in computer engineering.
Pokharkar Sangram
Pokharkar Omkar
Pawar Om
In partial fulfillment of the requirements for the award of the Diploma in Computer
engineering and submitted to the Department of Computer of Samarth Polytechnic, Belhe
work carried out during a period for the academic year 2021-22 as per curriculum
.

Prof. Thorat S.R Prof.Kshirsagar S.B Prof. Kapile A.S.

(Subject Teacher) (H.O.D)


(Principal)
ACKNOWLEDGMENT

This project is done as a fourth semester project, as a part course titled “Assembly Language Programing”

I am really thankful to our course the Principal Prof. Kapile A. S. and the HOD Prof. Kshirsagar S.B
Samarth Polytechnic, Belhe for his invaluable guidance and assistance, without which the accomplishment
of the task would have never been possible.
I also thank Prof. Thorat for giving this opportunity to explore into the real world and realize the
interrelation without which a Project can never progress. In our present project I have chosen the topic-

“Assembly Language Programing”.

I also thankful to parents, friend and all staff of Computer engineering department, for providing us relevant
information and necessary clarifications, and great support.

Pokharkar Sangram Gulab

Pokharkar Omkar Kiran

Pawar Om Vijay
ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 1 INTRODUCTION
Assembly level programming is very important to low-level embedded system design is used to
access the processor instructions to manipulate hardware. It is a most primitive machine level
language is used to make efficient code that consumes less number of clock cycles and takes less
memory as compared to the high-level programming language. It is a complete hardware oriented
programing language to write a program the programmer must be aware of embedded hardware.
Here, we are providing basics of assembly level programming 8086.

The assembly programming language is a low-level language which is developed by using


mnemonics. The microcontroller or microprocessor can understand only the binary language like
0’s or 1’s therefore the assembler convert the assembly language to binary language and store it
the memory to perform the tasks. Before writing the program the embedded designers must have
sufficient knowledge on particular hardware of the controller or processor, so first we required to
know hardware of 8086 processor.

SAMARTH POLYTECHNIC ,BELHE 12


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 2

ALP FOR ADDITION OF TWO 8 BIT BCD NUMBERS

Problem statement:

Write a program in 8086 microprocessor to find out the addition of two 8-bit BCD numbers, where
numbers are stored from starting memory address 2000 : 500 and store the result into memory
address 2000 : 600 and carry at 2000 : 601.

Algorithm:

1. Load data from offset 500 to register AL (first number)


2. Load data from offset 501 to register BL (second number)
3. Add these two numbers (contents of register AL and register BL)
4. Apply DAA instruction (decimal adjust)
5. Store the result (content of register AL) to offset 600
6. Set register AL to 00
7. Add contents of register AL to itself with carry
8. Store the result (content of register AL) to offset 601
9. Stop

Flow Chart:

SAMARTH POLYTECHNIC ,BELHE 13


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Program:
ADDRESS MNEMONICS COMMENTS

400 MOV AL, [500]


AL ← [500]

404 MOV BL, [501]


BL ← [501]

SAMARTH POLYTECHNIC ,BELHE 14


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

408 ADD AL, BL AL ← AL+BL

40A DAA DECIMAL ADJUST AL

40B MOV [600], AL


AL → [600]

40F MOV AL, 00


AL ← 00

411 ADC AL, AL


AL ← AL+AL+cy(prev)

413 MOV [601], AL


AL → [601]

417 HLT END

Explanation:

1. MOV AL, [500]: load data from offset 500 to register AL


2. MOV BL, [501]: load data from offset 501 to register BL
3. ADD AL, BL: ADD contents of registers AL AND BL
4. DAA: decimal adjust AL
5. MOV [600], AL: store data from register AL to offset 600
6. MOV AL, 00: set value of register AL to 00
7. ADC AL, AL: add contents of register AL to AL with carry
8. MOV [601], AL: store data from register AL to offset 601
9. HLT: stop

SAMARTH POLYTECHNIC ,BELHE 15


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

OUTPUT OF PROGRAM:

Address Data

… …

600 25

601 01

… …

SAMARTH POLYTECHNIC ,BELHE 16


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 3
ALP FOR SUBTRACTION OF TWO 8 BIT BCD NUMBERS
Problem – Write a program in 8086 microprocessor to find out the Subtraction of two 8-bit BCD numbers, where numbers
are stored from starting memory address 2000 : 500 and store the result into memory address 2000 : 600 and carry
(borrow) at 2000 : 601.
Example –

SAMARTH POLYTECHNIC ,BELHE 17


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Algorithm –
1. Load data from offset 500 to register AL (first number)
2. Load data from offset 501 to register BL (second number)
3. Subtract these two numbers (contents of register AL and register BL)
4. Apply DAS instruction (decimal adjust)
5. Store the result (content of register AL) to offset 600
6. Set register AL to 00
7. Add contents of register AL to itself with carry (borrow)
8. Store the result (content of register AL) to offset 601
9. Stop

Flow chart:

SAMARTH POLYTECHNIC ,BELHE 18


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Program –

SAMARTH POLYTECHNIC ,BELHE 19


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

MEMORY ADDRESS MNEMONICS COMMENT

400 MOV AL, [500] AL<-[500]

404 MOV BL, [501] BL<-[501]

408 SUB AL, BL AL<-AL-BL

40A DAS DECIMAL ADJUST AL

40B MOV [600], AL AL->[600]

40F MOV AL, 00 AL<-00

411 ADC AL, AL AL<-AL+AL+cy(prev)

413 MOV [601], AL AL->[601]

417 HLT END

Explanation –
1. MOV AL, [500] load data from offset 500 to register AL.
2. MOV BL, [501] load data from offset 501 to register BL.
3. SUB AL, BL subtract contents of registers AL AND BL.
4. DAS decimal adjust AL.
5. MOV [600], AL store data from register AL to offset 600.
6. MOV AL, 00 set value of register AL to 00.
7. ADC AL, AL add contents of register AL to AL with borrow.
8. MOV [601], AL store data from register AL to offset 601.
9. HLT End.

Output of program :

SAMARTH POLYTECHNIC ,BELHE 20


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Address Data

… …

600 74

601 00

… …

SAMARTH POLYTECHNIC ,BELHE 21


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 4

ALP FOR MULTIPLICATION OF TWO 8 BIT BCD NUMBERS


Problem – Write a program in 8086 microprocessor to multiply two 8-bit numbers, where numbers are stored from offset
500 and store the result into offset 600.
Examples – Inputs and output are given in Hexadecimal representation.

Algorithm –
1. Load data from offset 500 to register AL (first number)
2. Load data from offset 501 to register BL (second number)
3. Multiply them (AX=AL*BL)
4. Store the result (content of register AX) to offset 600
5. Stop

Flowchart :

SAMARTH POLYTECHNIC ,BELHE 22


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Program –

MEMORY ADDRESS MNEMONICS COMMENT

400 MOV SI, 500 SI=500 403 MOV DI, 600 DI=600

MEMORY ADDRESS MNEMONICS COMMENT

406 MOV AL, [SI] AL<-[SI]

SAMARTH POLYTECHNIC ,BELHE 23


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

408 INC SI SI=SI+1

409 MOV BL, [SI] BL<-[SI]

40B MUL BL AX=AL*BL

40D MOV [DI], AX AX->[DI]

40F HLT END

Explanation –
1. MOV SI, 500 set 500 to SI
2. MOV DI, 600 set 600 to DI
3. MOV AL, [SI] load contents of offset SI to register AL
4. INC SI increase value of SI by 1
5. MOV BL, [SI] load contents of offset SI to register BL
6. MUL BL multiply contents of register AL and BL
7. MOV [DI], AX store the result (contents of register AX) to offset DI 8. HLT End.

Output

Address Data

… …

SAMARTH POLYTECHNIC ,BELHE 24


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

600 1D

601 16

… …

CHAPTER 5
ALP FOR DIVISION OF 16 BIT BY 8 BIT BCD NUMBERS

Problem – Write an assembly language program in 8086 microprocessor to divide a 16 bit number by an 8 bit number.
Example –

SAMARTH POLYTECHNIC ,BELHE 25


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Algorithm –
1. Assign value 500 in SI and 600 in DI
2. Move the contents of [SI] in BL and increment SI by 1
3. Move the contents of [SI] and [SI + 1] in AX
4. Use DIV instruction to divide AX by BL
5. Move the contents of AX in [DI].

6. Halt the program. Flowchart :

SAMARTH POLYTECHNIC ,BELHE 26


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Assumption – Initial value of each segment register is 00000.


Calculation of physical memory address – Memory Address = Segment Register
* 10(H) + offset, where Segment Register and Offset is decided on the basis of
following table.

SAMARTH POLYTECHNIC ,BELHE 27


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

OPERATIONS

Instruction fetching

Data operation

Stack operation

String as a source

String as a destination

Program – MEMORY ADDRESS

0400

0403

0406

0408

0409

040B

040D

040F
SEGMENT

SAMARTH POLYTECHNIC ,BELHE 28


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

REGISTER OFFSET

SAMARTH POLYTECHNIC ,BELHE 29


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

Code Segment Instruction Pointer

Base Register [BX], Displacement


[DISP]
Data Segment
Stack Segment Stack Pointer (SP), Base Pointer (BP)
Data Segment Source Indexed (SI)

Extra Segment Destination Indexed (DI)


MNEMONICS COMMENT
MOV SI, 500 SI <- 500

MOV DI, 600 DI <- 600

MOV BL, [SI] BL <- [SI]

INC SI SI <- SI + 1

MOV AX, [SI] AX <- [SI]

DIV BL AX <- AX / BL

MOV [DI], AX [DI] <- AX

HLT End of program


Explanation – Registers used AX, BL, SI, DI
1. MOV SI, 500 assigns 500 to SI
2. MOV DI, 600 assigns 600 to DI
3. MOV BL, [SI] moves the content of [SI] to BL register i.e. value of divisor will be stored in BL
4. INC SI increment the content of SI by 1

SAMARTH POLYTECHNIC ,BELHE 30


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

5. MOV AX, [SI] moves the content of [SI] and [SI + 1] to AX register i.e. value of dividend will be stored in AX
6. DIV BL divide the content of AX by BL, after execution of this instruction the quotient get stored in AL and
remainder in AH
7. MOV [DI], AX moves the content of AX to [DI]
8. HLT stops executing the program and halts any further execution

OUTPUT:
Address Data

… …

600 D1

… …

CHAPTER 6

SAMARTH POLYTECHNIC ,BELHE 31


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

ADVANTAGES OF ASSEMBLY LANGUAGE PROGRAMMING

. Time Efficient

For starters, Assembly Language is the lowest level of coding. Hence, Compiler takes almost no time to decode it.

2. Less Memory Consumption

As we already discussed, for Assembly Language, you need to use the registers for operations. Since they are used for

temporary storage purposes, you don’t need to bother about the consumption of memory.

3. Understanding Machine Language

At this point, I am already assuming that you know your system only understands two things – 0 or 1. Multiple
combinations of both the numbers indicate the computer’s processor: what needs to be done and when to be done?
Since, Machine Language is the computer understandable language. So, to better understand Machine Language you
need to have a command over Assembly Language.

4. Interrupt Service Routine (ISR)

Well, ISR is a dedicated routine invoked by an Interrupt. Be it Software Interrupt, Hardware Interrupt or Timer
Interrupt. If you have the knowledge of Assembly Language, you can easily alter and change the ISR according to
your needs or preferences.

5. Low-Level Embedded System

SAMARTH POLYTECHNIC ,BELHE 32


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

As we have already learnt, Assembly Language is majorly used to program embedded systems such as ovens. Using
it, one can easily take advantage of time and storage efficiency along with the ability to manipulate the hardware.

6. Hardware Manipulation & Processor Instructions

If you have learnt Assembly Language well, you can easily manipulate hardware accordingly.

CHAPTER 7

SAMARTH POLYTECHNIC ,BELHE 33


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

DISADVANTAGES OF ASSEMBLY LANGUAGE PROGRAMMING

Advantages & disadvantages goes parallelly. Now that we have seen major benefits of learning Assembly Language,
here are some drawbacks with it:

1. Not Designed For Small-Sized Computers

Well, long programs written in Assembly language are difficult to execute and the results are mostly negative.
Therefore, you cannot code in Assembly Language on Small-Sized or dated systems

2. Varies By Microprocessor Type

Assembly Language programming may differ from Microprocessor to another microprocessor. The written program
is not independent of the portable platform.

3. Difficult To Understand

Unlike other programming languages, to write in Assembly language, one must know the internal structure of the
microprocessor to proceed further.

SAMARTH POLYTECHNIC ,BELHE 34


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 8

CONCLUSION

Many computer programming languages are used for the development of applications and software programs, the
importance of assembly language cannot be underestimated. With Assembly Language, you’ll be able to run complex
tasks in simpler ways, doesn’t track much of memory locations and it is relatively faster in speed as execution time is
quite less. Additionally, the assembly language programming is transparent in nature as compared to other highlevel
languages. This is because it has a small number of operations. Therefore, it finds many users in algorithm analysis. It
makes it easy to debug. Moreover, it is the language that the CPU easily recognizes. Since every section of binary
caters to a certain meaning, it can be somewhat easy to understand, in comparison to other high-level languages!

SAMARTH POLYTECHNIC ,BELHE 35


ASSEMBLY LANGUAGE PROGRAMMING TO ADD,SUB,MUL,DIV OF TWO 8 BIT BCD NUMBERS

CHAPTER 9

REFERENCES
The assembler takes machine-language instructions and translates them into machine object code.

• What's new in Assembler Language Reference


Read about new or significantly changed information for the Assembler Language Reference topic collection.
• Assembler overview
The assembler program takes machine-language instructions and translates them into machine object-code.
• Processing and storage
The processor stores the data in the main memory and in the registers.
• Syntax and semantics
The syntax and semantics of assembler language are defined.
• Addressing
The assembly language uses different addressing modes and addressing considerations.
• Assembling and linking a program
The assembly language program defines the commands for assembling and linking a program.
• Extended instruction mnemonics
The assembler supports a set of extended mnemonics and symbols to simplify assembly language
programming.
• Migrating source programs
The assembler issues errors and warnings if a source program contains instructions that are not in the current
assembly mode.
• Instruction set
This topic contains reference articles for the operating system assembler instruction set.
• Pseudo-ops
The pseudo-ops reference information includes an overview of the assembler pseudo-ops.

SAMARTH POLYTECHNIC ,BELHE 36

You might also like