8085 Microprocessor Architecture Overview
8085 Microprocessor Architecture Overview
UNIT – V
Microprocessor
The main operation of ALU is arithmetic as well as logical which includes addition, increment,
subtraction, decrement, logical operations like AND, OR, Ex-OR, complement, evaluation, left shift
or right shift. Both the temporary registers as well as accumulators are utilized for holding the
information throughout in the operations then the outcome will be stored within the accumulator.
The different flags are arranged or rearrange based on the outcome of the operation.
Computer System Architecture
2. Arithmetic and logic unit - As the name suggests, it performs arithmetic and logical operations
like Addition, Subtraction, AND, OR, etc. on 8-bit data.
3. General purpose registers - There are 6 general purpose registers in 8085 processor, i.e. B, C, D,
E, H & L. Each register can hold 8-bit data.
These registers can work in pair to hold 16-bit data and their pairing combination is like B-C, D-E
& H-L.
4. Program counter - It is a 16-bit register used to store the memory address location of the next
instruction to be executed. Microprocessor increments the program whenever an instruction is
being executed, so that the program counter points to the memory address of the next instruction
that is going to be executed.
5. Stack pointer - It is also a 16-bit register works like stack, which is always
incremented/decremented by 2 during push & pop operations.
6. Temporary register - It is an 8-bit register, which holds the temporary data of arithmetic and
logical operations.
Computer System Architecture
7. Flag register - It is an 8-bit register having five 1-bit flip-flops, which holds either 0 or 1
depending upon the result stored in the accumulator.
These are the set of 5 flip-flops −
Sign (S)
Zero (Z)
Auxiliary Carry (AC)
Parity (P)
Carry (C)
D7 D6 D5 D4 D3 D2 D1 D0
S Z AC P CY
8. Instruction register and decoder - It is an 8-bit register. When an instruction is fetched from
memory then it is stored in the Instruction register. Instruction decoder decodes the information
present in the Instruction register.
9. Timing and control unit - It provides timing and control signal to the microprocessor to perform
operations. Following are the timing and control signals, which control external and internal
circuits −
Control Signals: READY, RD’, WR’, ALE
Status Signals: S0, S1, IO/M’
DMA Signals: HOLD, HLDA
RESET Signals: RESET IN, RESET OUT
10. Interrupt control - As the name suggests it controls the interrupts during a process. When a
microprocessor is executing a main program and whenever an interrupt occurs, the
microprocessor shifts the control from the main program to process the incoming request. After
the request is completed, the control goes back to the main program.
There are 5 interrupt signals in 8085 microprocessor: INTR, RST 7.5, RST 6.5, RST 5.5,
TRAP.
11. Serial Input/output control - It controls the serial data communication by using these two
instructions: SID (Serial input data) and SOD (Serial output data).
12. Address buffer and address-data buffer - The content stored in the stack pointer and program
counter is loaded into the address buffer and address-data buffer to communicate with the CPU.
The memory and I/O chips are connected to these buses; the CPU can exchange the desired data
with the memory and I/O chips.
13. Address bus and data bus - Data bus carries the data to be stored. It is bidirectional, whereas
address bus carries the location to where it should be stored and it is unidirectional. It is used to
transfer the data & Address I/O devices.
Computer System Architecture
2. Data bus - AD7-AD0, it carries the least significant 8-bit address and data bus.
3. Control and status signals - These signals are used to identify the nature of operation. There
are 3 control signal and 3 status signals.
Three control signals are RD, WR & ALE.
RD − This signal indicates that the selected IO or memory device is to be read and is ready
for accepting data available on the data bus.
WR − This signal indicates that the data on the data bus is to be written into a selected
memory or IO location.
ALE − It is a positive going pulse generated when a new operation is started by the
microprocessor. When the pulse goes high, it indicates address. When the pulse goes down
it indicates data.
4. IO/M - This signal is used to differentiate between IO and Memory operations, i.e. when it is
high indicates IO operation and when it is low then it indicates memory operation.
Computer System Architecture
5. S1 & S0 - These signals are used to identify the type of current operation.
Computer System Architecture
6. Power supply - There are 2 power supply signals − VCC & VSS. VCC indicates +5v power
supply and VSS indicates ground signal.
7. Clock signals - There are 3 clock signals, i.e. X1, X2, CLK OUT.
X1, X2 − A crystal (RC, LC N/W) is connected at these two pins and is used to set
frequency of the internal clock generator. This frequency is internally divided by 2.
CLK OUT − This signal is used as the system clock for devices connected with the
microprocessor.
If an addressing mode is direct, immediate or implicit then No. of machine cycles = No. of
bytes.
If the addressing mode is indirect then No. of machine cycles = No. of bytes + 1. Add +1 to the
No. of machine cycles if it is memory read/write operation.
If the operand is 8-bit or 16-bit address then, No. of machine cycles = No. of bytes +1.
These rules are applicable to 80% of the instructions of 8085.
1. Opcode fetch: The microprocessor requires instructions to perform any particular action. In
order to perform these actions microprocessor utilizes Opcode which is a part of an instruction
which provides detail (i.e. which operation µp needs to perform) to microprocessor.
Computer System Architecture
The instructions which have more than one byte word size will use the machine cycle after the
opcode fetch machine cycle.
Computer System Architecture
The memory write machine cycle is executed by the processor to write a data byte in a
memory location.
The processor takes, 3T states to execute this machine cycle.
5. IO Write:
It is used to writ one byte into IO device.
It requires 3 T-States.
Computer System Architecture
Each Instruction and Data Format of 8085 microprocessor has specific information fields. These
information fields of instructions are called elements of instruction. These are :
Operation code : The operation code field in the instruction specifies the operation to be
performed. The operation is specified by binary code, hence the name operation code or
simply opcode. For example, for 8085 processor operation code for ADD B instruction is
80H.
Source / destination operand : The source/destination operand field directly specifies the
source/destination operand for the instruction. In 8085, the instruction MOV A,B has B
register contents as a source operand and A register contents as a destination operand
because this instruction copies the contents of register B to register A.
Source operand address : We know that the operation specified by the instruction may
require one or more operands. The source operand may be in the 8085 register or in the
memory. Many times the instruction specifies the address of the source operand so that
operand(s) can be accessed and operated by the 8085 according to the instruction.
Instruction Formats:
The 8085A instruction set consists of one, two and three byte instructions. The first byte is always
the opcode; in two-byte instructions the second byte is usually data; in three byte instructions the
last two bytes present address or 16-bit data.
1. One byte instruction:
For Example : MOV A, B whose opcode is 78H which is one byte. This Instruction and Data
Format of 8085 copies the contents of B register in A register.
For Example : MVI B, 02H. The opcode for this instruction is 06H and is always followed by a
byte data (02H in this case). This instruction is a two byte instruction which copies immediate
data into B register.
For Example : JMP 6200H. The opcode for this instruction is C3H and is always followed by
16 bit address (6200H in this case). This instruction is a three byte instruction which loads 16
bit address into program counter.
Computer System Architecture
Data Formats:
The operand is an another name for data. It may appear in different forms :
Addresses
Numbers/Logical data and
Characters
1. Addresses : The address is a 16-bit unsigned integer ,number used to refer a memory location.
BCD : The term BCD number stands for binary coded decimal number. It uses ten digits
from 0 through 9. The 8-bit register of 8085 can store two digit BCD
3. Characters : The 8085 uses ASCII code to represent characters. It is a 7-bit alphanumeric code
that represents decimal numbers, English alphabets, and other special characters.
Status Flags:
There is a set of five flip-flops which indicate status (condition) arising after the execution of
arithmetic and logic instructions. These are:
Carry Flag (CS)
Parity Flag (P)
Auxiliary Carry Flags (AC)
Zero Flags (Z)
Sign Flags (S)
Symbol/Abbreviations Meaning
A, B, C, D, H, L 8-bit register
A Accumulator
Computer System Architecture
PC 16 bit program counter, PCH is high order 8 bits and PCL low
order 8 bits of register PC.
CS Carry Status
^ AND operation
∨ OR operation
⊕ or ∀ Exclusive OR
⇔ Exchange contents
Computer System Architecture
Instruction Description
MOV r1, r2 (Move Data; Move the content of the one register to another). [r1] <--
[r2]
LXI rp, data 16. (Load register pair immediate). [rp] <-- data 16 bits, [rh] <-- 8 LSBs of
data.
LDA addr. (Load Accumulator direct). [A] <-- [addr].
LHLD addr. (Load H-L pair direct). [L] <-- [addr], [H] <-- [addr+1].
SHLD addr. (Store H-L pair direct) [addr] <-- [L], [addr+1] <-- [H].
2. Arithmetic Group - The instructions of this group perform arithmetic operations such as
addition, subtraction; increment or decrement of the content of a register or memory. Examples
are: ADD, SUB, INR, DAD etc.
Computer System Architecture
Instruction Description
ADD r. (Add register to accumulator) [A] <-- [A] + [r].
ADD M. (Add memory to accumulator) [A] <-- [A] + [[H-L]].
ADC r. (Add register with carry to accumulator). [A] <-- [A] + [r] + [CS].
ADC M. (Add memory with carry to accumulator) [A] <-- [A] + [[H-L]] [CS].
ADI data (Add immediate data to accumulator) [A] <-- [A] + data.
ACI data (Add with carry immediate data to accumulator). [A] <-- [A] + data +
[CS].
DAD rp. (Add register paid to H-L pair). [H-L] <-- [H-L] + [rp].
SUB r. (Subtract register from accumulator). [A] <-- [A] – [r].
3. Logical Group - The Instructions under this group perform logical operation such as AND,
OR, compare, rotate etc. Examples are: ANA, XRA, ORA, CMP, and RAL etc.
Instruction Description
ANA r. (AND register with accumulator) [A] <-- [A] ^ [r].
ANA M. (AND memory with accumulator). [A] <-- [A] ^ [[H-L]].
ANI data. (AND immediate data with accumulator) [A] <-- [A] ^ data.
ORA r. (OR register with accumulator) [A] <-- [A] v [r].
ORA M. (OR memory with accumulator) [A] <-- [A] v [[H-L]]
ORI data. (OR immediate data with accumulator) [A] <-- [A] v data.
XRA r. (EXCLUSIVE – OR register with accumulator) [A] <-- [A] v [r]
XRA M. (EXCLUSIVE-OR memory with accumulator) [A] <-- [A] v [[H-
L]]
XRI data. (EXCLUSIVE-OR immediate data with accumulator) [A] <-- [A]
CMA. (Complement the accumulator) [A] <-- [A]
CMC. (Complement the carry status) [CS] <-- [CS]
STC. (Set carry status) [CS] <-- 1.
CMP r. (Compare register with accumulator) [A] – [r]
CMP M. (Compare memory with accumulator) [A] – [[H-L]]
CPI data. (Compare immediate data with accumulator) [A] – data.
RLC (Rotate accumulator left) [An+1] <-- [An], [A0] <-- [A7],[CS] <--
[A7].
RRC. (Rotate accumulator right) [A7] <-- [A0], [CS] <-- [A0], [An] <--
[An+1].
RAL. (Rotate accumulator left through carry) [An+1] <-- [An], [CS] <--
[A7], [A0] <-- [CS].
RAR. (Rotate accumulator right through carry) [An] <-- [An+1], [CS]
<-- [A0], [A7] <-- [CS]
Computer System Architecture
4. Branch Control Group - This group includes the instructions for conditional and
unconditional jump, subroutine call and return, and restart. Examples are: JMP, JC, JZ, CALL,
CZ, RST etc.
Instruction Description
JMP addr (label). (Unconditional jump: jump to the instruction specified by the address).
[PC] <-- Label
JZ addr (label). (Jump if the result is
zero)
JNZ addr (label) (Jump if the result is not
zero)
JC addr (label). (Jump if there is a carry)
Conditional Jump JNC addr (label). (Jump if there is no
addr (label): 7 states carry)
are required for the JP addr (label). (Jump if the result is
execution of the plus)
instruction. JM addr (label). (Jump if the result is
minus)
JPE addr (label) (Jump if even parity)
CALL addr (label) (Unconditional CALL: call the subroutine identified by the operand)
RET (Return from subroutine)
RST n (Restart) Restart is a one-word CALL instruction. The content of the
program counter is saved in the stack. The program jumps to the
instruction starting at restart location.
5. Stack, I/O and Machine Control Group - This group includes the instructions for
input/output ports, stack and machine control. Examples are: IN, OUT, PUSH, POP, and HLT
etc.
Instruction Description
IN port-address. (Input to accumulator from I/O port) [A] <-- [Port]
OUT port-address (Output from accumulator to I/O port) [Port] <-- [A]
PUSH rp (Push the content of register pair to stack)
PUSH PSW (PUSH Processor Status Word)
POP rp (Pop the content of register pair, which was saved, from the stack)
POP PSW (Pop Processor Status Word)
HLT (Halt)
XTHL (Exchange stack-top with H-L)
SPHL (Move the contents of H-L pair to stack pointer)
EI (Enable Interrupts)
DI (Disable Interrupts)
SIM (Set Interrupt Masks)
RIM (Read Interrupt Masks)
NOP (No Operation)
Computer System Architecture
8086 Microprocessor
Intel 8086
Intel 8086 microprocessor is the enhanced version of Intel 8085 microprocessor. It was
designed by Intel in 1976.
The 8086 microprocessor is a16-bit, N-channel, HMOS microprocessor. Where the
HMOS is used for "High-speed Metal Oxide Semiconductor".
Intel 8086 is built on a single semiconductor chip and packaged in a 40-pin IC package.
The type of package is DIP (Dual Inline Package).
Intel 8086 uses 20 address lines and 16 data- lines. It can directly address up to 220 = 1
Mbyte of memory.
It consists of a powerful instruction set, which provides operation like division and
multiplication very quickly.
8086 is designed to operate in two modes, i.e., Minimum and Maximum mode.
Architecture of 8086
The following diagram depicts the architecture of a 8086 Microprocessor −
Computer System Architecture
2.2 Segment Registers - Additional registers called segment registers generate memory address
when combined with other in the microprocessor. In 8086 microprocessor, memory is divided
into 4 segments as follow:
Code Segment (CS): The CS register is used for addressing a memory location in the
Code Segment of the memory, where the executable program is stored.
Data Segment (DS): The DS contains most data used by program. Data are accessed in
the Data Segment by an offset address or the content of other register that holds the
offset address.
Stack Segment (SS): SS defined the area of memory used for the stack.
Extra Segment (ES): ES is additional data segment that is used by some of the string to
hold the destination data.
2.3 Flag Registers of 8086 - Flag register in EU is of 16-bit and is shown in below fig.:
Flags Register determines the current state of the processor. They are modified automatically
by CPU after mathematical operations, this allows to determine the type of the result, and to
determine conditions to transfer control to other parts of the program. 8086 has 9 flags and they
are divided into two categories:
Conditional Flags
Control Flags
2.3.1 Conditional Flags - Conditional flags represent result of last arithmetic or logical
instruction executed. Conditional flags are as follows:
Carry Flag (CF): This flag indicates an overflow condition for unsigned integer
arithmetic. It is also used in multiple-precision arithmetic.
Auxiliary Flag (AF): If an operation performed in ALU generates a carry/barrow from
lower nibble (i.e. D0 – D3) to upper nibble (i.e. D4 – D7), the AF flag is set i.e. carry
given by D3 bit to D4 is AF flag. This is not a general-purpose flag, it is used internally
by the processor to perform Binary to BCD conversion.
Parity Flag (PF): This flag is used to indicate the parity of result. If lower order 8-bits
of the result contains even number of 1’s, the Parity Flag is set and for odd number of
1’s, the Parity Flag is reset.
Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else it is
reset.
Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB bit.
If the result of operation is negative, sign flag is set.
Overflow Flag (OF): It occurs when signed numbers are added or subtracted. An OF
indicates that the result has exceeded the capacity of machine.
2.3.2 Control Flags - Control flags are set or reset deliberately to control the operations of the
execution unit. Control flags are as follows:
Trap Flag (TP):
o It is used for single step control.
o It allows user to execute one instruction of a program at a time for debugging.
o When trap flag is set, program can be run in single step mode.
Interrupt Flag (IF):
o It is an interrupt enable/disable flag.
o If it is set, the maskable interrupt of 8086 is enabled and if it is reset, the
interrupt is disabled.
o It can be set by executing instruction sit and can be cleared by executing CLI
instruction.
Direction Flag (DF):
o It is used in string operation.
o If it is set, string bytes are accessed from higher memory address to lower
memory address.
Computer System Architecture
o When it is reset, the string bytes are accessed from lower memory address to
higher memory address.
Computer System Architecture
Instructions are classified on the basis of functions they perform. They are categorized into the
following main types:
The 8086 microprocessor supports 8 types of instructions −
Data Transfer Instructions
Arithmetic Instructions
Bit Manipulation Instructions
String Instructions
Program Execution Transfer Instructions (Branch & Loop Instructions)
Processor Control Instructions
Iteration Control Instructions
Interrupt Instructions
1. Data Transfer instruction - All the instructions which perform data movement come under
this category. The source data may be a register, memory location, port etc. the destination may
be a register, memory location or port. The following instructions come under this category:
2. Arithmetic Instructions - These instructions are used to perform arithmetic operations like
addition, subtraction, multiplication, division, etc.
Following is the list of instructions under this group –
Category Instruction Description
ADD Used to add the provided byte to byte/word to word.
ADC Used to add with carry.
Instructions to INC Used to increment the provided byte/word by 1.
perform addition AAA Used to adjust ASCII after addition.
DAA Used to adjust the decimal after the addition/subtraction
operation.
SUB Used to subtract the byte from byte/word from word.
3. Bit Manipulation Instructions - These instructions are used to perform operations where data
bits are involved, i.e. operations like logical, shift, etc.
Following is the list of instructions under this group –
Category Instruction Description
NOT Used to invert each bit of a byte or word.
AND Used for adding each bit in a byte/word with the
corresponding bit in another byte/word.
OR Used to multiply each bit in a byte/word with the
Instructions to
corresponding bit in another byte/word.
perform logical
XOR Used to perform Exclusive-OR operation over each bit in
operation
a byte/word with the corresponding bit in another
byte/word.
TEST Used to add operands to update flags, without affecting
operands.
SHL/SAL Used to shift bits of a byte/word towards left and put
zero(S) in LSBs.
Instructions to
SHR Used to shift bits of a byte/word towards the right and put
perform shift
zero(S) in MSBs.
operations
SAR Used to shift bits of a byte/word towards the right and
copy the old MSB into the new MSB.
Computer System Architecture
4. String Instructions - String is a group of bytes/words and their memory is always allocated in
a sequential order.
Following is the list of instructions under this group –
Instruction Description
REP Used to repeat the given instruction till CX ≠ 0.
REPE/REPZ Used to repeat the given instruction until CX = 0 or zero flag ZF =
1.
REPNE/REPNZ Used to repeat the given instruction until CX = 0 or zero flag ZF =
1.
MOVS/MOVSB/MOV Used to move the byte/word from one string to another.
SW
COMS/COMPSB/CO Used to compare two string bytes/words.
MPSW
INS/INSB/INSW Used as an input string/byte/word from the I/O port to the provided
memory location.
OUTS/OUTSB/OUTS Used as an output string/byte/word from the provided memory
W location to the I/O port.
SCAS/SCASB/SCASW Used to scan a string and compare its byte with a byte in AL or
string word with a word in AX.
LODS/LODSB/LODS Used to store the string byte into AL or string word into AX.
W
5. Processor Control Instructions - These instructions are used to control the processor action
by setting/resetting the flag values.
Following are the instructions under this group –
Instruction Description
STC Used to set carry flag CF to 1
CLC Used to clear/reset carry flag CF to 0
CMC Used to put complement at the state of carry flag CF.
STD Used to set the direction flag DF to 1
CLD Used to clear/reset the direction flag DF to 0
STI Used to set the interrupt enable flag to 1, i.e., enable INTR input.
CLI Used to clear the interrupt enable flag to 0, i.e., disable INTR input.
Computer System Architecture
6. Iteration Control Instructions - These instructions are used to execute the given instructions
for number of times. Following is the list of instructions under this group –
Instruction Description
LOOP Used to loop a group of instructions until the condition satisfies, i.e., CX
=0
LOOPE/LOOPZ Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0
LOOPNE/LOOPNZ Used to loop a group of instructions till it satisfies ZF = 0 & CX = 0
JCXZ Used to jump to the provided address if CX = 0
8. Interrupt Instructions - These instructions are used to call the interrupt during program
execution.
Instruction Description
INT Used to interrupt the program during execution and calling service
specified.
INTO Used to interrupt the program during execution if OF = 1
Computer System Architecture
BASIC 8086/8088
Though the architecture and instruction set of both 8086 and 8088 processors are same, still there
are differences between them.
Following is the table listing the differences between the 2 microprocessors:
S.
NO. 8086 MICROPROCESSOR 8088 MICROPROCESSOR
It has 3 available clock speeds (5 MHz, 8 It has 3 available clock speeds (5 MHz, 8
2 MHz (8086-2) and 10 MHz (8086-1)). MHz)
5 It has Bank High Enable (BHE) signal. It has Status Signal (SSO).
It can read or write either 8-bit or 16-bit It can read only 8-bit word at the same
6 word at the same time. time.