Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views11 pages

MPMC Uint-2

The document outlines the steps for developing programs in 8086 assembly language, including problem definition, planning, coding, assembling, debugging, testing, optimizing, documenting, and maintaining the program. It also details common instructions, addressing modes, assembler directives, and tools used in assembly language programming. Key tools mentioned include text editors, IDEs, assemblers, debuggers, emulators, and profilers.

Uploaded by

sarayurudra1625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

MPMC Uint-2

The document outlines the steps for developing programs in 8086 assembly language, including problem definition, planning, coding, assembling, debugging, testing, optimizing, documenting, and maintaining the program. It also details common instructions, addressing modes, assembler directives, and tools used in assembly language programming. Key tools mentioned include text editors, IDEs, assemblers, debuggers, emulators, and profilers.

Uploaded by

sarayurudra1625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

MPMC UINT-2

8086 programming: program development steps,


instructions, addressing modes, assembler directives,
writing simple programs with an assembler, and
assembly language program development tools.
Program development steps:
When developing a program in 8086 assembly
language, there are several steps involved. Here is a
general outline of the program development process:
Define the Problem: Clearly define the problem you
are trying to solve with your program. Understand the
requirements and expected behavior of the program.
Plan the Program: Break down the problem into
smaller tasks and determine the overall structure of
your program. Decide on the algorithms and data
structures you will use.
Write the Code: Start writing the program code in
assembly language using a text editor or an Integrated
Development Environment (IDE) that supports 8086
programmings. You will need to use the appropriate
assembly instructions, registers, and memory access
techniques specific to the 8086 architecture.
Assemble the Code: Once you have written the code,
you need to assemble it into machine code. Use an
assembler program, such as TASM (Turbo Assembler),
MASM (Microsoft Macro Assembler), or NASM
(Netwide Assembler), to convert your assembly code
into executable machine code.
Debug the Code: Test your program for errors and
bugs. Use a debugger or an emulator that supports the
8086 architecture to step through the code, examine
register values, and identify and fix any issues.
Test the Program: Run your program with various
inputs to ensure it produces the expected results and
behaves correctly in different scenarios. Test all the
different paths and conditions in your code.
Optimize the Code: Identify any performance
bottlenecks or areas where the code can be improved.
Optimize the critical sections of your program to make
it run more efficiently.
Document the Program: Create documentation for
your program, including a description of its purpose,
input/output specifications, and any important
implementation details. This documentation will help
others understand and use your program effectively.
Maintain and Update the Program: Once your program
is complete, you may need to maintain and update it
over time. Keep track of any changes or updates you
make to the program and ensure proper version
control.
INSTRUCTIONS:
8086 assembly language provides a variety of
instructions to perform different operations. Here are
some common instructions used in 8086
programmings:
Data Movement Instructions:
MOV: Copies data from a source operand to a
destination operand.
XCHG: Exchanges the contents of two operands.
PUSH: Pushes a value onto the stack.
POP: Pops a value from the stack.
Arithmetic and Logical Instructions:
ADD: Adds two operands and stores the result.
SUB: Subtracts the second operand from the first
operand and stores the result.
MUL: Multiplies two operands and stores the result.
DIV: Divides the first operand by the second operand
and stores the quotient and remainder.
Control Transfer Instructions:
JMP: Unconditional jump to a specified location in the
program.
JZ/JNZ: Conditional jump if the Zero Flag is set/not set.
JC/JNC: Conditional jump if the Carry Flag is set/not set.
CALL: Calls a procedure or subroutine.
RET: Returns from a subroutine.
Comparison Instructions:
CMP: Compares two operands and sets the flags
accordingly.
TEST: Performs a bitwise logical AND operation
between two operands and sets the flags accordingly.
String Instructions:
MOVS: Moves a byte or a word from one memory
location to another.
LODS: Loads a byte or a word from a memory location
into a register.
STOS: Stores a byte or a word from a register into a
memory location.
REP: Repeats the execution of a string instruction a
specified number of times.
Input/Output Instructions:
IN: Reads a byte or a word from an input port into a
register.
OUT: Writes a byte or a word from a register to an
output port.
Stack Instructions:
PUSH: Pushes a value onto the stack.
POP: Pops a value from the stack.
Addressing modes:
The 8086 architecture supports various addressing
modes, which determine how operands are accessed
and specified in instructions. Here are the addressing
modes commonly used in 8086 programming:
Immediate Addressing Mode:
In this mode, the operand is a constant value or
immediate data.
Example: MOV AX, 1234h
Register Addressing Mode:
In this mode, the operand is stored in a register.
Example: MOV AX, BX
Direct Addressing Mode:
In this mode, the operand is directly specified by its
memory address.
Example: MOV AL, [1234h]
Indirect Addressing Mode:
In this mode, the operand is accessed indirectly
through a register or a memory location.
Example: MOV AX, [BX]
Base or Index Addressing Mode:
In this mode, the operand is accessed using a base
register (BX or BP), an index register (SI or DI), and an
offset.
Example: MOV AL, [BX+SI]
Base with Displacement Addressing Mode:
In this mode, the operand is accessed using a base
register (BX or BP) with an offset or displacement.
Example: MOV AX, [BX+2]
Relative Addressing Mode:
In this mode, the operand is accessed using a relative
offset or displacement.
Example: JMP label
Assembler Directives:
Assembler directives in 8086 programming are special
instructions that are used to provide instructions and
information to the assembler, rather than being
executed by the processor at runtime. These directives
help in controlling the assembly process, defining
memory allocation, specifying data types, and
organizing the program structure. Here are some
common assembler directives used in 8086
programming:
ORG (Origin):
Sets the starting address of the program or a specific
memory segment.
Example: ORG 1000h
DB (Define Byte):
Allocates memory and initializes it with byte values.
Example: DB 10, 20, 30
DW (Define Word):
Allocates memory and initializes it with word values.
Example: DW 1000h, 2000h
DD (Define Doubleword):
Allocates memory and initializes it with doubleword
values.
Example: DD 12345678h
DT (Define Tenbytes):
Allocates memory and initializes it with tenbyte values.
Example: DT 1234567890ABCDEFh
EQU (Equation):
Defines a symbol with a specific value.
Example: CONSTANT EQU 10
SEGMENT and ENDS:
Define the start and end boundaries of a code or data
segment.
Example:
SEGMENT CODE
; Code goes here
ENDS
SEGMENT DATA
; Data goes here
ENDS
ASSUME:
Associates a segment register with a memory segment.
Example: ASSUME CS:CODE, DS:DATA
END:
Marks the end of the source file.
Example: END
Assembly language program development tools:
Assembly language program development tools are
software tools that assist in the creation, editing,
assembling, debugging, and testing of assembly
language programs. These tools simplify the
development process and provide features to enhance
productivity and code quality. Here are some common
assembly language program development tools:
Text Editors:
Text editors, such as Notepad++, Sublime Text, or Visual
Studio Code, provide a basic environment for writing
assembly language code. They offer features like syntax
highlighting, code indentation, and customizable
keyboard shortcuts to aid in code editing.
Integrated Development Environments (IDEs):
IDEs, such as Turbo Assembler (TASM), Microsoft
Macro Assembler (MASM), or NASM (Netwide
Assembler), provide a comprehensive development
environment specifically designed for assembly
language programming. They offer features like code
editors, assemblers, debuggers, project management,
and integrated help/documentation.
Assemblers:
Assemblers are tools that convert assembly language
code into machine code (executable code) or object
files. They perform tasks like lexical analysis, syntax
checking, and code generation. Examples of assemblers
include TASM, MASM, NASM, and GAS (GNU
Assembler).
Debuggers:
Debuggers allow you to step through assembly
language code, examine register and memory contents,
set breakpoints, and track the program's execution.
They help in identifying and fixing errors or bugs in the
code. Debuggers like Turbo Debugger, WinDbg, or GDB
(GNU Debugger) are commonly used.
Emulators/Simulators:
Emulators or simulators enable you to execute and test
assembly language programs without needing the
actual hardware. They provide a virtual environment
that emulates the behavior of the target architecture.
For 8086 programming, emulators like DOSBox or
Bochs can be used.
Profilers:
Profilers help in analyzing the performance of assembly
language programs by identifying bottlenecks and
measuring execution times of different sections of
code. They provide insights into program optimization
and resource usage. Profiling tools like gprof or Intel
VTune Amplifier are commonly used.
Documentation and References:
Assembly language programming often requires
referring to documentation or reference manuals for
instruction set details, addressing modes, and other
specific information. Online resources, official
documentation, or books on assembly language
programming are valuable references for developers.

You might also like