8086 MP
8086 MP
Unit 1
Introduc on to microprocessor and microcomputer:
C:\Users\91885\OneDrive\Documents\8086 0.1
Microprocessor Unit
8086 microprocessor
microprocessor unit is the brain of the microprocessor bassed computer
systems. In This unit is the unit in which all the operations are performed.
Any type of command is run in this unit and gives us output. There are
many types of operations in a computer such as arithmetic operations,
logical. All these operations are performed in the microprocessor unit.
Operation and Decision Making Operation
Register Array
These register are primarily used to store data temporarily during the
execution of a program.
Control Unit
I/O(Input/Output) Unit
The Output Devices transfer data from the microprocessor to the outside
world.
Output Devices - LEDs, CRT or video screen, D/A converter etc.
Memory Unit
System Bus
The CPU Bus has multiplexed lines, i.e., same line is used to carry different signals
The CPU interface is provided to demultiplex, the multiplexed lines, to generate
chip select signals and additional control signals.
The system bus has separate lines for each signal.
All the slaves in the system are connected to the same system bus. At any time
instant communication takes place between the master and one of the slaves.
PERIPHERAL DEVICES:
Applications:
Memory-mapped I/O applications:
Graphics processing: Memory-mapped I/O is often used in graphics
cards to provide fast access to frame buffers and control registers.
The graphics data is mapped directly to memory, allowing the CPU to
read from and write to the graphics card as if it were accessing
regular memory.
Network communication: Network interface cards (NICs) often
utilize memory-mapped I/O to transfer data between the network and
the system memory. The NIC registers are mapped to specific
memory addresses, enabling efficient data transfer and control over
network operations.
Direct memory access (DMA): DMA controllers employ memory-
mapped I/O to facilitate high-speed data transfers between devices
and system memory without CPU intervention. By mapping the DMA
controller registers to memory, data can be transferred directly
between devices and memory, reducing CPU overhead.
Bus
Connection lines used to connect the internal parts of the
microprocessor chip is called bus. There are three types of buses
in a microprocessor −
Data Bus − Lines that carry data to and from memory are
called data bus. It is a bidirectional bus with width equal to
word length of the microprocessor.
Address Bus − It is a unidirectional responsible for carrying
address of a memory location or I/O port from CPU to
memory or I/O port.
8086 microprocessor
Control Bus − Lines that carry control signals like clock
signals, interrupt signal or ready signal are called control bus.
They are bidirectional. Signal that denotes that a device is
ready for processing is called ready signal. Signal that
indicates to a device to interrupt its process is called
an interrupt signal.
ASCII and UNICODE are the two most extensively used character encoding
schemes in computer systems. The most basic difference between ASCII and
UNICODE is that ASCII is used to represent text in form of symbols, numbers,
and character, whereas UNICODE is used to exchange, process, and store text
data in any language.
What is ASCII?
ASCII stands for American Standard Code for Information Interchange. It is a
standard developed for character encoding in electronic communication. ASCII
was first published in 1963. In computers and other electronic systems, it is
used for representing text as symbols, characters, and numbers.
In ASCII, each letter is assigned a particular value between 0 and 127. Thus,
ASCII can be used to represent 128 characters. Most computer systems use
ASCII encoding scheme that makes the interchange of data among different
devices simple.
The following table shows some of the symbols and their ASCII values.
Space 32 00100000
Number # 35 00100011
Dollar $ 36 00100100
Procenttecken % 37 00100101
Asterisk * 42 00101010
Plus + 43 00101011
Comma , 44 00101100
Hyphen - 45 00101101
Zero 0 48 00110000
One 1 49 00110001
Two 2 50 00110010
Eight 8 56 00111000
8086 microprocessor
Nine 9 57 00111001
Colon : 58 00111010
Semicolon ; 59 00111011
Equals = 61 00111101
At symbol @ 64 01000000
Uppercase A A 65 01000001
Uppercase B B 66 01000010
Uppercase C C 67 01000011
Uppercase D D 68 01000100
Uppercase X X 88 01011000
Uppercase Y Y 89 01011001
Uppercase Z Z 90 01011010
Backslash \ 92 01011100
Underscore _ 95 01011111
Lowercase a a 97 01100001
Lowercase b b 98 01100010
8086 microprocessor
Lowercase c c 99 01100011
What is UNICODE?
UNICODE stands for Universal Character Set. UNICODE is an encoding scheme
whose standards are maintained by UNICODE Consortium. The greatest
advantage of UNICODE is that we can uniquely define every character in every
language by giving a different number.
UNICODE encoding schemes are classified into several types depending on the
number of bits used. These UNICODE encoding schemes are UTF-7 (7-bit
encoding scheme), UTF-8 (8-bit encoding scheme), UTF-16 (16-bit encoding
scheme), and UTF-32 (32-bit encoding scheme). Here, UTF stands for
8086 microprocessor
UNICODE Transformation Format, which is a type of UNICODE encoding
scheme.
Conclusion
Both ASCII and UNICODE are the character encoding schemes used in
electronic communication. From the above comparison of ASCII and UNICODE,
we can state the most significant difference between them that is, ASCII is a
basic encoding scheme that represents 128 characters in 7-bit encoding,
whereas UNICODE is a vast ocean of text, numbers, mathematical symbols,
8086 microprocessor
emojis, formulae, etc. that can be mapped in different bit sizes. However,
ASCII is a proper subset of UNICODE, hence UNICODE can represent all the
characters in ASCII.
Consider the following truth table and focus on how are these represented.
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
In the BCD numbering system, the given decimal number is segregated into
chunks of four bits for each decimal digit within the number. Each decimal digit
is converted into its direct binary form (usually represented in 4-bits).
For example:
Introduction :
The 8086 microprocessor is an 8-bit/16-bit
microprocessor designed by Intel in the late 1970s.
It is the first member of the x86 family of
microprocessors, which includes many popular
CPUs used in personal computers.
The architecture of the 8086 microprocessor is
based on a complex instruction set computer
(CISC) architecture, which means that it supports a
wide range of instructions, many of which can
perform multiple operations in a single instruction.
The 8086 microprocessor has a 20-bit address bus,
which can address up to 1 MB of memory, and a
16-bit data bus, which can transfer data between
the microprocessor and memory or I/O devices.
The 8086 microprocessor has a segmented
memory architecture, which means that memory is
divided into segments that are addressed using
both a segment register and an offset. The
segment register points to the start of a segment,
while the offset specifies the location of a specific
byte within the segment. This allows the 8086
microprocessor to access large amounts of
memory, while still using a 16-bit data bus.
8086 microprocessor
The 8086 microprocessor has two main execution
units: the execution unit (EU) and the bus interface
unit (BIU). The BIU is responsible for fetching
instructions from memory and decoding them, while
the EU executes the instructions. The BIU also
manages data transfer between the microprocessor
and memory or I/O devices.
The 8086 microprocessor has a rich set of
registers, including general-purpose registers,
segment registers, and special registers. The
general-purpose registers can be used to store
data and perform arithmetic and logical operations,
while the segment registers are used to address
memory segments. The special registers include
the flags register, which stores status information
about the result of the previous operation, and the
instruction pointer (IP), which points to the next
instruction to be executed.
A Microprocessor is an Integrated Circuit with all
the functions of a CPU. However, it cannot be used
stand-alone since unlike a microcontroller it has no
memory or peripherals.
8086 does not have a RAM or ROM inside it.
However, it has internal registers for storing
intermediate and final results and interfaces with
memory located outside it through the System Bus.
In the case of 8086, it is a 16-bit Integer
processor in a 40-pin, Dual Inline Packaged IC.
8086 microprocessor
The size of the internal registers(present within the
chip) indicates how much information the processor
can operate on at a time (in this case 16-bit
registers) and how it moves data around internally
within the chip, sometimes also referred to as the
internal data bus.
8086 provides the programmer with 14 internal
registers, each of 16 bits or 2 bytes wide. The main
advantage of the 8086 microprocessor is that it
supports Pipelining.
8086 Architecture
Memory segmentation:
In order to increase execution speed and fetching
speed, 8086 segments the memory.
Its 20-bit address bus can address 1MB of
memory, it segments it into 16 64kB segments.
8086 microprocessor
8086 works only with four 64KB segments within
the whole 1MB memory.
The internal architecture of Intel 8086 is divided
into 2 units: The Bus Interface Unit (BIU),
and The Execution Unit (EU). These are
explained as following below.
1. The Bus Interface Unit (BIU):
It provides the interface of 8086 to external memory
and I/O devices via the System Bus. It performs
various machine cycles such as memory read, I/O
read, etc. to transfer data between memory and I/O
devices.
BIU performs the following functions are as follows:
It generates the 20-bit physical address for memory
access.
It fetches instructions from the memory.
It transfers data to and from the memory and I/O.
Maintains the 6-byte pre-fetch instruction
queue(supports pipelining).
BIU mainly contains the 4 Segment registers,
the Instruction Pointer, a pre-fetch queue, and
an Address Generation Circuit.
Instruction Pointer (IP):
It is a 16-bit register. It holds offset of the next
instructions in the Code Segment.
IP is incremented after every instruction byte is
fetched.
IP gets a new value whenever a branch instruction
occurs.
8086 microprocessor
CS is multiplied by 10H to give the 20-bit physical
address of the Code Segment.
The address of the next instruction is calculated by
using the formula CS x 10H + IP.
Example:
CS = 4321H IP = 1000H
then CS x 10H = 43210H + offset = 44210H
Here Offset = Instruction Pointer(IP)
This is the address of the next instruction.
Code Segment register: (16 Bit register): CS
holds the base address for the Code Segment. All
programs are stored in the Code Segment and
accessed via the IP.
Data Segment register: (16 Bit register): DS
holds the base address for the Data Segment.
Stack Segment register: (16 Bit register): SS
holds the base address for the Stack Segment.
Extra Segment register: (16 Bit register): ES
holds the base address for the Extra Segment.
Please note that segments are present in memory
and segment registers are present in
Microprocessor.
Segment registers store starting address of each
segments in memory.
Types Of Segmenta on –
1. Overlapping Segment – A segment starts at a par cular
address and its maximum size can go up to 64kilobytes.
But if another segment starts along with this 64kilobytes
loca on of the first segment, then the two are said to
be Overlapping Segment.
8086 microprocessor
2. Non-Overlapped Segment – A segment starts at a
par cular address and its maximum size can go up to
64kilobytes. But if another segment starts before this
64kilobytes loca on of the first segment, then the two
segments are said to be Non-Overlapped Segment.
Rules of Segmenta on Segmenta on process follows some
rules as follows:
The star ng address of a segment should be such that it
can be evenly divided by 16.
Minimum size of a segment can be 16 bytes and the
maximum can be 64 kB.
S2 S1 S0 Characteris cs
0 0 0 Interrupt acknowledge
0 1 1 Halt
1 0 0 Code access
1 0 1 Read memory
1 1 0 Write memory
8086 microprocessor
S2 S1 S0 Characteris cs
1 1 1 Passive state
0 0 No opera on
Unit 3
Addressing modes:
8086 microprocessor
Data Addressing modes in 8086 microprocessor
Prerequisite – Addressing modes, Addressing modes in 8085 microprocessor
The way of specifying data to be operated by an instruc on is known
as addressing modes. This specifies that the given data is an immediate data or
an address. It also specifies whether the given operand is register or register
pair.
Types of addressing modes:
1. Register mode – In this type of addressing mode both the operands are
registers.
Example:
2. MOV AX, BX
3. XOR AX, DX
ADD AL, BL
4. Immediate mode – In this type of addressing mode the source operand
is a 8 bit or 16 bit data. Des na on operand can never be immediate
data.
Example:
5. MOV AX, 2000
6. MOV CL, 0A
7. ADD AL, 45
AND AX, 0000
Note that to ini alize the value of segment register an register is required.
MOV AX, 2000
MOV CS, AX
8. Displacement or direct mode – In this type of addressing mode the
effec ve address is directly given in the instruc on as displacement.
Example:
9. MOV AX, [DISP]
MOV AX, [0500]
8086 microprocessor
10.Register indirect mode – In this addressing mode the effec ve address is
in SI, DI or BX.
Example: Physical Address = Segment Address + Effec ve Address
11.MOV AX, [DI]
12.ADD AL, [BX]
MOV AX, [SI]
13.Based indexed mode – In this the effec ve address is sum of base
register and index register.
14.Base register: BX, BP
Index register: SI, DI
The physical memory address is calculated according to the base register.
Example:
MOV AL, [BP+SI]
MOV AX, [BX+DI]
15.Indexed mode – In this type of addressing mode the effec ve address is
sum of index register and displacement.
Example:
16.MOV AX, [SI+2000]
MOV AL, [DI+3000]
17.Based mode – In this the effec ve address is the sum of base register
and displacement.
Example:
MOV AL, [BP+ 0100]
18.Based indexed displacement mode – In this type of addressing mode
the effec ve address is the sum of index register, base register and
displacement.
Example:
MOV AL, [SI+BP+2000]
19.String mode – This addressing mode is related to string instruc ons. In
this the value of SI and DI are auto incremented and decremented
8086 microprocessor
depending upon the value of direc onal flag.
Example:
20.MOVS B
MOVS W
21.Input/Output mode – This addressing mode is related with input output
opera ons.
Example:
22.IN A, 45
OUT A, 50
23.Rela ve mode –
In this the effec ve address is calculated with reference to instruc on
pointer.
Example:
24.JNZ 8 bit address
IP=IP+8 bit address
Let us study each of them in detail about their instructions and the way of
processing by the microprocessor while executing them.
8086 microprocessor
1) Direct Program Memory Addressing
In this addressing mode, the offset address where the control is to be shifted
is defined within the instruction. This mode is called direct addressing mode
because the required address is directly present in the instruction rather than
being stored in some register.
Example:
JMP 4032H
Example:
JMP BX
Working:
Suppose that the content of the BX register is 0003H. So, the working of the
microprocessor for executing the above instruction will be as follows:
IP <- contents of BX
i.e. IP <- 0003H
Example:
Here, SHORT is used to represent the 8-bit displacement and OVER is the
Label defined for any particular memory location.
A register, called the Stack Pointer (SP), always keeps track of the top of
the stack (TOS).
Instruc ons use the value in the SP as the base address for accessing data.
There are typically two main instruc ons used with the stack:
o PUSH: This instruc on pushes data onto the stack, essen ally
decremen ng the SP and storing the data at the new TOS.
o POP: This instruc on retrieves data from the stack, incremen ng
the SP and returning the data that was previously at the TOS.
Stack addressing mode doesn't require specifying the full memory address
in the instruc on itself. It relies on the SP to determine the loca on.
This mode is o en used in conjunc on with other addressing modes for
more complex memory access pa erns.
8086 microprocessor
Unit 4
MOV revisited:
Opcode, short for opera on code, is the fundamental building block of a
machine language instruc on. It essen ally tells the processor what specific task
to perform.
Func on: An opcode acts like a verb in a sentence, dicta ng the ac on the
processor needs to take. These ac ons can be basic arithme c opera ons
(add, subtract), logical opera ons (compare, test), data transfer, or control
flow (jumps, loops).
Representa on: Opcodes are represented in binary code (0s and 1s) for
the processor to understand efficiently. For human readability, they might
also be shown in hexadecimal (base-16) format.
Instruc on Set Architecture (ISA): Each processor has its own set of
opcodes defined by its Instruc on Set Architecture (ISA). This set
determines the available opera ons and the corresponding opcode for
each.
Operands: Opcodes typically work together with operands, which specify
the data the instruc on operates on. Imagine the opcode as saying "add,"
and the operands telling the processor which numbers to add.
Beyond CPUs: Opcodes aren't limited to CPUs. They are also used in
bytecode for so ware interpreters, where the bytecode is interpreted by
a virtual machine instead of a physical processor.
8086 microprocessor
PUSH and POP in 8086 Assembly Language
The PUSH and POP instruc ons are fundamental for working with the stack in
8086 assembly language. Here's a breakdown of their func onality:
PUSH
POP
Key Points:
Common Uses:
This code sets the Stack Segment (SS) register (optional, depends on your memory
setup) and the SP register. SP points to the topmost usable location in the stack
(initially empty).
Now, you can use PUSH and POP instructions to manipulate data on the stack:
Code snippet
; Push a value onto the stack (example: value in register AX)
push ax
Remember, these are just basic examples. Stack management in assembly involves
understanding memory allocation, handling potential stack overflow/underflow
situations, and using PUSH and POP effectively in your program.
Introduction :
Data transfer instructions in the 8086 microprocessor are used to move data
between memory locations, registers, and input/output (I/O) devices. These
8086 microprocessor
instructions are essential for manipulating data within a program, as well as for
communicating with external devices.
Data transfer instructions are the instructions which transfers data in the
microprocessor. They are also called copy instructions.
PUSHA none put all the registers into the stack PUSHA
XCHG [2050],
XCHG D, S exchanges contents of D and S
AX
Arithme c Instruc ons are the instruc ons which perform basic arithme c
opera ons such as addi on, subtrac on and a few more. Unlike in 8085
microprocessor, in 8086 microprocessor the des na on operand need not be
the accumulator.
ADD AX,
ADD D, S D=D+S
[2050]
SBB [2050],
SBB D, S D = D – S – prev. carry
0050
8 or 16 bit
IMUL performs signed mul plica on IMUL CX
register
8 or 16 bit
IDIV performs signed division IDIV BL
register