UNIT I Notes
UNIT I Notes
8085 Architecture
• It is an 8 bit processor
• It operates on 5V power supply
• It has on chip clock generator. This internal clock generator requires
tuned circuit like LC, RC or Crystal. Which can be used for synchronizing
external devices.
• It can operate 3-5 MHz clock frequency.
• It has 8 data lines & 16 address lines.
• It support 74 instructions with following addressing modes
a) Immediate b)Register c) Direct d)Indirect e)Implied
• The ALU Perform
a) 8-bit binary addition with or without carry.
b) 16-bit binary addition
c) 2 digit BCD addition.
d) 8-bit logical (AND,OR,EXOR….)
• It has 8-bit Accumulator, Flag Register, Instruction Register, General
purpose Register (B,C,D,E,H,L).
• Two 16-bit Register ( SP and PC)
• It provides 5 hardware interrupt
Various Functional Blocks are
• Registers
• ALU
• Instruction Decoder & Machine Cycle encoder
• Address buffer
• Address/Data buffer
• Interrupt control
• Serial I/O control
• Timing & Control circuit
Register structure
The six eight-bit general purpose registers are (B, C, D, E, H, L) these can be
used as single eight-bit registers and in pairs as 16-bit registers like BC,
DE, HL etc.,
HL register are also called as scratch pad registers
One accumulator, one flag register and two 16 bit registers (SP and PC).
The remaining registers – temporary W and Z are not accessible to the
programmers they are used by microprocessor for internal and immediate
operations.
b) W and Z register
It is a temporary registers. These register are used to hold 8 bit data
during execution of some instruction. These register are used internal.
a) Accumulator ( A Register)
It is a 8 bit register.
It is extensively used in arithmetic,logic, load and store operations
as well as I/O operations.
Most of the times the result of arithmetic and logical operations is
stored in the register A. Hence it is also identified as accumulator.
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
Zero Flag(Z):
Z=1 the zero flag sets if the result of operation in ALU is zero
Z=0 flag resets if result is non zero.
Stack Pointer: Stack is a reticent part of the memory in RAM where temporary
data can be saved
Address Buffer
It is an 8 bit unidirectional buffer. It is used to higher order address bus (A8 to A15)
Interrupt control
The processor fetches, decodes and executes instruction in a sequence.
The interrupt control block has five interrupt inputs RST 5.5, RST 6.5, RST 7.5, TRAP
and INTR and INTA.
The Signal Can be classified into seven groups according to their functions
• Power supply and frequency signals.
• Data bus and address bus
• Control and Status Signals
• Interrupt signals
• Serial I/O signals
• DMA signals
• Reset signals
• AD0 to AD7 : The 8 bit data bus (D0 – D7) is multiplexed with the lower half (A0 – A7)
of the 16 bit address bus these lines are used as a bi-directional data bus.
• A8 to A15 : The upper half of the 16 bit address appears on the address lines A8 to A15
these lines are used as uni directional data bus
Control & Status Signals
READY (input)
• This signal is used to interface slow peripheral devices with the fast
microprocessor.
• If ready is high during read or write cycle, it indicates that the memory or peripheral
is ready to send or receive data.
• If ready is low, the CPU wait for it to go high before completing the read or write
cycle.
IO/M (output) - Select memory or an IO device
• It is an output signal
• This status signal indicates that the read / write operation relates to whether the
memory or I/O device.
• It goes high to indicate an I/O operation.
• It goes low to indicate an memory operations.
S0,S1(Output)
These signals are used to indicate the kind of operation being performed
The signals initiated by an external device to request the microprocessor to do a particular task
or work.
There are five hardware interrupts called,
TRAP, RST 7.5, RST 6.5, RST 5.5, INTA
INTR (Input)
• Interrupt request is a lowest priority interrupt signal.
• It can be enable or disable by using software.
• If INTR is high, the PC will not be allowed to increment and an INTA will be issued.
INTA (Output)
• It is an active low signal used instead of RD after an interrupt request has been
accepted.
• This signal is used to read the opcode from the data bus and execute it.
TRAP (input)
• Trap interrupt is a non maskable restart interrupt
• This can not be enabled or disabled using programs.
DMA Signals
HOLD (Input)
It is an active high signal used in the direct transfer of data between a
peripheral device and memory locations.
This signal indicates that another master is requesting for the use of address
bus, data bus and control bus.
HLDA(output)
• This active high signal is used to acknowledge HOLD request.
RESET SIGNAL
The microprocessor has different ways of specifying the data or operand for the
instruction.
Example
INR M H L
MOV M,A
MOV B, M
A 30H 20H 50H 2050H 30H
MOV M, C
INSTRUCTION SET
Consists of
74 operation codes, e.g. MOV, MVI
246 Instructions, e.g. MOV A,B, MVI A,03
MOV Move
MVI Move Immediate
LDA Load Accumulator Directly from Memory
STA Store Accumulator Directly in Memory
LHLD Load Hand L Registers Directly from Memory
SHLD Store Hand L Registers Directly in Memory
LXI Load register pair Immediate
LDAX Load accumulator indirect
STAX Store Accumulator In direct
XCHG Exchange DE pair and HL pair
XTHL Exchange between HL pair and stack
IN portaddr
i.e. IN 00 ( Reads data from the Input Switch, 0 0represents the
port address of the input switch)
OUT portaddr
i.e. OUT 00 ( Writes data to the Display device where 00 represents
the Port address of the display)
Arithmetic Instruction
(Refer Class Note for Detailed Specification)
Logical Instruction
(Refer Class Note for Detailed Specification)
Branching Instruction
(Refer Class Note for Detailed Specification)
RIM SIM
Interrupts
• Interrupt Types
– Hardware Interrupts: External event
– Software Interrupts: Internal event (Software generated)
– Maskable and non-maskable interrupts
– Interrupt priority
• Maskable
– INTR
– RST vectored
• Non-Maskable
– TRAP
• Vectored
– RST5.5, RST6.5, RST7.5, TRAP
( Refer Class Notes)
MVI D, 02BH
MVI C, 06FH
MOV A, C
ADD D
STA 4500
HLT
LXI H, 4500
MOV A, M
INX H
ADD M
STA 4500
HLT
8086 Architecture
Instruction Queue
Registers
• General Purpose Registers
• Pointer and Index Registers
• Segment Registers
• Instruction Pointer
• Status Flags
Segment Registers
• A segment register points to the starting address of a memory
segment.
• The maximum capacity of a segment may be up to 64 KB.
• The instructions of 8086 specify 16-bit address.
• But the actual physical addresses are of 20-bit.
• 1 MB Memory can be divided into 16 parts which are called segments.
Source Index(SI)
It is used to hold the offset address of the source data in the data
segment, while executing string instruction.
Destination Index(DI)
It is used to hold the offset address of the destination data in the extra
segment, while executing string instruction.
Instruction Pointer
Address/Data bus
AD0-AD15 (Bidirectional)
When AD lines are used to transmit memory address the symbol A is used
instead of AD, for example A0-A15.
When data are transmitted over AD lines the symbol D is used in place of AD,
for example D0-D7, D8-D15 or D0-D15.
High order address bus. These are multiplexed with status signals.
TEST
READY
The signal is active high.
• If Logic 1 No operation in Microprocessor.
• If Logic 0 8086 enter WAIT states and remain idle.
• It is used to interface slow operating peripherals.
RESET (Input)
The signal must be active HIGH for at least four clock cycles.
Causes the processor to immediately terminate its present activity.
CS & IP are initialized to 0000H and FFFFH.
CLK
*The clock input provides the basic timing for processor operation and bus
control activity.
• Its an 33% duty cycle .
• It Max Frequency 5 MHz
INTR Interrupt Request
Minimum or maximum mode operations are decided by the pin MN/ MX(Active
low).
When this pin is high 8086 operates in minimum mode otherwise it operates in
Maximum mode.
For Minimum mode operation the MN/MX is tied to VCC ( Logic High)
For Minimum mode operation the MN/MX is tied to Ground ( Logic Low)
The queue status can be used by external device to track the internal status of
the queue in 8086.
The output on QS0 and QS1 can be interpreted as shown in table
Access Memory Location
3. Direct Addressing
4. Register Indirect Addressing Group II : Addressing modes for
5. Based Addressing memory data
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
The instruction will specify the name of the register which holds the data to be
operated by the instruction.
Example:
MOV CL, DH
(CL) (DH)
Example:
Each time the processor wants to access memory, it takes the contents of a
segment register, shifts it one hexadecimal place to the left (same as
multiplying by 1610), then add the required offset to form the 20- bit address
[SI]
[BX + SI] [BX + SI + d8]
[DI]
[BX + DI] [BX + DI + d8]
d16 (variable offset
[BP + SI] [BP + SI + d8]
only)
[BP + DI] [BP + DI + d8]
[BX]
[SI + d16]
[SI + d8] [BX + SI + d16]
[DI + d16]
[DI + d8] [BX + DI + d16]
[BP + d16]
[BP + d8] [BP + SI + d16]
[BX + d16]
[BX + d8] [BP + DI + d16]
Direct Addressing
Here, the effective address of the memory location at which the data operand is stored is given
in the instruction.
The effective address is just a 16-bit number written directly in the instruction.
Example:
The square brackets around the 1354H denotes the contents of the memory location. When
executed, this instruction will copy the contents of the memory location into BX register.
This addressing mode is called direct because the displacement of the operand from the
segment base is specified directly in the instruction.
Register Indirect Addressing
In Register indirect addressing, name of the register which holds the effective address (EA) will
be specified in the instruction.
Example:
Operations:
EA = (BX)
BA = (DS) x 1610
MA = BA + EA
In Based Addressing, BX or BP is used to hold the base value for effective address and a signed
8-bit or unsigned 16-bit displacement will be specified in the instruction.
In case of 8-bit displacement, it is sign extended to 16-bit before adding to the base value.
When BX holds the base value of EA, 20-bit physical address is calculated from BX and DS.
Example:
Operations:
SI or DI register is used to hold an index value for memory data and a signed 8-bit or
unsigned 16-bit displacement will be specified in the instruction.
Example:
Operations:
Example:
Operations:
The effective address (EA) of source data is stored in SI register and the EA of destination is
stored in DI register.
Operations:
These addressing modes are used to access data from standard I/O mapped devices or ports.
In direct port addressing mode, an 8-bit port address is directly specified in the instruction.
In indirect port addressing mode, the instruction will specify the name of the register which
holds the port address. In 8086, the 16-bit port address is stored in the DX register.
In this addressing mode, the effective address of a program instruction is specified relative to
Instruction Pointer (IP) by an 8-bit signed displacement.
Example: JZ 0AH
Operations:
If ZF = 1, then
EA = (IP) + 000AH
BA = (CS) x 1610
MA = BA + EA
Instructions using this mode have no operands. The instruction itself will specify
the data to be operated by the instruction.
Example: CLC
Instructions that are used to transfer data/ address in to registers, memory locations and I/O
ports.
Generally involve two operands: Source operand and Destination operand of the same size.
A 8-bit data can only be moved to 8-bit register/ memory and a 16-bit data can be moved to
16-bit register/ memory.
Memory Segmentation
Code segment register (CS): is used fro addressing memory location in the code segment of
the memory, where the executable program is stored.
Data segment register (DS): points to the data segment of the memory where the data is
stored.
Extra Segment Register (ES): also refers to a segment in the memory which is another data
segment in the memory.
Stack Segment Register (SS): is used fro addressing stack segment of the memory. The
stack segment is that segment of memory which is used to store stack data.
The number of address lines in 8086 is 20, 8086 BIU will send 20bit address, so as to
access one of the 1MB memory locations.
The four segment registers actually contain the upper 16 bits of the starting addresses of the
four memory segments of 64 KB each with which the 8086 is working at that instant of time. A
segment is a logical unit of memory that may be up to 64 kilobytes long.
Each segment is made up of contiguous memory locations. It is independent, separately
addressable unit. Starting address will always be changing. It will not be fixed.
Note that the 8086 does not work the whole 1MB memory at any given time. However it works only
with four 64KB segments within the whole 1MB memory.
Bellow is the one way of positioning four 64 kilobyte segments within the 1M byte memory space of
an 8086.
Overlapping Segment – A segment starts at a particular address and its maximum size can
go up to 64kilobytes. But if another segment starts along this 64kilobytes location of the first
segment, then the two are said to be Overlapping Segment.
Non-Overlapped Segment – A segment starts at a particular address and its maximum size
can go up to 64kilobytes. But if another segment starts before this 64kilobytes location of the
first segment, then the two segments are said to be Non-Overlapped Segment.