Académique Documents
Professionnel Documents
Culture Documents
As the name suggests, it performs arithmetic and logical operations like Addition, Subtraction, AND,
OR, etc. on 8-bit data. It includes the accumulator, the temporary register, the ALU circuits & five flags.
The temp register is used to hold data during an arithmetic and logical operation. The result is stored in
the accumulator and the flags are set or reset according to the result of the operation.
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. The programmer can use these registers to copy or store data into the register by using data
copy instructions.
Program counter
It is a 16-bit register used to store the memory address location of the next instruction to be fetched.
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 fetched and executed.
Stack pointer
It is also a 16-bit register works like stack, which is always incremented/decremented by 2 during push
& pop operations. It points to the top of the stack. The beginning of the stack is defined by loading a 16
bit address in the stack pointer.
Temporary register
2 additional registers, W and Z are included in the register array. These registers are used to hold 8 bit
data during the execution of some instructions. They are not available to the programmer.
Flag register
It is an 8 bit register. It consists of 5 flip flops which changes its status according to the result stored in
an accumulator. 3 bits are not used. It is also known as status register. It is connected to the ALU.
The five flag bits are: Sign(S), zero (z), Auxiliary carry (AC), Parity (P), Carry(C)
The bit position of the flip flop in flag register is:
S . I N
OTE
D7 D6 D5 D4 D3 D2 D1 D0
S Z
K T U N x AC x P x CY
Sign flag (S) - This flag is used with signed numbers. If D7 of the result in accumulator is 1 then sign
flag is set otherwise reset. As we know that a number on the D7 always decides the sign of the number.
If D7 is 1: the number is negative and if D7 is 0: the number is positive. It is irrelevant for operations of
unsigned numbers.
Zero flag (Z) - If the result stored in an accumulator is zero then this flip flop is set otherwise it is reset.
Auxiliary Carry (AC) - If any carry goes from D3 to D4 in the output then it is set otherwise it is
reset. Significant in BCD addition and subtraction
Parity flag (P) - If the no of 1's is even in the output stored in the accumulator then it is set otherwise it
is reset for the odd.
Carry flag (C) - If the result stored in an accumulator generates a carry from D7 in its final output then
it is set otherwise it is reset.
Instruction register and decoder
It is an 8-bit register. When an instruction is fetched from memory, it is loaded in the Instruction
register. Instruction decoder decodes the information present in the Instruction register. The instruction
register not programmable and cannot be accessed through any instruction.
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 −
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, and TRAP.
It controls the serial data communication by using these two instructions: SID (Serial input data) and
SOD (Serial output data).
S . I N
OTE
Address buffer and address-data buffer
T U N
The content stored in the stack pointer and program counter is loaded into the address buffer and
K
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.
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.
S . I N
T U N OTE
K
T U N OTE
The above figure shows the logic pinout of the 8085 microprocessor. All the signals can be
K
classified into 6 groups. (1)Address bus (2) Data bus (3) Control and status signals (4) power supply
and frequency signals (5) Externally initiated signals and (6) Serial I/O ports
Status Signals
1. IO/ Ḿ - Select memory or an IO device. This 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 and goes low for memory operations.
2. S1, S0 -It is used to know the type of current operation of the microprocessor.
IO/ S1 S0 OPERATION
Ḿ
0 1 1 Opcode fetch
0 1 0 Memory read
0 0 1 Memory write
1 1 0 I/O read
1 0 1 I/O write
1 1 1 Interrupt acknowledge
Z 0 1 Halt
Z x x Hold
Z x x Reset
. I N
X1, X2: Crystal or R/C network or LC network connections to set the frequency of internal
S
U OTE
clock generator. The frequency is internally divided by two. Since the basic operating timing
N
frequency is 3 MHz, a 6 MHz crystal is connected externally.
T
K
CLK (output)-Clock Output is used as the system clock for peripherals and devices interfaced
with the microprocessor.
1. HOLD signal is generated by the DMA controller circuit which request the control of system
bus.
2. HLDA (Hold Acknowledge): On receipt of the HOLD signal, the microprocessor
acknowledges the request by sending out HLDA signal and leaves out the control of the buses.
After getting the HLDA signal the DMA controller starts the direct transfer of data.
READY (input): Memory and I/O devices will have slower response compared to
microprocessors. Ready input indicates that whether the memory or IO device is ready for a data
transfer. 1 indicates memory or IO device is ready for a data transfer and 0 indicate that they are
not ready. The microprocessor enters into WAIT state while the READY pin is 0.
Rest∈¿
´¿ : This signal is used to reset the microprocessor. The program counter (PC) inside the
Serial Input Output Control signals- There are two pins in this unit. Used for serial data
communication.
1. SID (input) - Serial input data line
2. SOD (output) - Serial output data line
S . I N
Instruction Set 8085
T U N OTE
K
Data Transfer Instructions
Opcode Operand Explanation of Description
Instruction
MVI Rd, data Move The source is always an 8-bit data. Destination can be a
MVI M, data immediate 8-bit register or memory. If the operand is a memory location,
data to the its location is specified by the contents of the HL registers.
destination Example: MVI B, 57H ; B←57
specified MVI M, 57H ; (HL)←57
(HL) = memory location pointed by HL register pair
inside the 16 bit accumulator. The contents of the source are not altered.
address location Example: LDA 2034H ; A← (2034)
LDAX Reg. pair Load The contents of the memory location pointed by
LDAX B accumulator designated register pair is copied into the accumulator.
LDAX D with data from The contents of either the register pair or the memory
the memory location are not altered.
location pointed Eg: LDAX B ; A←(BC)
by register pair.
LXI Reg. pair, 16-bit data Load register The instruction loads 16-bit data in the register pair
pair with designated in the operand.
immediate data Example: LXI H, 2034H ; H=20h L=34h
LHLD 16-bit address Load H and L The instruction copies the contents of the memory
registers with location pointed out by the 16-bit address into register L
content of the and copies the contents of the next memory location into
memory register H.
location Example: LHLD 2040H
L= content of the memory location 2040h
H= content of the memory location 2041h
T U N memory OTE
content of A in memory location specified by the operand. This is a 3-
byte instruction, the second byte specifies the low-order
K location given
by 16-bit
address
address and the third byte specifies the high-order address.
Eg: STA 4350H
STAX Reg. pair Store The contents of the accumulator are copied into the
accumulator in memory location specified by the contents of the operand
the memory (register pair). The contents of the accumulator are not
location pointed altered.
by reg pair Example: STAX B
(indirect)
SHLD 16-bit address Store H and L The contents of register L are stored into the memory
registers to the location specified by the 16-bit address in the operand and
memory the contents of H register are stored into the next memory
location whose location by incrementing the operand. The contents of
address is registers HL are not altered. Example: SHLD 2470H
specified
directly
XCHG - Exchange the The contents of register H are exchanged with the contents
(no operand) content of H of register D, and the contents of register L are exchanged
and L with D with the contents of register E.
and E Example: XCHG
SPHL - Copy H and L The instruction loads the contents of the H and L registers
(no operand) registers to the into the stack pointer register, the contents of the H
stack pointer register provide the high-order address and the contents of
the L register provide the low-order address. The contents
of the Hand L registers are not altered. Example: SPHL
XTHL - Exchange H and The contents of the L register are exchanged with the
(no operand) L with top of stack location pointed out by the contents of the stack
stack pointer register. The contents of the H register are
exchanged with the next stack location (SP+1); however,
the contents of the stack pointer register are not altered.
Example: XTHL
PUSH Reg. pair Push register The contents of the register pair designated in the operand
pair onto stack are copied onto the stack in the following sequence. The
stack pointer register is decremented and the contents of
the higher order register (B, D, H, A) are copied into that
location. The stack pointer register is decremented again
and the contents of the low-order register (C, E, L, flag
reg) are copied to that location.
Example: PUSH B or PUSH A
S . N
The contents of the memory location pointed by the stack
I
OTE
register pair pointer register are copied to the low-order register (C, E,
L, flag reg) of the operand. The stack pointer is
OUT 8-bit port address Output data The contents of the accumulator are write to the output
from port designated in the operand (8 bit address port)
accumulator to Example: OUT 80H
a port with 8-bit
address
IN 8-bit port address Input data to The contents of the input port designated in the operand
accumulator are read and loaded into the accumulator.
from a port with Example: IN 8CH
8-bit address
Arithmetic Instructions
Opcod Operand Explanation of Description
e Instruction
ADD R Add register or The contents of the operand (register or memory) are added
ADD M memory, to to the contents of the accumulator and the result is stored in
accumulator the accumulator. If the operand is a memory location, its
ADC R Add register to The contents of the operand (register or memory) and the
ADC M accumulator with Carry flag are added to the contents of the accumulator and
carry the result is stored in the accumulator. If the operand is a
memory location, its location is specified by the contents of
the HL registers. All flags are modified to reflect the result
of the addition. Eg: ADC B or ADC M
ADI 8-bit data Add immediate to The 8-bit data (operand) is added to the contents of the
accumulator accumulator and the result is stored in the accumulator. All
flags are modified to reflect the result of the addition.
Example: ADI 45H
ACI 8-bit data Add immediate to The 8-bit data (operand) and the Carry flag are added to the
accumulator with contents of the accumulator and the result is stored in the
carry accumulator. All flags are modified to reflect the result of
S . I N
the addition. Eg: ACI 45H
T U OTE
The 16-bit contents of the specified register pair are added
K
to H and L
registers
to the contents of the HL register and the sum is stored in
the HL register. The contents of the source register pair are
not altered. If the result is larger than 16 bits, the CY flag is
set. No other flags are affected. Eg: DAD H
SUB R Subtract register The contents of the operand (register or memory) are
M or memory from subtracted from the contents of the accumulator, and the
accumulator result is stored in the accumulator. If the operand is a
memory location, its location is specified by the contents of
the HL registers. All flags are modified to reflect the result
of the subtraction. Eg: SUB B or SUB M
SBB R Subtract source The contents of the operand (register or memory) and the
M and borrow from Borrow flag are subtracted from the contents of the
accumulator accumulator and the result is placed in the accumulator. If
the operand is a memory location, its location is specified
by the contents of the HL registers. Flags are modified to
reflect the result of the subtraction. Eg: SBB B or SBB M
SUI 8-bit data Subtract The 8-bit data (operand) is subtracted from the contents of
immediate from the accumulator and the result is stored in the accumulator.
accumulator All flags are modified to reflect the result of the subtraction.
Example: SUI 45H
SBI 8-bit data Subtract The 8-bit data (operand) and the borrow flag are subtracted
immediate from from the contents of the accumulator and the result is stored
accumulator with in the accumulator. All flags are modified to reflect the
borrow result of the addition. Eg: SBI 45H
INX R Increment The contents of the designated register pair are incremented
register pair by 1 by 1 and the result is stored in the same place.
Example: INX H
DCX R Decrement
. I N
The contents of the designated register pair are decremented
S
OTE
register pair by 1 by 1 and the result is stored in the same place.
DAA none K T U N
Decimal adjust
Example: DCX H
Logical instructions
Opcod Operand Explanation of Description
e Instruction
CMP R Compare register The contents of the operand (register or memory) are
M or memory with subtracted from the contents of the accumulator. But both
accumulator contents are preserved. The result of the comparison is
shown by setting the flags of the PSW as follows:
if (A) < (reg/mem): carry flag is set
if (A) = (reg/mem): zero flag is set
if (A) > (reg/mem): carry and zero flags are reset
Example: CMP B or CMP M
CPI 8-bit data Compare The second byte (8-bit data) is compared with the contents
immediate with of the accumulator. The values being compared remain
accumulator unchanged. The result of the comparison is shown by setting
the flags of the PSW as follows:
if (A) < data: carry flag is set
if (A) = data: zero flag is set
if (A) > data: carry and zero flags are reset
Example: CPI 89H
ANA R Logical AND The contents of the accumulator are logically ANDed with
M register or M the contents of the operand (register or memory), and the
memory with result is placed in the accumulator. If the operand is a
accumulator memory location, its address is specified by the contents of
HL registers. S, Z, P are modified to reflect the result of the
operation. CY is reset. AC is set.
Example: ANA B or ANA M
ANI 8-bit Logical AND The contents of the accumulator are logically ANDed with
data immediate with the
accumulator 8-bit data (operand) and the result is placed in the
S . I N
accumulator. S, Z, P are modified to reflect the result of the
OTE
operation. CY is reset. AC is set.
Example: ANI 86H
XRA R
K T U N
Exclusive OR The contents of the accumulator are Exclusive ORed with M
M register or the contents of the operand (register or memory), and the
memory with result is placed in the accumulator. If the operand is a
accumulator memory location, its address is specified by the contents of
HL registers. S, Z, P are modified to reflect the result of the
operation. CY and AC are reset.
Example: XRA B or XRA M
XRI 8-bit Exclusive OR The contents of the accumulator are Exclusive ORed with
data immediate with the 8-bit data (operand) and the result is placed in the
accumulator accumulator. S, Z, P are modified to reflect the result of the
operation. CY and AC are reset.
Example: XRI 86H
ORA R Logical OR The contents of the accumulator are logically ORed with M
M register or the contents of the operand (register or memory), and the
memory with result is placed in the accumulator. If the operand is a
accumulator memory location, its address is specified by the contents of
HL registers. S, Z, P are modified to reflect the result of the
operation. CY and AC are reset.
Example: ORA B or ORA M
ORI 8-bit Logical OR The contents of the accumulator are logically ORed with the
data immediate with 8-bit data (operand) and the result is placed in the
accumulator accumulator. S, Z, P are modified to reflect the result of the
operation. CY and AC are reset. Example: ORI 86H
RLC - Rotate Each binary bit of the accumulator is rotated left by one
(no accumulator left position. Bit D7 is placed in the position of D0 as well as in
operand) the Carry flag. CY is modified according to bit D7 but CY is
not rotated. S, Z, P, AC are not affected.
RRC - Rotate Each binary bit of the accumulator is rotated right by one
(no accumulator right position. Bit D0 is placed in the position of D7 as well as in
operand) the Carry flag. CY is modified according to bit D0 but CY is
not rotated. S, Z, P, AC are not affected.
RAL - Rotate Each binary bit of the accumulator is rotated left by one
(no accumulator left position through the Carry flag. Bit D7 is placed in the
operand) through carry Carry flag, and the Carry flag is placed in the least
significant position D0. CY is modified according to bit D7.
S, Z, P, AC are not affected.
RAR - Rotate
. I N
Each binary bit of the accumulator is rotated right by one
S
OTE
(no accumulator right position through the Carry flag. Bit D0 is placed in the
operand)
K T U N
through carry Carry flag, and the Carry flag is placed in the most
significant position D7. CY is modified according to bit D0.
S, Z, P, AC are not affected.
CMC - Complement carry The Carry flag is complemented. No other flags are affected.
(no
operand)
Branching instructions
Opcode Operand Explanation of Description
Instruction
Conditional jumps
RET none Return from The program sequence is transferred from the subroutine to
subroutine
S I N
the calling program. The two bytes from the top of the stack
.
OTE
unconditionally are copied into the program counter, and program execution
K T
Conditional subroutine call U N begins at the new address. Example: RET
PCHL none Load program The contents of registers H and L are copied into the
counter with HL program counter. The contents of H are placed as the high-
contents order byte and the contents of L as the low-order byte.
Example: PCHL
T U N
Instruction OTE Description
NOP none
K No operation No operation is performed. The instruction is fetched and
decoded. However no operation is executed. Example: NOP
HLT none Halt and enter wait The CPU finishes executing the current instruction and halts
state any further execution. An interrupt or reset is necessary to
exit from the halt state. Example: HLT
DI none Disable interrupts The interrupt enable flip-flop is reset and all the interrupts
except the TRAP are disabled. No flags are affected. Eg: DI
EI none Enable interrupts The interrupt enable flip-flop is set and all interrupts are
enabled. No flags are affected. After a system reset or the
acknowledgement of an interrupt, the interrupt enable flip
flop is reset, thus disabling the interrupts. This instruction is
necessary to re enable the interrupts (except
TRAP).Example: EI
RIM none Read interrupt mask This is a multipurpose instruction used to read the status of
interrupts 7.5, 6.5, 5.5 and to input serial data through the
SID line. Example: RIM
SIM none Set interrupt mask This is a multipurpose instruction and used to implement the
8085 interrupts 7.5, 6.5, 5.5, and to output data serially from
the SOD line. Example: SIM
S . I N
T U N OTE
K