Professional Documents
Culture Documents
8085 Instruction Set
8085 Instruction Set
| B
xx | 2052) >| = 2052 a
ra" 2 43 | 2053 a
Top of stack >| 43 | ane 7
Pot eac ode 3 Jas
oe
fChapter 2_ fnstruction S¢
et OF tay, |
i
2.28
(SP) (sP)+4
(SP) (sp) < (SP) +1
moved to the register pail. ‘After execution ofthis instruction the content o
The register pais can be BC, DE. HHLand PSW. Notas ae aft tg
a
*
47. POP rp (p< (SP)
‘Te content of op of stack memory iS
Pointer (SP) willbe 02 arate than the ear valu
fprgram Selus Word): AccurutorandFe0 register ere 10
register isa low order register)
The pop instruction is executed as folOWS:
(9 The content ofthe memory addressed by te SPis moved fo the low order. register
{iy Te content of th SP is inrerentd by one.
{i The content of the memory earessed by the SPis moved tothe high order register
{yy The content ofthe SPs incremented by one-
One byte instruction Three machine cycles: Opcode fetch - 4T
Register indirect addressing Memory read - ST
Memory read -_3T
107
ether called PSW. The accumulator is a high order register ang.
Total number of instructions = 4
POPPSW poPB = POPD.-—SsPOPH
Example: POPD €) <(P)
(SP) < (SP) +01
0) (SP)
(SP) < (SP) +01
() The content ofthe memory addressed by the SPis moved tothe E-regster
(The content ofthe SP i incremented by one.
(ii) The content of the memory addressed bj
y the SPs moved to the D-register
(v)_The content ofthe SP is incremented by one. .
Before execution After executi
xecution
‘Stack Memory
‘Stack Memory
D E SP OFF D E
2] Ga) Cony foclemtEe| Ce] Ge] Gee) fine
OFFF
1000
OFFF.
Top of stack 1000
5E
1001
E2 | 1001
1002
FE 1008 Top of stack} CO | 1002
1F | 1003.
(A)e (addr)
The content of the port is moved
to the
Aegis Th tit pr cess wegen nheinstucton, No fe 28
stack
3[8] #3]
Occupied
stack
18, IN addr
‘Two byte instruction
Wks elreitg Three machine cycles: Opcode fetch - 47
Memory read - ST
lOread +a.
107
Total number of instructions = 1{8085 Microprocessor and Its Applications
2.29
49, OUT addrB {addr8) <— (A)
The content of theA-registeris moved tothe port. The 8-bt port address willbe given in the instruction, No flags are affected.
Two bye instruction Three machine cycles: Opcode fetch - 4T
Direct addressing Memory read - 3T
lOwite — -_oT
107
Total number of instructions = 4
‘Note: In an 8085 procesorbased system when the 10 devices are mappedly 10 mapping han la Protaaar can
communicate with these IO devices only by using IN and OUT instructions, ‘The processor uses an 8-bit address to select
JO-mapped 10 devices With &-it address the processor can generate 2° 256,10 adahcse,
2.8 ARITHMETIC INSTRUCTIONS
1. ADD reg
(A) (A) + (reg)
The content ofthe register is added tothe content of the accumulator (Aregistey. Afler edition the result i stored in tha
‘accumulator All flags are affected. The register can be any one ofthe general purpose register A,B, C.D, E, Hor
Example : ADD E
(A)<— (A) + &)
The content of the E-register is added to the content of the,A-register
The result will be in the A-register. All flags are affected,
Before execution Addition After execution
A C2, = 1100 0010 E
c2] 7A BB
= BB, = 1011 1000 fl
PF 0
AF Sum = 0111 1010= is
ZF Cany=1 a
Mie (Addition is performed in ALU)
One byte instruction One machine cycle: Opcode fetch - 4T
Register addressing
Total number of instructions = 7
ADDA ADDB ADDC ADDD ADDE _—ADDH ADDL
2 ADIs (A) (A) + dB
The 8-bit data given in the instruction is added othe content of the A-reister (Accumulator). After adtion, the result is stored
‘in the accumulator, All flags are affected.
Two byte instruction Two machine cycles: Opcode fetch - 4T
Immediate addressing Memory read - z
Total number of instructions = 1
3% ADD M (Ac (A)+(M) or (A) (A) + (HL))
The content of memory addressed by HL.pai is edded (othe content of theAegiser. After addition, the result is stored
inthe A-register, All flags are affected.= Ne +H)
Example: ADD M aye (aye)
sxample
Abe 4, mn
a " a snaroy Iocation oa oe tte canentof here The result Pu ech ay,
re cab fter execution
focation Ct 7
The content of the memory eam ; —_
secution
al ‘44, = 0100 0100 a] a
A_ _HL_ Memory "i 04) lo,
4] [ooo] frafcooa) 7a, = o11t 00tt CF = Sone
CF = 0 [ra}coB oI O11 Bp ee aor loge
Pr = 0 [2140000 | on = B7 AF = 0
ee ZF = 0
ree (Addition is performed in ALU) SFI DH
SF = 0
Opcode fetch - 4T
(ne byte instruction Two machine cycles ove a
Register indirect addressing 7 x
Total number of instructions = 1
4 acids (A) < (A) + d8 + CF
The bt date given in the instruction and the cary lag (the value of carry flag before executing this instruction) are ads
{othe content ofthe A-regster (Accumulator). After addition, the result is stored in the accumulator All flags are affected.
Two byte instruction Two machine cycles : Opcode fetch - 4T
Immediate addressing Memory read - 3T
Total number of instructions = 1 =
H3085 Microprocessor and Its Applications 9557
One byte instruction
Register addressing
Total number of instructions = 7
ADCA ADCB ADCG ~— Adc
One machine cycle : Opcode fetch -4T
ADCE ADCH ADCL
6 | ADC M (A) CUA)+ (M+ CF or
(A) — (A)+ (HL) + CF
The content ofthe memory adaressed by the HL. pir and th oe
auded tothe content of register. fer adaton theres eto teh 9 batons oxeutg this instructonare
‘on, the result is stored in the A-register. All fags are affected,
‘One byte instruction ‘Two machine cycles: Opcodefetch - 47
Register inditect addressing Memory read - 37
7
Total number of instructions =
Fos en SUB 00 (A) < (A) ~ (reg)
The content ofthe register is subtracted from the content of the accumulator(A-register). After subtraction the result is
stored in the A-register. All flags are affected. The register can be any one of the general purpose registerA, B, C, D, E, Hor L.
Result =38,,
CF =0
Examp) SUB C () © (A)- (0)
The content of the C-register is subtracted fromA-register. The result will be in the A-register
Casei
Before execution Subtraction
C4, = 11000100
89,,= 1000 1001
1's complementof 89,,
2's complement of 89,
sort o111=77,
C4, =1100 0100
c 477, =0111 O11
£2, [a ]0011 1011
° convene’ 3B
o a
o
o
o
-—
ON
an
oa
Case li
Subtraction
Before execution
89,,= 1000 1001
64,,= 11000100
41's complement of C4,,= 0011 1011
2's complementof C4, =0011 1011 +1
=0011 1100=36,,Chapter 2_ Instruction Set Of yy,
Case Ii continued . ‘Subtraction
|
|
|
|
|
‘After exeeulon 89, = 1000 1001
A
cs] |= (ee +90,5:0011 1100
OF 1 [o]1100 0101
PE = 1 conpiemont TCS
cy ‘cary
a)
SF = 1 Result=C5,,
cF_st
foie: 2’s complement of C5, ~ 3By
i fon. But after subtraction, it will complement
Tote: The 8085 microprocessor performs 2's complement subtraction. But after subh
he carp alone. In 2s complement subtraction, if CF =1, then the result is positive and if CF =O, then the result
ements the carry after subtraction, here if CF = 0, then the results positive and
tive. Since, the 8085 processor compl raction, here if
ver 4; then te result is negative. Ifthe result i negative, then it will be in 2 complement form,
‘One machine cycle: Opcode fetch - 4T
One byte instruction
Register addressing
Total number of instructions = 7
suBA SUBB SUBC SUBD SUBE SUBH SUB L
a SUldé (A) © (A)- a8
‘The B-bit date given in the instruction is subtracted from the A-register (accumulator). After subtraction, the result is sed
in the A-register. All flags are affected.
Two byte instruction Two machine cycles : Opcode fetch - 4T
Immediate addressing Memory read ~_3T
7
Total number of instructions = 4
9 SUBM (A) <(A)-(M) or (A) (A) - ((HL))
The content ofthe memory addressed by the HL pair is subtracted f regi soe
Lis eens from the A-register. After subtraction, the resutt ss
One byte instruction Two machine cycles : Opcode fetch - 4T
Register indirect addressing Memory read - 3
7
Total number of instructions = 4
10. SBB reg (A) (A) - (reg) - CF
The content of the register and the value of carry
accumulator (A-register) After subtraction, the result is sto
any one of the general purpose register A, B, C, D, E, Hor,
(before executing this instruct a
ion) are subtracted fo!
red nth accumultoc Al gear fected, The retro
(One byte instruction One machine cycl
lo: :
Register addressing oo
Total number of instructions = 7
SBBA__SBBB_ SBBC SBBD _SBBE SBBH SBBL8085 Microprocessor and Its Applications 2.33
a SBM, (A) < (A) = dB - CF
The 8-bit dete given in the instruction and the value of cary (before executing this instruction) are subtracted from