You are on page 1of 15

NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY

“Nehru Gardens” T. M. PALAYAM, COIMBATORE-105


(Approved by AICTE and Affiliated to Anna University, Chennai)
(Accredited by NAAC, Recognized by UGC with 2(f) and 12(B))
NBA Accredited UG Courses: AERO, CSE, MECH DEPARTMENT
OF COMPUTER SCIENCE AND ENGINEERING

EC8691 – MICROPROCESSORS AND


MICRO CONTROLLERS
Prepared by
G.Jeevanantham, AP/CSE,
NIET.
UNIT I THE 8086
MICROPROCESSOR

Introduction to 8086 – Microprocessor


architecture – Addressing modes - Instruction
set and assembler directives –
Assembly language programming –
Modular Programming - Linking and
Relocation - Stacks - Procedures – Macros –
Interrupts and interrupt service routines –
Byte and String Manipulation.
MODULAR PROGRAMMING

•Modular Programming
•Need of Modular Programming
•Why Modular Programming?
•Modularity
•Advantages of Modular Programming
•Disadvantages of Modular Programming
MODULAR PROGRAMMING

• Modular programming a software


is design technique emphasizes
that
separating the functionality of a program
into independent, interchangeable
modules, such that each contains
everything necessary to execute.
Need for Modular Programming
• When a program becomes very large and complex,
it becomes very difficult task for the programmers
to design, test and debug such a program.
• Therefore a long program can be divided into a

smaller program called modules as


modules the can be designed,
debugged separately, tested
the task ofand
programmer
becomes easy and convenient.
•It makes your program easy to understand.
Why Modular Programming?
• Helps manage complexity Smaller blocks of
code
Easier to read
• Encourages re-use of code
Within a particular program or across
different programs
• Allows independent development of code
Modularity
• How do you solve a big/complex problem?
• Divide it into small tasks and solve each
task. Then combine these solutions.
•In 8086 microprocessor we use functions also referred to
as
modules to perform specific tasks that we determined in our
solution.strategy is essentially based on the
•This divide-and-
approach to problem solving and conquer has many advantages over
developing a program for the entire problem.

•We will assign a name to each module and combine the named
modules in a program structure under the control of a main program.

•Such a program structure consists of a set of modules and an order


of execution.

•When all modules are tested ‘OK’, they are linked together to form a
large functioning program.
1.Assembling Process
• As mentioned earlier, assembler translates a source file that was created
using the editor into machine language such as binary or object
code. The assembler reads the source file of our program from the disk
where we saved it after editing. An assembler usually reads our source file
more than once.
• The assembler generates two files on the floppy or hard disk during
these two passes. The first file is called the object file. The object file
contains the binary codes for the instructions. The second file generated by
the assembler is called assembler list file. This file contains the
assembly language statements, the binary code for each
instruction, and the offset for each instruction.
• In the first pass, the assembler performs the following operations
1.Assembling Process
• Reading the source program instructions.
• Creating a symbol table in which all
symbols used in
the program, together with their attributes, are stored.
• Replacing all mnemonic codes by their binary
codes.
• Detecting any syntax errors in
the source program.
• Assigning relative addresses to
instructions
and data.
2.Linking Process

• A linker is a program used to join together several object files


into one large object file. When writing large programs, it is
usually much more efficient to divide the large program into
smaller modules. Each Modular Programming can be
individually written, tested and debugged. When all the
Modular Programming work, they can be linked together to
form a large functioning program.
• The linker produces a link file which contains the binary codes
for all the combined modules.
3.Debugging Process
• A debugger is a program which allows us to load our object
code program into system memory, execute the program, and debug it.
• How does a debugger help in debugging a program ?
• The debugger allows us to look at the contents of registers and memory
locations after our program runs.
• It allows us to change the contents of register and memory locations and
rerun the program.
• Some debugger allows us to stop execution after each instruction so we can check
or alter memory and register contents.
Advantages of using Modular
Programming
•Modules can be written and tested separately
•Modules can be reused
•Large projects can be developed in parallel
•Reduces length of program, making it more
readable
•Promotes the concept of abstraction
Disadvantages of using Modular
Programming
• The documentation of modules must
be systematic.
• It Can lead the problems when
modules
are linked because link must thoroughly tested.
• Since separate map repeat
modules certain the modular
functions,
programming often need extra time and
memory.
Thank
You

You might also like