Ec2002 8085 L2,3,4
Ec2002 8085 L2,3,4
Ec2002 8085 L2,3,4
8085 Microprocessors
Opcode fetch 0 1 1 𝑅𝐷 = 0
Memory read 0 1 0 𝑅𝐷 = 0
Memory write 0 0 1 𝑊𝑅 = 0
I/O read 1 1 0 𝑅𝐷 = 0
I/O write 1 0 1 𝑊𝑅 = 0
Courtesy: https://www.bing.com/images/
Microprocessor Operations
• Timing Diagram
Courtesy: https://www.bing.com/images/
Microprocessor Operations
• Timing Diagram
Courtesy: https://www.bing.com/images/
8085: Assembly Language
• Instruction
An instruction is a command /order given to the
microprocessor to perform a specified operation on given data.
• Mnemonic
Two/Three or Four letter English like short word to represent
an instruction in ALP.
• Opcode
Operation CODE is a first part of the instruction in the 8-bit
binary format that specify the task to be performed by the
instruction to the microprocessor.
• Operand
It is the data on which a particular operation is to be performed. It
can be in the form of 8/16-bit data, register, memory location, etc.
8085: Assembly Language
• Instruction Set
Collection of the instructions that the microprocessor
is designed to execute.
Increment/Decrement
The 8/16-bit contents of a register or a memory can be incremented
or decremented by 1.
All flags are affected. But in INR/DCR carry flag is not affected.
In 16bit operations (DAD) only carry flag is affected.
Logical Operation Group
Instructions of this group performs logical operations
with the contents of the accumulator.
AND/OR/Ex-OR
Any logic operation can be performed on any 8-bit number or the contents of a register
or memory with the contents of the Accumulator. The result is stored in the Accumulator.
Rotate
Each bit in the accumulator can be shifted left or right to next position.
Complement
The contents of the accumulator can be complemented.
Compare
Any 8-bit number or the contents of a register or memory can be compared for equality,
greater than, or less than, with the contents of the Accumulator.
Call/Return/Restart
These instructions change the sequence of a program either by
calling a subroutine or returning from it with/without any condition.
Direct Addressing
Register Addressing
Immediate Addressing
Implicit Addressing
8085 Instruction Set
Data Transfer Group
MOV Rd, Rs
It Copies the contents of the source register into the destination register. If one of
the operands is a memory location, it is specified by the contents of HL registers.
MVI R, data
8-bit data is stored in the register or memory (specified by HL pair).
To
STA addr Accumulator Memory
LDAX(STAX) Rp
The contents of a memory location, specified by a register pair in the operand
(BC or DE), are loaded (copied) to the accumulator/vice-versa for STAX.
D E Address Data To
Accumulator
12 50 1250 25
1251 6A
1252 0D
8085 Instruction Set
Data Transfer Group
LHLD(SHLD) addr
The instruction copies the contents of the memory location pointed out by the 16-
bit address is register L and copies the contents of the next memory location in
the register H.
H L
05 10 Address Data
LHLD 1250
1250 25
6A 25 1251 6A
1252 0D
8085 Instruction Set
Data Transfer Group
To
In addr (8-bit) I/O Port Accumulator
The contents of the input port designated in the operand (addr) are read and
loaded into the accumulator.
To
Out addr (8-bit) Accumulator Output Port
The contents of the accumulator are copied into the output port specified by the
operand (8 bit address).
OUT 01
Accumulator Port A
To 01H
1E
Port B
11H
8085 Instruction Set
Arithmetic Operation Group
ADD R
The contents of the operand (register or memory) are added to the contents of
the accumulator and the result is stored in the accumulator.
ADC R
The contents of the operand (register or memory) and the Carry flag are added
to the contents of the accumulator and the result is stored in the accumulator.
The contents of the operand are not altered; but, the previous CY flag is reset.
Accumulator B Carry Flag
05 10 1 + 00000101 + 00010000 = 00010110
ADC B
16 10 0 + 00010110 + 00010000 = 00100110
ADC B
26 10 0
8085 Instruction Set
Arithmetic Operation Group
SUB R
The contents of the operand (register or memory) are subtracted from the
contents of the accumulator and the result is stored in the accumulator.
SBB R
The contents of the operand (register or memory) and the Borrow flag are
subtracted from the contents of the accumulator and the result is stored in the
accumulator. The previous Borrow flag is reset.
Accumulator D Borrow Flag
15 10 -1 + 00010101 - 00010000 = 00010110
SBB D
04 10 -0 + 00000100 - 00010000 = 11110100
SBB D
F4 10 1
8085 Instruction Set
Arithmetic Operation Group
ADI/SUI data
The 8-bit data (operand) are added/subtracted to/from the content of the
accumulator and the result is stored in the accumulator.
ACI/SBI data
The 8-bit data (operand) and the Carry/Borrow flag are added/Subtracted to the
contents of the accumulator and the result is stored in the accumulator. The
contents of the operand are not altered; but, the previous CY flag is reset.
Accumulator Carry Flag
15 1 00010101 + 00000100 = 00011001
ACI 04H
1A 0 00011001 - 00000010 = 00010111
SUI 02H
18 0
8085 Instruction Set
Arithmetic Operation Group
INR/DCR R
The contents of the designated register/memory are incremented/decremented by
1 and the results are store in the same place. All but carry flag are affected.
INX/DCX Rp
The contents of the designated register pair are incremented/decremented by 1
and the results are store in the same place. Contents of two registers are treated
as a 16-bit number.
B C Carry Flag
15 FE 1
INR C
15 FF 1
INX B
16 00 1
Flags are not affected
8085 Instruction Set
Arithmetic Operation Group
DAD Rp
The 16-bit contents of the designated register pair are added to the contents of the
HL register and the sum is stored in the HL register. Only carry flag is affected.
H L B C Carry Flag
15 02 + 03 13 1
DAD B
18 15 03 A2 0
ANI/ORI/XRI data
The contents of the accumulator are logically AND/OR/Ex-ORed with the 8-bit data
(operand), and the result is placed in the accumulator.
A C S Z AC P CY
15 76 1 1 1 1 1
ANA C
14 76 0 0 1 1 0
ORI 1FH
1F 76 0 0 0 0 0
8085 Instruction Set
Logic Operation Group
CMP R / CPI data
The contents of the operand (register/memory or immediate data) are compared
with the contents of the accumulator. Both contents are preserved and the
comparison is shown by setting the flags as follows:
❖ If (A) < (Reg/Mem): Carry flag is set and Zero flag is reset.
❖ If (A) = (Reg/Mem): Carry flag is reset and Zero flag is set.
❖ If (A) > (Reg/Mem): Both Carry flag and Zero flag are reset.
A C S Z AC P CY
11 08 1 1 1 1 1
CMP C
11 08 0 0 1 1 0
CPI 1FH
11 08 1 0 1 0 1
8085 Instruction Set
Branch Control Group
Jump
The program sequence is transferred to the memory location specified by the 16-bit
address. The second byte specifies low order byte and third byte specifies the high
order byte of address. Following jump instructions are available in 8085:
❖ JMP addr: Unconditional Jump to the address.
❖ JC addr: Jump on Carry
❖ JNC addr: Jump on No Carry
❖ JZ addr: Jump on Zero
❖ JNZ addr: Jump on No Zero
❖ JP addr: Jump on Positive
❖ JM addr: Jump on Minus
❖ JPE addr: Jump on Even Parity
❖ JPO addr: Jump on Odd Parity
8085 Instruction Set
Branch Control Group
Call/Return
The program sequence is transferred to the memory location specified by the 16-bit
address. Before the transfer, the address of the next instruction to CALL is pushed
on the stack. During return two top bytes of the stack are copied into the program
counter. Following Call instructions are available in 8085:
❖ CMP addr: Unconditional Call to the address.
❖ CC addr: Call on Carry
❖ CNC addr: Call on No Carry
❖ CZ addr: Call on Zero
❖ CNZ addr: Call on No Zero
❖ CP addr: Call on Positive
❖ CM addr: Call on Minus
❖ CPE addr: Call on Even Parity
❖ CPO addr: Call on Odd Parity
8085 Instruction Set
Branch Control Group
PCHL
The contents of registers H & L are copied into the program counter. The contents
of H are placed as a high-order byte and of L as a low-order byte. This is one byte
instruction however its only machine cycle has six T-states.
This is also like Unconditional Jump instruction that change the sequence of the
program by simply loading PC with contents of HL.
H L Program Counter
21 30 2006
PCHL
21 30 2130
8085 Instruction Set
Machine Control Group
PUSH/POP Rp
The contents of the register pair designated in the operand are copied into the stack
in the following sequence. The stack pointer register is decremented and the
contents of the high-order register are copied into that location. The stack pointer
register is decremented again and the contents of the low-order register are copied
to that location.