instructions set of 8085 µp

72
Instructions set of 8085 µP 1

Upload: shabd-shashank

Post on 17-May-2017

268 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Instructions set  of 8085 µP

Instructions set of 8085 µP

1

Page 2: Instructions set  of 8085 µP

8085 Instruction setInstructions are generally divided into functional categories as follow:-1.Data transfer group2.Arithmetic group3.Logical group4.Branching group5.Stack and machine control group

2

Page 3: Instructions set  of 8085 µP

Data transfer group

• This group of instructions copies data from source to destination without modifying the contents of the source

• The data transfer are possible between direct data, registers and memory location.

3

Page 4: Instructions set  of 8085 µP

4

Page 5: Instructions set  of 8085 µP

1. MVI R , Data:- Moves the immediate 8 bit data to register specified in the instructionNo. of bytes: 2 bytesAddressing modes: Immediate addressing modeExample: MVI C, 45H

5

Page 6: Instructions set  of 8085 µP

2. MVI M , Data:- Moves the immediate 8 bit data to

memory . The H-L register pair is used as memory pointer.

No. of bytes: 2 bytesAddressing modes: Immediate addressing

modeExample: MVI M, 45H

6

Page 7: Instructions set  of 8085 µP

3. MOV Rd , Rs:- Copies data from source register

to destination register.No. of bytes: 1 byteAddressing modes: Register addressing modeExample: MOV A, B

7

Page 8: Instructions set  of 8085 µP

4. MOV M , R:- Copies data from register R to

memory M . The H-L register pair is used as memory pointer.

No. of bytes: 1 byteAddressing modes: Indirect addressing modeExample: MOV M, C

8

Page 9: Instructions set  of 8085 µP

5. MOV R , M:- Copies data from memory M to

register R . The contents of H-L register pair are used as address of memory location.

No. of bytes: 1 byteAddressing modes: Indirect addressing modeExample: MOV C,M

9

Page 10: Instructions set  of 8085 µP

6.LXI Rp , data(16 bit):- Loads 16 bit data specified with

instruction to specified register pair . The register pair can be any of B-C , D-E , H-L or stack pointer.

No. of bytes: 3 bytesAddressing modes: Immediate addressing

modeExample: LXI B,1050 H

10

Page 11: Instructions set  of 8085 µP

7. LDA Address:- Copies the contents of the

memory location whose address is specified in the instruction to the accumulator.

No. of bytes: 3 bytesAddressing mode: Direct addressing modeExample: LDA 5012H

11

Page 12: Instructions set  of 8085 µP

8. STA address:- Copies the contents of the

accumulator to the memory location whose address is specified in this instruction.

No. of bytes: 3 bytesAddressing mode: Direct addressing modeExample: STA 5012H

12

Page 13: Instructions set  of 8085 µP

9. LHLD address:- Copies the contents of the

memory location whose address is specified in this instruction to the registers H and L.

No. of bytes: 3 bytesAddressing mode: Direct addressing modeExample: LHLD 1234H

13

Page 14: Instructions set  of 8085 µP

10. SHLD address:- Copies the contents of the

registers H and L to the memory location whose address is specified in this instruction.

No. of bytes: 3 bytesAddressing mode: Direct addressing modeExample: SHLD 1234H

14

Page 15: Instructions set  of 8085 µP

11. LDAX Rp:- Copies the contents of memory

location whose address is pointed by the specified register pair to the accumulator.

No. of bytes: 1 byteAddressing mode: Register indirect addressing

modeExample: LDAX D

15

Page 16: Instructions set  of 8085 µP

12. STAX Rp:- Copies the contents of

accumulator to the memory location whose address is pointed by the specified register pair .

No. of bytes: 1 byteAddressing mode: Register indirect addressing

modeExample: STAX D

16

Page 17: Instructions set  of 8085 µP

13. XCHG:- Exchanges the contents of registers H

with register D and register L with register E.No. of bytes: 1 byteAddressing mode: Register addressing modeExample: XCHG

17

Page 18: Instructions set  of 8085 µP

Arithmetic group instructions

18

Page 19: Instructions set  of 8085 µP

Arithmetic group

This group of instruction performs arithmetic operations such as addition , subtraction, increment, and decrement.

19

Page 20: Instructions set  of 8085 µP

1. ADD R:- Adds the contents of register R with

the contents of accumulator and result of addition is stored in the accumulator.

No. of bytes:-1 ByteAddressing mode:- Register addressing modeExample:- ADD C

20

Page 21: Instructions set  of 8085 µP

2. ADD M:- Adds the contents of memory

location pointed by H-L register pair with the contents of accumulator and result of addition is stored in the accumulator.

No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- ADD M

21

Page 22: Instructions set  of 8085 µP

3. ADI Data:- Adds the 8 bit data specified along

with the contents of accumulator and result of addition is stored in the accumulator.

No. of bytes:-2 ByteAddressing mode:- Immediate addressing modeExample:- ADI 40H

22

Page 23: Instructions set  of 8085 µP

3. ADC R:- Adds the contents of register R along

with the carry to the contents of the accumulator and the result is stored in the accumulator.

No. of bytes:-1 ByteAddressing mode:- Register addressing modeExample:- ADC C

23

Page 24: Instructions set  of 8085 µP

4. ADC M:- Adds the contents of memory

location pointed by H-L register pair and the contents of carry with the contents of the accumulator and the result is stored in the accumulator.

No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- ADC M

24

Page 25: Instructions set  of 8085 µP

5. ACI data:- adds the 8 bit data specified and

the contents of carry along with the contents of the accumulator and the result is stored in the accumulator.

No. of bytes:- 2 byteAddressing mode:- Immediate addressing modeExample:- ACI 40H

25

Page 26: Instructions set  of 8085 µP

6. DAD Rp:- Adds the contents of specified

register pair to H-L pair and stores the result in H-L pair.

No. of bytes:- 1byteAddressing mode:- Register addressing modeExample:- DAD B

26

Page 27: Instructions set  of 8085 µP

7. SUB R8. SUB M9. SUI Data10. SBB R11. SBB M12. SBI Data

27

Page 28: Instructions set  of 8085 µP

13. DAA:- This instruction is used to make sure

that the result of adding two packed BCD numbers is adjusted to be a legal BCD number.

It operates only on A register.It is used in the program after ADD, ADI, ACI, ADC.No. of bytes:- 1 byteAddressing mode:- Implicit addressing modeExample:-DAA

28

Page 29: Instructions set  of 8085 µP

14. INR R:- Increments the contents of the

specified register R by 1.The result is stored in the same register.

No. of bytes:- 1 ByteAddressing mode:- Register addressing modeExample:- INR B

29

Page 30: Instructions set  of 8085 µP

15. INR M:- Increments the contents of the

memory pointer by 1.The result is stored in the same .

No. of bytes:- 1 ByteAddressing mode:- Register indirect addressing

modeExample:- INR M

30

Page 31: Instructions set  of 8085 µP

16. INX Rp:- Increments the contents of the

specified register pair Rp by 1.The result is stored in the same register.

No. of bytes:- 1 ByteAddressing mode:- Register addressing modeExample:- INX B

31

Page 32: Instructions set  of 8085 µP

17. DCR R18. DCR M19. DCX Rp

32

Page 33: Instructions set  of 8085 µP

Logical Group Instructions

33

Page 34: Instructions set  of 8085 µP

1. ANA R:- Contents of the specified register

are logically ANDED with the contents of accumulator and the result is stored in the accumulator.

No. of bytes:- 1 ByteAddressing mode:-Register addressing modeExample:- ANA B

34

Page 35: Instructions set  of 8085 µP

2. ANA M:- Contents of the memory location

pointed by H-L register pair are logically ANDED with the contents of accumulator and the result is stored in the accumulator.

No. of bytes:- 1 ByteAddressing mode:-Register indirect

addressing modeExample:- ANA M

35

Page 36: Instructions set  of 8085 µP

3. ANI Data:- Contents of the 8-bit data specified

in the instruction are logically ANDED with the contents of accumulator and the result is stored in the accumulator.

No. of bytes:- 2 ByteAddressing mode:-Immediate addressing modeExample:- ANI 45H

36

Page 37: Instructions set  of 8085 µP

4. XRA R5. XRA M6. XRI Data7.ORA R8. ORA M9. ORI Data

37

Page 38: Instructions set  of 8085 µP

10. CMP R:- Compares the contents of accumulator

with the contents of register specified in the instruction.

The comparison is done by subtracting the contents of the register from the contents of the accumulator and the result of subtraction is discarded. The result is not stored in either of the register or accumulator.

No. of bytes:- 1 Byte.Addressing mode:- Register addressing modeExample:-CMP B

38

Page 39: Instructions set  of 8085 µP

Compare Carry Flag Zero Flag

A>R 0 0

A<R 1 0

A=R 0 1

39

Page 40: Instructions set  of 8085 µP

11. CMP M12. CPI Data13. STC:- This instruction sets the carry flag.No. of bytes:- 1 ByteAddressing mode:- Implicit addressing mode14. CMC:- This instruction inverts the value of the

carry flag No. of Bytes: 1 bytes Addressing mode:- Implicit Addressing mode

40

Page 41: Instructions set  of 8085 µP

15. CMA16. RLC:- This instructions rotates all the bits in the

accumulator to the left by one bit position.No. of bytes:- 1 ByteAddressing mode:- Implicit addressing mode

41

Page 42: Instructions set  of 8085 µP

17. RRC18. RAL19. RAR

42

Page 43: Instructions set  of 8085 µP

Branch Group

43

Page 44: Instructions set  of 8085 µP

Branch group

The microprocessor executes machine codes in sequential manner. It goes on executing from one memory location to the next. Branch group of instructions instructs the microprocessor to go to different memory location. The microprocessor continues executing machine codes from that new location. There are two types of branch instructions:-Conditional and Unconditional

44

Page 45: Instructions set  of 8085 µP

1. JMP Address:- This instruction loads the PC

with the address given within the instruction and continues the program from this location.

No. of bytes:-3 byteAddressing mode:- Immediate addressing modeExample:-JMP 2000H

45

Page 46: Instructions set  of 8085 µP

Conditional JUMP InstructionInstruction code Description Condition for JUMP

JZ JUMP if zero ZF=1

JNZ JUMP if not Zero ZF=0

JP JUMP if positive SF=0

JM JUMP on minus SF=1

JPO JUMP if parity odd PF=0

JPE JUMP if parity even PF=1

JC JUMP if CARRY CF=1

JNC JUMP if not carry CF=0

46

Page 47: Instructions set  of 8085 µP

2. CALL Address:- This instruction is used to

transfer the program control to a sub program or subroutine

No. of bytes:- 3 bytesAddressing mode:- Immediate addressing modeExample:- CALL 4000

47

Page 48: Instructions set  of 8085 µP

48

Page 49: Instructions set  of 8085 µP

Conditional CALL InstructionInstruction code Description Condition for JUMP

CZ CALL if zero ZF=1

CNZ CALL if not Zero ZF=0

CP CALL if positive SF=0

CM CALL on minus SF=1

CPO CALL if parity odd PF=0

CPE CALL if parity even PF=1

CC CALL if CARRY CF=1

CNC CALL if not carry CF=0

49

Page 50: Instructions set  of 8085 µP

3. RET:- When this instruction is executed, the

program control is transferred from the sub-rountine to the calling program.

The return address is taken from stack and this address is loaded in PC and the program execution begins at address taken from stack.

No. of bytes:- 1 byteAddressing mode:- Register indirect addressing

modeExample:- RET

50

Page 51: Instructions set  of 8085 µP

51

Page 52: Instructions set  of 8085 µP

Conditional RET InstructionInstruction code Description Condition for JUMP

RZ RETURN if zero ZF=1

RNZ RETURN if not Zero ZF=0

RP RETURN if positive SF=0

RM RETURN on minus SF=1

RPO RETURN if parity odd PF=0

RPE RETURN if parity even PF=1

RC RETURN if CARRY CF=1

RNC RETURN if not carry CF=0

52

Page 53: Instructions set  of 8085 µP

4. PCHL:- Contents of H and L registers are

transferred to program counter. The H contents to high order 8 bits and L contents to low order 8 bits of program counter.

No. of bytes:- 1 byteAddressing mode:- Register addressing mode

53

Page 54: Instructions set  of 8085 µP

5. RST n(Restart):- Restart is a one word CALL instruction. This

instruction transfers the program control to the specific memory address

No. of bytes:-1 byteAddressing mode:- Register indirect modeExample:- RST 2

Instructions Restart LocationsRST O 0×8=0000H

RST 1 1×8=0008H

RST 2 2×8=0010H

RST 3 3×8=0018H

RST 4 4×8=0020H

RST 5 5×8=0028H

RST 6 6×8=0030H

RST 7 7×8=0038H

54

Page 55: Instructions set  of 8085 µP

Stack Control group

55

Page 56: Instructions set  of 8085 µP

1. SPHL:- When this instruction is executed, the

contents of H-L pair are transferred to stack pointer register.

No. of bytes:- 1 byteAddressing mode:- register addressing mode.Example:-SPHL

56

Page 57: Instructions set  of 8085 µP

2.XTHL:- when this instruction is executed , the

contents of L register are exchanged with the stack location pointed by stack pointer and the contents of H register are exchanged with the next stack location.

No. of bytes:- 1 byteAddressing mode:- Register indirect addressing

mode

57

Page 58: Instructions set  of 8085 µP

3. PUSH Rp:- Push the contents of register pair to stack.No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- Push B

58

Page 59: Instructions set  of 8085 µP

Decrement SP Copy the contents of register B to the memory location pointed to by SP Decrement SP Copy the contents of register C to the memory location pointed to by SP

59

Page 60: Instructions set  of 8085 µP

4. POP Rp:- Pop the contents of register pair that

were saved from the stack to register pair.No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- Pop D

60

Page 61: Instructions set  of 8085 µP

PSW Register Pair• The 8085 recognizes one additional register

pair called the PSW (Program Status Word).• This register pair is made up of the

Accumulator and the Flags registers.• It is possible to push the PSW onto the stack,

do whatever operations are needed, then POP it off of the stack. The result is that the contents of the Accumulator and the status of the Flags are returned to what they were before the operations were executed.

61

Page 62: Instructions set  of 8085 µP

5. Push PSW:- Push the program status word (Acc.

+ flags) to the stack.No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- Push PSW

62

Page 63: Instructions set  of 8085 µP

6. POP PSW:- Pop the program status word that

was saved from the stack.No. of bytes:-1 ByteAddressing mode:- Register indirect addressing

modeExample:- POP PSW

63

Page 64: Instructions set  of 8085 µP

Machine control Group

64

Page 65: Instructions set  of 8085 µP

1. NOP:- When this instruction is executed, no

operation is performed instead of that instruction.

No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

2. HLT:- This instruction stop the µP.No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

65

Page 66: Instructions set  of 8085 µP

3. EI:- When this instruction is executed , the interrupts

are enabled.No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

4. DI:- When this instruction is executed , the interrupts

are disabled.No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

66

Page 67: Instructions set  of 8085 µP

5. SIM(Set interrupt mask):- when this instruction is executed, the

interrupts are masked or kept pending as specified in the accumulator.

It also sends data on SOD pin.No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

67

Page 68: Instructions set  of 8085 µP

SIM Instruction

68

Page 69: Instructions set  of 8085 µP

6. RIM( Read interrupt mask):- When this instruction is executed the

status of the interrupts is copied into the accumulator.

It also reads the serial data through the SID pin.No. of Byte:- 1 ByteAddressing mode:- implicit addressing mode

69

Page 70: Instructions set  of 8085 µP

RIM Instruction

70

Page 71: Instructions set  of 8085 µP

7. In 8-bit address:- Input the contents of the port whose

address is specified into the accumulator.No. of Byte:- 2 ByteAddressing mode:-Direct addressing mode.Example:- IN 02H

71

Page 72: Instructions set  of 8085 µP

8. OUT 8-bit address:- Output the contents of the accumulator

to the port whose address is specified .No. of Byte:- 2 ByteAddressing mode:-Direct addressing mode.Example:- OUT 02H

72