Introduction To 8086 Programs
Introduction To 8086 Programs
Introduction To 8086 Programs
8086 programs
1. Programs for 16 bit Arithmetic operations.
2. Programs for Sorting and Searching using MASM
3. Interfacing ADC and DAC.
4. Parallel Communication between two MP Kits using Mode 1 and Mode 2
of 8255.
5. Interfacing and Programming 8279, 8259, and 8253.
6. Interfacing and Programming of Stepper Motor and DC Motor Speed
control.
COVERED TOPICS
✔ 8086 BASICS
✔ ARITHMETIC OPERATIONS
✔ USE OF ALP
BASICS ABOUT 8086 PROCESSOR
Both are using same space but Hexadecimal giving more information
8086 ARCHITECTURE
Instruction Decoder
Translates instructions fetched
from memory into a series of
actions which EU Carried out.
BX - To hold the base value in base addressing mode to access memory data.
SP - stack pointer - used to hold the offset address of the data stored at the top of stack segment
BP - Base Pointer - used to hold the offset address of the data to be read from or write into the stack segment
SI - Source Index register - used to hold the offset address of source data in data segment while executing
string instructions
DI - Destination Index register - used to hold the offset address of destination data in extra segment while
executing String instructions.
[segment - a portion of memory where data for a program is stored - the maximum size of a segment can be 64
bytes - minimum size of a segment can be even one byte - segment begins in memory at a memory address
which is divisible by 16]
FLAGS
CF (Carry Flag ) - This flag is set, when there is a carry out of MSB in case of addition or a borrow in case of
subtraction.
PF (Parity Flag) - This flag is set to 1,if the lower byte of the result contains even number of 1’s; for odd number of 1’s
set to zero.
AF ( Auxiliary Carry Flag ) - It is set if there is carry from low nipple to high nipple of the low order 8 bit of 16 bit
number
ZF ( Zero Flag ) - This flag set to one if the result is zero and ZF is clear to zero for non zero result
SF ( Sign Flag ) - This flag is set to one if the most significant bit of the result is one and SF is cleared to zero for non
negative result.
The instruction will specify the name of the register which holds the data to be operated by the instruction.
Example
MOV CL,DH DH CL (The 8 bit register DH is moved to another 8 Bit register CL. )
MOV BX,DX DX BX ( The 16 bit register DX is moved to another 16 Bit register BX)
Example
MOV DL,08H 08H DL (The 8 bit data (08H) given in the instruction is moved to DL register )
MOV AX,0A9FH 0A9FH AX (The 16 bit data (0A9FH) given in the instruction is moved to DL register )
Direct Addressing Mode
An unsigned 16bit displacement or signed 8 bit displacement will be specified in the instruction. The displacement is
the Effective Addressing (EA) or offset.
Eg: CLC Execution of this instruction will clear Carry Flag (CF)
8086 Instruction Set
Assembler:-it converts the instruction into sequence of binary bits, so that this bits can be read by the processor.
•Mnemonics:-these are the symbolic codes for either instructions or commands to perform a particular function.
Types:
•Arithmetic Instructions
•String Instructions
Data Transfer Instruction
• Both Source and Destination cannot be memory location or segment registers at the same time.
EXPERIMENT 1: Programs for 16 bit Arithmetic operations
MOV CL,00h
3.Clear CL register
ADD AX,BX
4.Add the two data and get the sum in AX
register
MOV [1004h],AX
5.Store the sum in memory
JNC jump
6.Check for Carry. If Carry flag is set than
INC CL go to next step, otherwise go to step 8.
HLT 9.Stop
WITHOUT CARRY EXAMPLE
ADDITION (WITH CARRY)
SUBRACTION
• if carry flag value becomes 1 increment the CL value and that value store in particular memory address. Then take
2’s complement of the difference value then store into the output memory. (CL value becomes 1 its sign bit that
means output becomes negative)
• To perform multiplication in the 8086 processor, one of the data should be stored in AX register and another data
can be stored in the register/memory. After Multiplication, the product will be in AX and DX registers.
PROGRAM
MOV SI,1100H
1.Load the address of data in SI register
MOV AX,[SI]
2.Get the first data in AX register
MOV BX,[SI+2] 3.Get the Second data in BX register
MUL BX 4.Multiply the content of AX and BX. The product will be AX and DX
6.Stop
MOV [SI+6],DX
HLT
DIVISION
MOV [SI+8],DX 6.Save the quotient (AX) and the remainder (DX) in memory
HLT 7.Stop
EXAMPLE
APPLICATIONS
• Calculators
• Accounting system
• Games machine
• Instrumentation
• Traffic light Control
• Multi user, multi-function environments
• Military applications
• Communication systems
• Remote Controller
Thank You