8085 instruction set

18
1 8085 Instruction Set

Upload: sierra-mcclain

Post on 02-Jan-2016

26 views

Category:

Documents


0 download

DESCRIPTION

8085 Instruction Set. 8085 Instruction Set-Classification. Data transfer Group Arithmetic Group (ADD,SUB,INR,DCR) Logic operations ( AND,OR,XOR,Complement ) Rotate Group ( Left,Right ) Stack Operations Branching Group (JMP, CALL, RET) Input/Output Machine Control Group. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 8085 Instruction Set

1

8085 Instruction Set

Page 2: 8085 Instruction Set

2

8085 Instruction Set-Classification

Data transfer Group

Arithmetic Group (ADD,SUB,INR,DCR)Logic operations (AND,OR,XOR,Complement)Rotate Group (Left,Right)Stack OperationsBranching Group (JMP, CALL, RET)Input/Output Machine Control Group

• Between Registers• Between Memory location and a Register• Direct write to a Register / Memory• Between I/O device and Accumulator

Page 3: 8085 Instruction Set

3

8085 Instruction Types

Page 4: 8085 Instruction Set

4

8085 Instruction Types

Page 5: 8085 Instruction Set

5

8085 Instruction Types

Page 6: 8085 Instruction Set

6

Data Transfer Operations

Instruction

Operation Explanation

Example

MVI r,Data(8) r data(8)

Move immediate 8 bit data directly into Specified Register

MVI B,5EH

MVI M,Data(8)

M data(8)(HL)

Move immediate 8 bit data directly into Memory Location

MVI M,2CH

MOV rd,rs rd rsCopies data from Source into Destination Register

MOV C,E

MOV M,rs (HL) rs Copies data from Source into Memory Location

MOV M,D

MOV rd,M rd (HL)Copies data from Memory Location into Destination

MOV A,M

STA addr (addr) AStores the data of Accumulator into pointed Memory address

STA 6540H

LDA addr A (addr)Load the data of specified Memory

address into Accumulator

LDA 4500H

Page 7: 8085 Instruction Set

7

B

A

D

11

33

66

C

F

E

22

55

88

H20

L20

SP 5100H

Before Execution

AE

30

201FH2020H2021H2022H

B

A

D

30

33

66

C

F

E

22

80

AE

H20

L66

SP 5100H

After Execution

CD

30

11

201FH2020H2021H2022H

MVI C,80HMOV E,MMVI M,CDHMOV L,DSTA 2022HLDA 2021HMOV M,B

332066H

Page 8: 8085 Instruction Set

8

Data Transfer Operations

Instruction

Operation Explaination Example

LXI rp,data(16)

rpdata(16)

Move immediate 16 bit data directly into given Register Pair or SP

LXI B,1234H

SHLD addr(addr) L(addr+1) H

Stores L data into Specified memory location & H data into next location

SHLD 7480H

LHLD addr L(addr)H(addr+1)

Copies memory location data into L & next location data into H

LHLD 524DH

STAX rp (rp) A

Stores the data of Accumulator into Specified Register Pair address

STAX B

LDAX rp A (rp)

Load the data of Specified Register Pair address into Accumulator

LDAX D

XCHG HDLE

Exchanges the contents of H with D & L with E XCHG

Page 9: 8085 Instruction Set

9

B

A

D

85

33

10

C

F

E

22

50

20

H45

L10

35

25

SP 9515H

Before Execution

55

66

450FH4510H4511H4512H

LXI SP,80HSHLD 4500HLHLD 4511HSTAX BLDAX D

B

A

D

99

33

10

C

F

E

22

50

20

H66

L55

35

25

SP 9515H

After Execution

10

45

55

66

4500H4501H

4511H4512H

809515H991020

H

853550H

D10

E20

H66

L55

D66

E55

H10

L20

XCHG

Page 10: 8085 Instruction Set

10

Arithmetic Group

Instruction Operation Example

ADD r AA+r ADD C

ADD M AA+M ADD M

ADI data (8) AA+data(8) ADI 85H

ADC r AA+r+Cy ADC E

ADC M AA+M+Cy ADC M

ACI data (8) AA+data(8)+Cy ACI 2AH

DAD rp HLHL+rp DAD B

DAA Adjust Acc to BCD DAA

INR r rr+1 INR B

INR M M (M)+1 INR M

INX rp rprp+1 INX D

Page 11: 8085 Instruction Set

11

INR BB 83H 10000011 01H 00000001B 84H 10000100

ADD E A 83H 10000011E 2EH 00101110A B1H 10110001

ADI EEHA 83H 10000011 EEH 11101110A B1H 01110001CY 01H

ADC M A 83H 10000011 HL 1020HE0HM E0H 11100000CY 01H 00000001 A 64H 01100100CY 01H

DAD B HL 1256H 0001001001010110 BC 4500H 0100010100000000 HL 5256H 0101011101010110

ADD BBCD 78H A 01111000BCD 54H B 01010100BCD 132H CCH A 11001100

ADD B & DAAA 01111000B 01010100

1100 > 09 11001100 +06 00000110 1101 > 09 11010010 +60 01100000

132100110010

Page 12: 8085 Instruction Set

12

Arithmetic Group

Instruction Operation Example

SUB r AA –r SUB L

SUB M AA –M SUB M

SUI data (8) AA – data(8) SUI C3H

SBB r AA–r–Cy SBB C

SBB M AA–M–Cy SBB M

SBI data (8) AA–data(8) –Cy SBI FFH

DCR r rr –1 DCR A

DCR M M (M) –1 DCR M

DCX rp rprp –1 DCX H

Page 13: 8085 Instruction Set

13

Logic Group

ANA r A A & rANA M A A & (M)

ANI data A A & data

XRA r A A rXRA M A A (M)

XRI data A A data

ORA r A A ! r ORA M A A !(M)

ORI data A A ! data

STC Cy 01CMC Cy CyCMA A A

CMP r A-r

CMP M A-(M)CPI data A-

data

+

++

CY Z

A<R 1 0

A=R 0 1

A>R 0 0

Page 14: 8085 Instruction Set

14

Rotate GroupRLC- Rotate Accumulator Left

After Execution

Before Execution

RAL- Rotate Accumulator Left through Carry

CY B7 B6 B5 B4 B3 B2 B1 B0

B5 B4 B3 B2 B1 B0B6B7 B7

CY B7 B6 B5 B4 B3 B2 B1 B0

B5 B4 B3 B2 B1 B0B6B7 CY

Before Execution

After Execution

CYB7 B6 B5 B4 B3 B2 B1 B0

B5 B4 B3 B2

B1

B0 B6B7 B0

RRC- Rotate Accumulator Right

RAR- Rotate Accumulator Right through Carry

CYB7 B6 B5 B4 B3 B2 B1 B0

B5 B4 B3 B2

B1

B6B7 B0 CY

Before Execution

Before Execution

After Execution

After Execution

Page 15: 8085 Instruction Set

Stack Operations

15

PUSH rpPOP rpPUSH PSWPOP PSWSPHL (SPHL)XTHL {L(SP) H (SP+1)}

3

2

1

LIFO

PUSHSP SP-1(SP)rpH or A SP SP-1(SP)rpL or Flag

POPrpL or Flag (SP) SP SP+1 rpH or A (SP) SP SP+1

Page 16: 8085 Instruction Set

Branch Groups

16

Branch Group

Conditional

Unconditional

J cond addr

RET

CALL addrJMP addr

C cond addr

R condition RST n

PCHL

Conditions C- Carry (Cy=1) Z- Zero (Z=1) P- Positive

(S=0)PE- Parity Even (P=1)

NC- No Carry(Cy=0)

NZ- No zero(Z=0)

M- Negative (S=1)

PO- Parity Even (P=0)

Page 17: 8085 Instruction Set

Input / Output control

17

IN addr (8)A (addr)

Copies the data at the specified port address

into AccumulatorIN 57H

OUT addr (8)

(addr) ASends Accumulator

data to specified port address

OUT 9AH

Page 18: 8085 Instruction Set

Machine control Group

18

EI Set the interrupt Flip Flop (IE 1)

DI Reset the interrupt Flip Flop (IE 0)

NOP No Operation

HLT Halts the Processor

SIM Serial Interrupt Mask

RIM Read Interrupt Mask