0% found this document useful (0 votes)
18 views

8085 Instruction Set

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

8085 Instruction Set

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

,, .

~ \

-"\_-. l
. -,'t--
t...:.i '

J
8085 INSTRUCTION SET
INSTRUCTION DETAILS
DATA TRANSFER INSTRUCTIONS

.Opcode Operand '


Description
Copy from source to destination
MOY Rd;Rs This instruction copies the contents of the source
\ M,Rs register ii:tto the destipation register; the contents of
Rd,M the source register are not altered. If one of the operands is a
memory location, its location is specified by the contents of
the HL regis_ters:
Example: MOY B, C or MOY B, M
1\1ove immediate 8-bit
MVI Rd, data The 8-bit data is stored in the destination register or
M, data memory. If the operand is a memory location, its location is
specified py- the contents of the HL registers.
Example: MVI B, 57_,cir MVI M, 57
Load accumulator
LOA . . 16-bit address The.contents of a memory location, specified by a .
· 16-bit address in the operand, are copied to the accumulator.
The cqntents of the source are not altered.
Example: LOA 2034 or.LOA XYZ
/ Loaq accumulator indirect
LDAX BID Reg. pair . The contents ofthe' designated register pair point to a memory
)oc,ation. This instruction copies· the contents of that memory
. . location °into tlie accumulator. The contents of either the
register parr or the ~emory location are not altered.
J;:xample:" LDAX B

Load register pair immediate


LXI . Reg. pair, 16-bit data The instruction loads 16-bit data m the register parr
designated in the operand.
Example: LXI H, 2034

Load H and L registers direct


LfilD _16-bit address The · instruction copies the contents of the memory location
pointed out by the -16-bit address into register L and copies
I
'( the contents of the next memory location into register H. The
contents of source memory locations are not altered.
Example: LHLD 2040

8085 Instruction Set Page 1


'

Store accumulator direct


ST A 16-bit address The contents of the accumulator are copied
into the memory
location specified by the · operand. This
is a 3-byte
instruction, the second byte specifies the low
-order address
and the third byte specifies the high-order addr
ess.
Example: STA 4350 or ST A XYZ

Store accumulator indirect


ST AX Reg. pair The contents of the accumulator are copied
into the memory
location specified by the contents of ·the
operand (register
pair). The contents of the accumulator are not
altered.
Example: STAX B
Store H and L registers direct
SHLD 16-bit address The contents of register L are stored into the
memory location
specified by the 16-bit address in the operand
and the contents
of H register are stored into the next mem
ory location by
incrementing the operand. The contents of
registers HL are
not altered. This is a 3-byte instruction,
the second byte
specifies the low-order address and the third
byte specifies the
high-order address.
Exa~ple: SHLD 2470
Exchange H and L with D and E
XCHG none The contents of register H are exchanged with
the contents of
register D, and the contents of register L are
exchanged with
the contents of register E.
Example: XCHG
1 Copy H and L registers to the stack pointer
· :
SPHL none The instruction.loads the contents of the
H and L registers
into the stack pointer register, the contents
of the H register
provide· the high-order address and the con
tents of the L
register provide the low-order address. The
contents of the H
and L registers are not altered.
Example: SPHL
Exchange H and L with top of stack_
XTHL none The contents of the L register are exchang
ed with the stack
location pointed out by the contents of
the 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

8085 Instruction Set Page2


.I
i
I

Push register pair onto stack


PUSH Reg. pair The contents of the register pair designated in the operand are
copied onto the stack in the following sequence. The stack
pointer register is decremented and the contents of the high-
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, flags) are copied to that
location.
Example: PUSH B or PUSH A

Pop off stack to register pair


POP Reg. pair The·contents of the memory location pointed out by the stack
pointer register are copied to the low-order register (C, E, L,
status flags) of the operand. The stack pointer is incremented
by 1 and the contents of that memory location are copied to
the high-order register (B, D, H, A) of the operand. The stack
pointer register is again incremented by 1.
Example:. POP Hor POP A

Output data from accumulator to a port with 8-bit address


OUT 8-bit port address The contents of the accumulator are copied into the 1/0 port
specified by the operand.
Example: OUT 87

Input data to accumulator from a port with 8-bit'address


IN 8-bit port address The contents of the input port designated in the operand are
read and loaded into the accumulator.
Example: IN 82

8085 Instruction Set Page3


AR I~T IC INSTRUCTIONS
/
0 pcode Operand Description
Add register or me~ory to accumulator
ADD ·
R' The contents of the operand (register or memory)
M are .
added to the contents of the accumulator and
the result 1s
stored in the accumulator. lf 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.
Example: ADD B or ADD M

Add register to accumulator with carry


ADC R The contents of the operand (register or memory)
M and
the Carry flag are added to the contents of the
accumulator
and the result i's stored in the accumulator. If the
operand is a
rpemory location, its location is specified by the
contents of
the HL registers. All flags are modified to reflect
the result of
the addition.
Example: ADC B or ADC M

Add immediate to accumulator


ADI 8-bit data The 8-bit data ( operand) is added to the conte
nts of the
accumulator and the result is stored in the accum
ulator. All
flags are modified to reflect the result of the addit
ion.
Example: ADI 45
Add immediate to accumulator with carry
ACI 8-bit data The 8-bit data (operand) and the Carry flag are
added to the
contents of the accumulator and the result is
stored in the
accumulator. All flags are modified to reflect the
result of the
addition.
Example: ACI 45

Add register pair to H and L registers


DAD Reg. pair The 16-bit contents of the specified register pair
are added 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.
Example: DAD H

8085 Instruction Set Page 4


Subtract register or memory from accumulator
SUB R The contents of the operand (register or memory) are
M subtracted from the contents of the accumulator, and 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 subtraction.
Example: SUB B or SUB M

Subtract source and borrow from accumulator


SBB R The contents of the operand (register or memory) and
M the Borrow flag are subtracted from the contents of the
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. All flags are modified to
reflect the result of the subtraction.
Example: SBB B or SBB M

Subtract immediate from accumulator


SUI 8-bit data The 8-bit data (operand) is subtracted from the contents of the
accumulator and the result is stored in the accumulator. All
flags are modified to reflect the result of the subtraction.
Example: SUI 45

Subtract immediate from accumulator with borrow


SBI 8-bit data The 8-bitdata (operand) and the Borrow flag are subtracted
from the contents of the accumulator and the result is stored
in the accumulator. All flags are modified to reflect the result
of the subtracion.
Example: SBI, 45

Increment register or memory by I _,,


INR R The contents of the designated register or memory) are
M incremented by I and the result is stored in the same place. If
the operand is a memory location, its location is specified by
the contents of the HL registers.
Example: INR B or INR M

Increment register pair by I


INX R The contents of the designated register pair are incremented
by 1 and the result is stored in the same place.
Example: INX H

8085 Instruction Set Page 5 .


E ► '
.'I

I •

Decrement register or memory by l


DCR R The contents of the designated register or _memory are
M decremented by 1 and the result is stored m_the _same p_Iace. If
the operand is ~ memory ~ocation, its location is specified by
the contents of the HL registers.
Example: DCR B or DCR M
Decrement register pair by 1
DCX R
The contents of the designated register pair are decremented
by 1 and the result is stored in the same place. '
Example: DCX H
Decimal adjust accumulator
DAA none
The contents of the accumulator are changed from a binary
value to two 4-bit binary coded decimal (BCD) digits. This is
the only instruction that uses the auxiliary flag to perfonn the
binary to BCD conversion, and. the conversion procedure is
described below. S, Z, AC, P, CY flags are altered to reflect
the results of the operation.

If the value of the low-order 4-bits in the accumulator is


greater than 9 or if AC flag is set, the instruction adds 6 to the
low-order four bits.

If the value of the high-order 4-bits in the accumulator is


greater ~an 9_or if the Carry flag is set, the instruction adds 6
to the high-order four bits.
example: DAA

f
I
·'
BRANCHING INSTRUCTIONS

Opcode Operand Description

Jump unconditionally
JMP 16-bit address The program sequence is transferred to the memory location
specified by the 16-bit address given in the operand.
Example: JMP 2034 or JMP XYZ

Jump conditionally

Operand: 16-bit address

The program sequence is transferred to the memory location


specified by the 16-bit address given in the operand based on
the specified flag of the PSW as described below.
Example: JZ 2034 or JZ XYZ

Opcode Descrjption Flag Status


JC Jump on Carry CY= l
JNC Jump on no Carry CY=0
JP Jump on positive S=0
JM Jump on minus S=I
JZ Jump on zero Z=l
JNZ Jump on no zero Z=0
JPE Jump on parity even P=l
JPO Jump on parity odd P=0

8085 Instruction Set Page 7

d
I

Unconditional subroutine caII


CALL I6-bit address The program sequence is transferred to the memory location
specified by the 16-bit address given in the operand. Before
the transfer, the address of the next instruction after CALL
(the contents of the program counter) is pushed onto the stack.
Example: CALL 2034 or CALL XYZ
Call conditionally

Operand: 16-bit address

The program sequence is transferred to the memory location


spec1fie~ by the 16-bit address given in the operand based on
the specified flag of the PSW as described below. Before· the
transfer, the address of the next instruction after the call (the
contents of the program counter) is pushed onto the stack
Example: CZ 2034 or CZ XYZ .
Opcode Description
cc Call on Carry
· Flag Status
CNC CY== I
Call on no Carry
CP CY ==0
Call on positive S ==0
CM Call on minus
CZ S == I
Call on zero
CNZ Z == I
CPE Call on no zero /

Call on parity even Z::'0 /

CPO p == I
Call on parity odd p == 0

8085 Instruction Set


Page 8

L_
Return from subroutine unconditionallY
RET none The program sequence is cransferred from the subroutine 10
the calling program. The t\vo byres from the top of the stack
are copied into the program counter, and program execution
begins at the new address.
Example: RET

Rerurn from subroutine conditionally

()per.met none

The program sequence is transferred from the subroutine to


the calling program based on the specified flag of the PSW as
described below. The two bytes from the top of the stack are
copied into the program counter, and program execution
begins at the new address.
Example: RZ

. Opcode Description Flag Status


RC Return on Carry CY= l
R.!'\SC Return on no Carry CY=O
RP Return on positive S=O
R.!\i Return on minus S=l
RL. R~~o nzer o Z= I
R.!"IZ Return on no r>-.ro Z=O
RPE Return on parity even P=I
RPO Return on parity odd P=O

8085 Instruction Set Page9

J
V ◄

Load program counter with HL con


PCHL tents
none The contents of registers H and L . .
are copied m~o the program
counter. The contents of H are pla
ced as the high-order b}'te
and the contents of L as the low-or
der byte.
Example: PCHL
Restart
RST 0-7
The RST instruction is equivalent
to a I-byte call instruction
to one of eight memory locations dep
ending upon the number.
The instructions are generally use
d in conjunction with
~nterrupts and inserted-using extern
al hardware. However
these can be used .as software ins
tructions in a program to
transfer program execution to one of
addresses are: the eight locations. The

Instruction Restart Address


RSTO
OOOOH
RSI 1
0008H
RST2
OOIOH
RST3
0018H
RST4
RST 5 0020H
RST6 0028H
RST7 0030H
0038H
The 8085 has four additio inte
generate RST instructions nal .
intemal~I~ts and these mte
any external hardware Th mz~ts
addresses are : . Y a~d thus do not reqwre
· ese mstructions and their Restart
Interrupt
TRAP Restart Address
RST 5.5 0024H
RST 6.5 002CH
RST 7.5 0034H
003CH .

8085 Instruction Set


Page IO
-
I
\ 1
I
.
·,
LOGICAL INSTRUCTIONS

Opcode Operand Description

Compare register or memory with accumulator


CMP R The contents Qf the operand (register or memory) are
M compared with the contents of the accumulator. Both
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, s=l
if (A)= (reg/:qiem): zero flag is set, s=O
>
if (A) (reg/mem): carry and.zero flags are reseJ, s=O
Example: CMP 13 or CMP M -

Compare immediate with accumulator .


CFI 8-bit data The second byte (8-bit data) is compared with the contents of
., the accumulator. The values being compared remain
unchanged. The result of ~e comparison is shown by setting
the flags of the PSW as follows:
if (A) < data: carry flag is set, s=1
if (A) = data: zer9 flag is se~ s=O
if (A) > data: carry and zero flags are reset, s=O
Example: CPI 89

Logical AND register or memory with accumulator


ANA R The contents of the accumulator are logically ANDed with
M the contents of the operand (register or memory), and the
result is placed in the accumulator. If the operand is a
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
-i
Logical AND immediate with accumulator
ANI 8-bit data The contents of the accumulator .are logically ANDed with the
8-bit data .(operand) and the ~esult is placed in the
accumulator. S, Z, Pare modified to reflect the result of the
operation. CY is reset AC is set
Example: ANI 86

C '

8085 Instruction Set Page 11


LOGICAL mSTRUCTIONS

Opcode Operand Description

Compare register or memory with accumulator ·


CMP R The contents qf the operand (register or memory) are
M compared with the contents of the accumulator. . Bot.h
contents are preserved . The result of the comparison 1s
shown by setting the flags of the PSW as follows:
if (A) < (reg/rnem): carry flag is set, $= 1
if (A) =Jreg/qiem): zero flag is set, s=0
if (A)> (reg/me~): carry at1d..zer~s are res~, s=0
Example: CMP B or CMP M

Compare immediate with accumulator


en 8-bit data The second byte (8-bit data) is compared with the contents of
the accumulator. The values being compared remain
unchanged. The result of t~e comparison is shown by setting
the flags of the PSW as follows:
if (A) < data: carry flag is se~, s= I
if (A) = data: zer9 flag is set, s=0
if (A) > data: carry and zero flags are reset, s=0
Example: CPI 89

Logical AND register or memory with accumulator


ANA R The contents of the accumulator are logically ANDed with
M the contents of the operand (register or memory), and the
result is placed in the accumulator. If the operand is a
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

Logical AND immediate with accumulator


ANI 8-bit data The contents of the accumulator are logically ANDed with the
8-bit data (operand) and the -i:esult is placed in the
accumulator. S, Z, P are modified to reflect the result of the
operation. CY is reset. AC is set.
Example: ANI 86

C I
Exclusive OR register or
XRA memory with accumulat
R or
The contents of the accu . .
M mulator are Exclusiv e ORed with
the contents of the op
erand (register or memo
result is placed in the ry), and the
accumulator. If the
memory location, its ad operand is a
dress is specified by the
HL registers. S, Z, P are contents of
modified to reflect the
operation. CY and AC res ult of the
are reset.
Example : XRA B or XR
AM
Exclusive OR immedia
XRI te with accumulator
8-bit data
The contents of the accu
mulator are Exclusive OR
8-bit data (operand) ed with the
and the result is pla
accumulator. S, Z, P are ced in the
modified to reflect the
operation. CY and AC are result of the
reset.
Example: XRI 86
Logical OR register or
memory with accumulao
ORA R tr
The contents of the accu
M mulat
the contents of the opera or are logically ORed with
nd (register or memory)
result is placed i.n the , and the
accumulator. If the op
memory location, its ad erand is a
dress is specified by the
HL registers. S, Z, P are contents of
modified to reflect the
operation. CY and AC are result of the
reset.
Example : ORA B or OR
AM
Logical OR immediate
with accumulator
ORI 8-bit data
The contents of the accu
mulator are logically OR
8-bit data (operand) ed
and the result is pla with the
accumulator. S, Z, P are ced in the
mo
operation. CY and AC are dified to reflect the result of the
reset.
Example: ORI 86

Rotate accumulator left


RLC none
Each binary bit of the
accumulator is rotated
position. Bit D7 is place left by one
d in the position of Do
the Carry flag. CY is mo as well as in
dified according to bit D7
AC are not affected. . S, Z, P,
Example: RLC
Rotate accumulator right
RRC none Each binary bit of the
acc
position. Bit Do is place umulator is rotated right by one
d in the position of D7 as
the Carry flag. CY is mo well as in
dified according to bit Do
AC are not affected. . S, Z, P,
Example: RRC

8085 Instruction Set


Page 12

r
I

Rotate accumulator left through carry


RAL none Each binary bit of the accumulator is rotated left by one
position through the Carry flag. Bit D7 is placed in the Carry
flag, and the Carry flag is placed in the least significant
position Do. CY is modified according to bit D7. S, Z, P, AC
are not affected.
Example: RAL

Rotate accumulator right through carry


RAR none Each binary bit of the accumulator is rotated right by one
position through the Carry flag. Bit Do is placed in the Carry
flag, and the · Carry flag is placed in the most significant
position D7. CY is modified according to bit Do. S, Z, P, AC
are not affected.
Example: RAR

Complement accumulator
CMA none The contents of the accumulator are complemented. No flags
are affected.
Example: CMA

Complement carry
CMC none The Carry flag is complemented. No other flags are affected.
Example: CMC

Set Carry
STC none The Carry flag is set to I. No other flags are affected.
Example: STC

8085 Instruction Set Page 13

You might also like