Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Instruction Set• Prof. Rajesh R.K.• Assistant Professor,• Department of MCA• Mohandas College of Engineering &Technology, ...
Instruction• An instruction is a binary pattern designedinside a microprocessor to perform a specificfunction.• 8085 has 2...
1. Introduction• A microprocessor executes instructions given by theuser• Instructions should be in a language known to th...
Assembly language program to add twonumbersMVI A, 2H ;Copy value 2H in register AMVI B, 4H ;Copy value 4H in register BADD...
Microprocessor understands Machine Language only!• Microprocessor cannot understand a programwritten in Assembly language•...
8085 Instruction Types
8085 Instruction Types
8085 Instruction Types
Classification Of Instruction Set• There are 5 Types,• (1) Data Transfer Instruction,• (2) Arithmetic Instructions,• (3) L...
(1) Data Transfer Instructions• MOV Rd, Rs• MOV M, Rs• MOV Rd, M• This instruction copies the contents of thesource regist...
A 20 B 20A FB 30 CD EH 20 L 50A 20 BBEFORE EXECUTION AFTER EXECUTIONMOV B,AA FB 30 CD EH 20 L 50A FB CD EH 20 L 50A FB C 4...
• MVI R, Data(8-bit)• MVI M, Data(8-bit)• The 8-bit immediate data is stored in thedestination register (R) or memory (M),...
A FB CD EH LA FB 60 CD EH LAFTER EXECUTIONBEFORE EXECUTIONMVI B,60H40HL=2050H2051H204FH 204FHHL=2050H2051HMVI M,40HBEFORE ...
• LDA 16-bit address• The contents of a memory location, specifiedby a 16-bit address in the operand, arecopied to the acc...
A30A 3030AFTER EXECUTIONBEFORE EXECUTIONLDA 2000H2000H 2000H
(4) Data Transfer Instructions• LDAX Register Pair• Load accumulator (A) with the contents ofmemory location whose address...
A FB CD 20 E 30A 80 FB CD 20 E 3080 80AFTER EXECUTIONBEFORE EXECUTIONLDAX D2030H 2030H
(5) Data Transfer Instructions• STA 16-bit address• The contents of accumulator are copied intothe memory location i.e. ad...
A 50 A 5050AFTER EXECUTIONBEFORE EXECUTIONSTA 2000H2000H 2000H
(6) Data Transfer Instructions• STAX Register Pair• Store the contents of accumulator (A) intothe memory location whose ad...
A 50 FB 10 C 20D EA 50 FB 10 C 20D E50AFTER EXECUTIONBEFORE EXECUTIONSTAX B1020H 1020H
• LHLD 2050 Means..copy content of 2050 and 2051 toHL pairif2050 -> 90H2051->5AHLHLD 2050 implies..L -> 90HH -> 5AH
•LXI means..Load Register Pair with Immediate data.. 16bit dataLXI B ,2050HLoads BC pair with value 2050HB-> 20HC-> 50HIts...
(7) Data Transfer Instructions• SHLD 16-bit address• Store H-L register pair in memory.• The contents of register L are st...
H 30 L 60BEFORE EXECUTION AFTER EXECUTION6030H 30 L 60SHLD 2500H2500H 2500H204FH2502H204FH2502H
(8) Data Transfer Instructions• XCHG• The contents of register H are exchangedwith the contents of register D.• The conten...
D 20 E 40H 70 L 80D 70 E 80H 20 L 40BEFORE EXECUTION AFTER EXECUTIONXCHG
(9) Data Transfer Instructions• SPHL• Move data from H-L pair to the Stack Pointer(SP)• This instruction loads the content...
H 25 L 00SPBEFORE EXECUTIONAFTER EXECUTIONH 25 L 00SP 2500SPHL
(10) Data Transfer Instructions• XTHL• Exchange H–L with top of stack• The contents of L register are exchanged withthe lo...
H30L40SP 2700BEFORE EXECUTION5060H60L50SP 2700 4030AFTER EXECUTIONXTHL2700H2701H2702H2700H2701H2702HL=SPH=(SP+1)
(11) Data Transfer Instructions• PCHL• Load program counter with H-L contents• The contents of registers H and L are copie...
H60L00PCBEFORE EXECUTION AFTER EXECUTIONH60L00PC 6000PCHL
(12) Data Transfer Instructions• IN 8-bit port address• Copy data to accumulator from a port with 8-bit address.• The cont...
10 A10 A 10BEFORE EXECUTIONAFTER EXECUTIONIN 80HPORT 80HPORT 80H
(13) Data Transfer Instructions• OUT 8-bit port address• Copy data from accumulator to a port with 8-bit address• The cont...
10 A 4040 A 40BEFORE EXECUTIONAFTER EXECUTIONOUT 50HPORT 50HPORT 50H
Arithmetic Instructions• These instructions perform the operationslike:• Addition• Subtraction• Increment• Decrement
(1) Arithematic Instructions• ADD R• ADD M• The contents of register or memory are addedto the contents of accumulator.• T...
B C 30D EH LB C 30D EH LAFTER EXECUTIONBEFORE EXECUTIONB CD EH 20 L 50B CD EH 20 L 50AFTER EXECUTIONBEFORE EXECUTIONA 20A ...
(2) Arithematic Instructions• ADC R• ADC M• The contents of register or memory and Carry Flag(CY) are added to the content...
B C 20D EH LA 50B C 20D EH LA 71AFTER EXECUTIONBEFORE EXECUTIONADC CA=A+R+CYCY 1 CY 0CY 1 CY 0A 20 A 51H 20 L 50 H 20 L 50...
(3) Arithematic Instructions• ADI 8-bit data• The 8-bit data is added to the contents ofaccumulator.• The result is stored...
A 50 A 60AFTER EXECUTIONBEFORE EXECUTIONADI 10HA=A+DATA(8)
(4) Arithematic Instructions• ACI 8-bit data• The 8-bit data and the Carry Flag (CY) areadded to the contents of accumulat...
CY 1 CY 0A 30 A 51AFTER EXECUTIONBEFORE EXECUTIONACI 20HA=A+DATA(8)+CY
(5) Arithematic Instructions• DAD Register pair• The 16-bit contents of the register pair areadded to the contents of H-L ...
AFTER EXECUTIONBEFORE EXECUTIONB CD 10 E 20H 20 L 50SPB CD 10 E 20H 30 L 70SPCY 0 CY 0DAD DHL=HL+R
(6) Arithematic Instructions• SUB R• SUB M• The contents of the register or memory location aresubtracted from the content...
B 30 CD EH LA 50B 30 CD EH LA 20AFTER EXECUTIONBEFORE EXECUTIONSUB BA=A-RAFTER EXECUTIONBEFORE EXECUTIONA 50 A 40H10L20H10...
(7) Arithematic Instructions• SBB R• SBB M• The contents of the register or memory location andBorrow Flag (i.e.CY) are su...
B C 20D EH LA 40CY 1B C 20D EH LA 19CY 0SBB CA=A-R-CYAFTER EXECUTIONBEFORE EXECUTIONCY 1A 50H20L50CY 0A 39H20L50AFTER EXEC...
(8) Arithematic Instructions• SUI 8-bit data• OPERATION: A=A-DATA(8)• The 8-bit immediate data is subtracted fromthe conte...
(9) Arithematic Instructions• SBI 8-bit data• The 8-bit data and the Borrow Flag (i.e. CY) issubtracted from the contents ...
CY 1A 50AFTER EXECUTIONBEFORE EXECUTIONCY 0A 29SBI 20HA=A-DATA(8)-CY
(10) Arithematic Instructions• INR R• INR M• The contents of register or memory location areincremented by 1.• The result ...
B 10 CD EH LAB 11 CD EH LAAFTER EXECUTIONBEFORE EXECUTIONH20L50H20L5030 312050H 2050HAFTER EXECUTIONBEFORE EXECUTIONINR MM...
(11) Arithematic Instructions• INX Rp• The contents of register pair are incrementedby 1.• The result is stored in the sam...
B CD EH 10 L 20B CD EH 11 L 21AFTER EXECUTIONBEFORE EXECUTIONSPSPINX HRP=RP+1
(12) Arithematic Instructions• DCR R• DCR M• The contents of register or memory location aredecremented by 1.• The result ...
B CD E 19H LAAFTER EXECUTIONB CD E 20H LABEFORE EXECUTIONDCR ER=R-1H20L50H20L5021 202050HAFTER EXECUTIONBEFORE EXECUTIONDC...
(13) Arithematic Instructions• DCX Rp• The contents of register pair are decrementedby 1.• The result is stored in the sam...
B CD 10 E 20H LB CD 10 E 19H LAFTER EXECUTIONBEFORE EXECUTIONSPSPDCX DRP=RP-1
(1) Logical Instructions• ANA R• ANA M• AND specified data in register or memory withaccumulator.• Store the result in acc...
B 10 CD EH LAB 0F CD EH LA 0AAFTER EXECUTIONANA BA=A and RB 0F CD EH LA AABEFORE EXECUTIONCY AC CY 0 AC 1AFTER EXECUTIONBE...
(2) Logical Instructions• ANI 8-bit data• AND 8-bit data with accumulator (A).• Store the result in accumulator (A)• Examp...
CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 1A 33ANI 3FHA=A and DATA(8)1011 0011=B3H0011 1111=3FH0011 0011=33H
(3) Logical Instructions• XRA Register (8-bit)• XOR specified register with accumulator.• Store the result in accumulator....
B 10 CD EH LAB C 2DD EH LA 87AFTER EXECUTIONXRA CA=A xor RB C 2DD EH LA AABEFORE EXECUTIONCY AC CY 0 AC 01010 1010=AAH0010...
(4) Logical Instructions• XRA M• XOR data in memory (memory locationpointed by H-L pair) with Accumulator.• Store the resu...
H 20 L 50A 55AFTER EXECUTIONXRA MA=A xor MBEFORE EXECUTIONCY AC CY 0 AC 00101 0101=55H1011 0011=B3H1110 0110=E6HH 20 L 50A...
(5) Logical Instructions• XRI 8-bit data• XOR 8-bit immediate data with accumulator (A).• Store the result in accumulator....
CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A 8AXRI 39HA=A xor DATA(8)1011 0011=B3H0011 1001=39H1000 1010=8AH
(6) Logical Instructions• ORA Register• OR specified register with accumulator (A).• Store the result in accumulator.• Exa...
AFTER EXECUTIONBEFORE EXECUTIONCY ACORA BA=A or R1010 1010=AAH0001 0010=12H1011 1010=BAHB 12 CD EH LA AAB 12 CD EH LA BACY...
(7) Logical Instructions• ORA M• OR specified register with accumulator (A).• Store the result in accumulator.• Example: O...
AFTER EXECUTIONBEFORE EXECUTIONCY ACORA MA=A or M0101 0101=55H1011 0011=B3H1111 0111=F7HH 20 L 50A 55 A F7CY 0 AC 0H 20 L ...
(8) Logical Instructions• ORI 8-bit data• OR 8-bit data with accumulator (A).• Store the result in accumulator.• Example: ...
CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A BBORI 08HA=A or DATA(8)1011 0011=B3H0000 1000=08H1011 1011=BBH
(9) Logical Instructions• CMP Register• CMP M• Compare specified data in register or memorywith accumulator (A).• Store th...
B 10 CD EH LAB CD B9 EH LA B8AFTER EXECUTIONCMP DA-RB CD B9 EH LA B8BEFORE EXECUTIONCY Z CY 0 Z 0AFTER EXECUTIONBEFORE EXE...
(10) Logical Instructions• CPI 8-bit data• Compare 8-bit immediate data withaccumulator (A).• Store the result in accumula...
CY ZA BAAFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A BACPI 30HA-DATAA>DATA: CY=0,Z=0A=DATA: CY=0,Z=1A<DATA: CY=1,Z=01011 1010...
(11) Logical Instructions• STC• It sets the carry flag to 1.• Example: STC
CY 0AFTER EXECUTIONBEFORE EXECUTIONCY 1STCCY=1
(12) Logical Instructions• CMC• It complements the carry flag.• Example: CMC
CY 1AFTER EXECUTIONBEFORE EXECUTIONCY 0CMC
(13) Logical Instructions• CMA• It complements each bit of the accumulator.• Example: CMA
(14) Logical Instructions• RLC• Rotate accumulator left• Each binary bit of the accumulator is rotated leftby one position...
B7 B6 B5 B4 B3 B2 B1 B0CYB6 B5 B4 B3 B2 B1 B0 B7B7AFTER EXECUTIONBEFORE EXECUTION
(15) Logical Instructions• RRC• Rotate accumulator right• Each binary bit of the accumulator is rotated right byone• posit...
B7 B6 B5 B4 B3 B2 B1 B0 CYB0 B7 B6 B5 B4 B3 B2 B1 B0AFTER EXECUTIONBEFORE EXECUTION
(16) Logical Instructions• RAL• Rotate accumulator left through carry• Each binary bit of the accumulator is rotated leftb...
B7 B6 B5 B4 B3 B2 B1 B0CYB6 B5 B4 B3 B2 B1 B0 CYB7AFTER EXECUTIONBEFORE EXECUTION
(17) Logical Instructions• RAR• Rotate accumulator right through carry• Each binary bit of the accumulator is rotated left...
B7 B6 B5 B4 B3 B2 B1 B0 CYCY B7 B6 B5 B4 B3 B2 B1 B0AFTER EXECUTIONBEFORE EXECUTION
Concept of Subroutine• In 8085 microprocessor a subroutine is aseparate program written aside from mainprogram ,this progr...
Branching Instructions• The branch group instructions allows themicroprocessor to change the sequence ofprogram either con...
(1) Branching Instructions• JUMP ADDRESS• BEFORE EXECUTION AFTER EXECUTION• Jump unconditionally to the address.• The inst...
Conditional Jumps
(2) Branching Instructions• CALL address• Call unconditionally a subroutine whosestarting address given within theinstruct...
Conditional CallsInstruction Code Description Condition for CALLCC Call on carry CY=1CNC Call on not carry CY=0CP Call on ...
(3) Branching Instructions• RET• Return from the subroutine unconditionally.• This instruction takes return address fromth...
SP 27FDPC0062SP 27FFPC 62000062AFTER EXECUTIONBEFORE EXECUTIONRET27FFH27FEH27FDH27FFH27FEH27FDH
(4) Branching Instructions• RST n• Restart n (0 to 7)• This instruction transfers the programcontrol to a specific memory ...
SP 3000PC 2000SP 2999PC 00300120AFTER EXECUTIONBEFORE EXECUTIONRST 63000H2FFFH2FFEHSP-1ADDRESS OF THE NEXT INSTRUCTION IS ...
Vector Address For ReturnInstructionsInstruction Code Vector AddressRST 0 0*8=0000HRST 1 0*8=0008HRST 2 0*8=0010HRST 3 0*8...
(1) Control Instructions• NOP• No operation• No operation is performed.• The instruction is fetched and decoded but nooper...
(2) Control Instructions• HLT• Halt• The CPU finishes executing the currentinstruction and halts any further execution.• A...
(3) Control Instructions• RIM• Read Interrupt Mask• This is a multipurpose instruction used to read thestatus of interrupt...
RIM INSTRUCTIONRIM INSTRUCTION
• SIM• Set Interrupt Mask• This is a multipurpose instruction and used toimplement the 8085 interrupts 7.5, 6.5, 5.5, ands...
SIM Instruction
END OFINSTRUCTION SET
Instruction set  of 8085
Prochain SlideShare
Chargement dans…5
×

Instruction set of 8085

44 964 vues

Publié le

A detailed ppt on 8085 microprocessor instructions

Publié dans : Formation, Technologie

Instruction set of 8085

  1. 1. Instruction Set• Prof. Rajesh R.K.• Assistant Professor,• Department of MCA• Mohandas College of Engineering &Technology, Thiruvananthapuram, Kerala
  2. 2. Instruction• An instruction is a binary pattern designedinside a microprocessor to perform a specificfunction.• 8085 has 246 instructions.• Each instruction is represented by an 8-bitbinary value.
  3. 3. 1. Introduction• A microprocessor executes instructions given by theuser• Instructions should be in a language known to themicroprocessor• Microprocessor understands the language of 0’s and1’s only• This language is called Machine Language
  4. 4. Assembly language program to add twonumbersMVI A, 2H ;Copy value 2H in register AMVI B, 4H ;Copy value 4H in register BADD B ;A = A + BNote:• Assembly language is specific to a given processor• For e.g. assembly language of 8085 is different thanthat of Motorola 6800 microprocessor
  5. 5. Microprocessor understands Machine Language only!• Microprocessor cannot understand a programwritten in Assembly language• A program known as Assembler is used to convert aAssembly language program to machine languageAssemblyLanguageProgramAssemblerProgramMachineLanguageCode
  6. 6. 8085 Instruction Types
  7. 7. 8085 Instruction Types
  8. 8. 8085 Instruction Types
  9. 9. Classification Of Instruction Set• There are 5 Types,• (1) Data Transfer Instruction,• (2) Arithmetic Instructions,• (3) Logical Instructions,• (4) Branching Instructions,• (5) Control Instructions,
  10. 10. (1) Data Transfer Instructions• MOV Rd, Rs• MOV M, Rs• MOV Rd, M• This instruction copies the contents of thesource register into the destination register.• The contents of the source register are notaltered.• Example: MOV B,A or MOV M,B or MOV C,M
  11. 11. A 20 B 20A FB 30 CD EH 20 L 50A 20 BBEFORE EXECUTION AFTER EXECUTIONMOV B,AA FB 30 CD EH 20 L 50A FB CD EH 20 L 50A FB C 40D EH 20 L 50MOV M,BMOV C,M40 4030
  12. 12. • MVI R, Data(8-bit)• MVI M, Data(8-bit)• The 8-bit immediate data is stored in thedestination register (R) or memory (M), R isgeneral purpose 8 bit register such asA,B,C,D,E,H and L.• Example: MVI B, 60H or MVI M, 40H(2) Data Transfer Instructions
  13. 13. A FB CD EH LA FB 60 CD EH LAFTER EXECUTIONBEFORE EXECUTIONMVI B,60H40HL=2050H2051H204FH 204FHHL=2050H2051HMVI M,40HBEFORE EXECUTION AFTER EXECUTION
  14. 14. • LDA 16-bit address• The contents of a memory location, specifiedby a 16-bit address in the operand, arecopied to the accumulator (A).• The contents of the source are not altered.• Example: LDA 2000H(3) Data Transfer Instructions
  15. 15. A30A 3030AFTER EXECUTIONBEFORE EXECUTIONLDA 2000H2000H 2000H
  16. 16. (4) Data Transfer Instructions• LDAX Register Pair• Load accumulator (A) with the contents ofmemory location whose address is specifiedby BC or DE or register pair.• The contents of either the register pair or thememory location are not altered.• Example: LDAX D
  17. 17. A FB CD 20 E 30A 80 FB CD 20 E 3080 80AFTER EXECUTIONBEFORE EXECUTIONLDAX D2030H 2030H
  18. 18. (5) Data Transfer Instructions• STA 16-bit address• The contents of accumulator are copied intothe memory location i.e. address specified bythe operand in the instruction.• Example: STA 2000 H
  19. 19. A 50 A 5050AFTER EXECUTIONBEFORE EXECUTIONSTA 2000H2000H 2000H
  20. 20. (6) Data Transfer Instructions• STAX Register Pair• Store the contents of accumulator (A) intothe memory location whose address isspecified by BC Or DE register pair.• Example: STAX B
  21. 21. A 50 FB 10 C 20D EA 50 FB 10 C 20D E50AFTER EXECUTIONBEFORE EXECUTIONSTAX B1020H 1020H
  22. 22. • LHLD 2050 Means..copy content of 2050 and 2051 toHL pairif2050 -> 90H2051->5AHLHLD 2050 implies..L -> 90HH -> 5AH
  23. 23. •LXI means..Load Register Pair with Immediate data.. 16bit dataLXI B ,2050HLoads BC pair with value 2050HB-> 20HC-> 50HIts similar to 2 MVI instructionieMVI B,20HMVI C,50H
  24. 24. (7) Data Transfer Instructions• SHLD 16-bit address• Store H-L register pair in memory.• The contents of register L are stored intomemory location specified by the 16-bitaddress.• The contents of register H are stored into thenext memory location.• Example: SHLD 2500 H
  25. 25. H 30 L 60BEFORE EXECUTION AFTER EXECUTION6030H 30 L 60SHLD 2500H2500H 2500H204FH2502H204FH2502H
  26. 26. (8) Data Transfer Instructions• XCHG• The contents of register H are exchangedwith the contents of register D.• The contents of register L are exchanged withthe contents of register E.• Example: XCHG
  27. 27. D 20 E 40H 70 L 80D 70 E 80H 20 L 40BEFORE EXECUTION AFTER EXECUTIONXCHG
  28. 28. (9) Data Transfer Instructions• SPHL• Move data from H-L pair to the Stack Pointer(SP)• This instruction loads the contents of H-L pairinto SP.• Example: SPHL
  29. 29. H 25 L 00SPBEFORE EXECUTIONAFTER EXECUTIONH 25 L 00SP 2500SPHL
  30. 30. (10) Data Transfer Instructions• XTHL• Exchange H–L with top of stack• The contents of L register are exchanged withthe location pointed out by the contents ofthe SP.• The contents of H register are exchangedwith the next location (SP + 1).• Example: XTHL
  31. 31. H30L40SP 2700BEFORE EXECUTION5060H60L50SP 2700 4030AFTER EXECUTIONXTHL2700H2701H2702H2700H2701H2702HL=SPH=(SP+1)
  32. 32. (11) Data Transfer Instructions• PCHL• Load program counter with H-L contents• The contents of registers H and L are copied intothe program counter (PC).• The contents of H are placed as the high-orderbyte and the contents of L as the low-orderbyte.•
  33. 33. H60L00PCBEFORE EXECUTION AFTER EXECUTIONH60L00PC 6000PCHL
  34. 34. (12) Data Transfer Instructions• IN 8-bit port address• Copy data to accumulator from a port with 8-bit address.• The contents of I/O port are copied intoaccumulator.• Example: IN 80 H
  35. 35. 10 A10 A 10BEFORE EXECUTIONAFTER EXECUTIONIN 80HPORT 80HPORT 80H
  36. 36. (13) Data Transfer Instructions• OUT 8-bit port address• Copy data from accumulator to a port with 8-bit address• The contents of accumulator are copied intothe I/O port.• Example: OUT 50 H
  37. 37. 10 A 4040 A 40BEFORE EXECUTIONAFTER EXECUTIONOUT 50HPORT 50HPORT 50H
  38. 38. Arithmetic Instructions• These instructions perform the operationslike:• Addition• Subtraction• Increment• Decrement
  39. 39. (1) Arithematic Instructions• ADD R• ADD M• The contents of register or memory are addedto the contents of accumulator.• The result is stored in accumulator.• If the operand is memory location, its address isspecified by H-L pair.• Example: ADD C or ADD M
  40. 40. B C 30D EH LB C 30D EH LAFTER EXECUTIONBEFORE EXECUTIONB CD EH 20 L 50B CD EH 20 L 50AFTER EXECUTIONBEFORE EXECUTIONA 20A 50A 20A 30ADD CA=A+RADD MA=A+M10 102050 2050
  41. 41. (2) Arithematic Instructions• ADC R• ADC M• The contents of register or memory and Carry Flag(CY) are added to the contents of accumulator.• The result is stored in accumulator.• If the operand is memory location, its address isspecified by H-L pair. All flags are modified to reflectthe result of the addition.• Example: ADC C or ADC M
  42. 42. B C 20D EH LA 50B C 20D EH LA 71AFTER EXECUTIONBEFORE EXECUTIONADC CA=A+R+CYCY 1 CY 0CY 1 CY 0A 20 A 51H 20 L 50 H 20 L 50ADC MA=A+M+CYAFTER EXECUTIONBEFORE EXECUTION30 302050H 2050H
  43. 43. (3) Arithematic Instructions• ADI 8-bit data• The 8-bit data is added to the contents ofaccumulator.• The result is stored in accumulator.• Example: ADI 10 H
  44. 44. A 50 A 60AFTER EXECUTIONBEFORE EXECUTIONADI 10HA=A+DATA(8)
  45. 45. (4) Arithematic Instructions• ACI 8-bit data• The 8-bit data and the Carry Flag (CY) areadded to the contents of accumulator.• The result is stored in accumulator.• Example: ACI 20 H
  46. 46. CY 1 CY 0A 30 A 51AFTER EXECUTIONBEFORE EXECUTIONACI 20HA=A+DATA(8)+CY
  47. 47. (5) Arithematic Instructions• DAD Register pair• The 16-bit contents of the register pair areadded to the contents of H-L pair.• The result is stored in H-L pair.• If the result is larger than 16 bits, then CY isset.• Example: DAD D
  48. 48. AFTER EXECUTIONBEFORE EXECUTIONB CD 10 E 20H 20 L 50SPB CD 10 E 20H 30 L 70SPCY 0 CY 0DAD DHL=HL+R
  49. 49. (6) Arithematic Instructions• SUB R• SUB M• The contents of the register or memory location aresubtracted from the contents of the accumulator.• The result is stored in accumulator.• If the operand is memory location, its address isspecified by H-L pair.• Example: SUB B or SUB M
  50. 50. B 30 CD EH LA 50B 30 CD EH LA 20AFTER EXECUTIONBEFORE EXECUTIONSUB BA=A-RAFTER EXECUTIONBEFORE EXECUTIONA 50 A 40H10L20H10L20SUB MA=A-M10 101020H1020H
  51. 51. (7) Arithematic Instructions• SBB R• SBB M• The contents of the register or memory location andBorrow Flag (i.e.CY) are subtracted from the contents ofthe accumulator.• The result is stored in accumulator.• If the operand is memory location, its address is specifiedby H-L pair.• Example: SBB C or SBB M
  52. 52. B C 20D EH LA 40CY 1B C 20D EH LA 19CY 0SBB CA=A-R-CYAFTER EXECUTIONBEFORE EXECUTIONCY 1A 50H20L50CY 0A 39H20L50AFTER EXECUTIONBEFORE EXECUTIONSBB MA=A-M-CY10 102050H 2050H
  53. 53. (8) Arithematic Instructions• SUI 8-bit data• OPERATION: A=A-DATA(8)• The 8-bit immediate data is subtracted fromthe contents of the accumulator.• The result is stored in accumulator.• Example: SUI 45 H
  54. 54. (9) Arithematic Instructions• SBI 8-bit data• The 8-bit data and the Borrow Flag (i.e. CY) issubtracted from the contents of theaccumulator.• The result is stored in accumulator.• Example: SBI 20 H
  55. 55. CY 1A 50AFTER EXECUTIONBEFORE EXECUTIONCY 0A 29SBI 20HA=A-DATA(8)-CY
  56. 56. (10) Arithematic Instructions• INR R• INR M• The contents of register or memory location areincremented by 1.• The result is stored in the same place.• If the operand is a memory location, its addressis specified by the contents of H-L pair.• Example: INR B or INR M
  57. 57. B 10 CD EH LAB 11 CD EH LAAFTER EXECUTIONBEFORE EXECUTIONH20L50H20L5030 312050H 2050HAFTER EXECUTIONBEFORE EXECUTIONINR MM=M+1B 10 CD EH LABEFORE EXECUTIONINR BR=R+1
  58. 58. (11) Arithematic Instructions• INX Rp• The contents of register pair are incrementedby 1.• The result is stored in the same place.• Example: INX H
  59. 59. B CD EH 10 L 20B CD EH 11 L 21AFTER EXECUTIONBEFORE EXECUTIONSPSPINX HRP=RP+1
  60. 60. (12) Arithematic Instructions• DCR R• DCR M• The contents of register or memory location aredecremented by 1.• The result is stored in the same place.• If the operand is a memory location, its addressis specified by the contents of H-L pair.• Example: DCR E or DCR M
  61. 61. B CD E 19H LAAFTER EXECUTIONB CD E 20H LABEFORE EXECUTIONDCR ER=R-1H20L50H20L5021 202050HAFTER EXECUTIONBEFORE EXECUTIONDCR MM=M-12050H
  62. 62. (13) Arithematic Instructions• DCX Rp• The contents of register pair are decrementedby 1.• The result is stored in the same place.• Example: DCX D
  63. 63. B CD 10 E 20H LB CD 10 E 19H LAFTER EXECUTIONBEFORE EXECUTIONSPSPDCX DRP=RP-1
  64. 64. (1) Logical Instructions• ANA R• ANA M• AND specified data in register or memory withaccumulator.• Store the result in accumulator (A).• Example: ANA B, ANA M
  65. 65. B 10 CD EH LAB 0F CD EH LA 0AAFTER EXECUTIONANA BA=A and RB 0F CD EH LA AABEFORE EXECUTIONCY AC CY 0 AC 1AFTER EXECUTIONBEFORE EXECUTIONCY AC CY 0 AC 1A 11A 55H 20 L 50 H 20 L 50B3 B32050HANA MA=A and M2050H1010 1010=AAH0000 1111=0FH0000 1010=0AH0101 0101=55H1011 0011=B3H0001 0001=11H
  66. 66. (2) Logical Instructions• ANI 8-bit data• AND 8-bit data with accumulator (A).• Store the result in accumulator (A)• Example: ANI 3FH
  67. 67. CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 1A 33ANI 3FHA=A and DATA(8)1011 0011=B3H0011 1111=3FH0011 0011=33H
  68. 68. (3) Logical Instructions• XRA Register (8-bit)• XOR specified register with accumulator.• Store the result in accumulator.• Example: XRA C
  69. 69. B 10 CD EH LAB C 2DD EH LA 87AFTER EXECUTIONXRA CA=A xor RB C 2DD EH LA AABEFORE EXECUTIONCY AC CY 0 AC 01010 1010=AAH0010 1101=2DH1000 0111=87H
  70. 70. (4) Logical Instructions• XRA M• XOR data in memory (memory locationpointed by H-L pair) with Accumulator.• Store the result in Accumulator.• Example: XRA M
  71. 71. H 20 L 50A 55AFTER EXECUTIONXRA MA=A xor MBEFORE EXECUTIONCY AC CY 0 AC 00101 0101=55H1011 0011=B3H1110 0110=E6HH 20 L 50A E6B3 B32050H 2050H
  72. 72. (5) Logical Instructions• XRI 8-bit data• XOR 8-bit immediate data with accumulator (A).• Store the result in accumulator.• Example: XRI 39H
  73. 73. CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A 8AXRI 39HA=A xor DATA(8)1011 0011=B3H0011 1001=39H1000 1010=8AH
  74. 74. (6) Logical Instructions• ORA Register• OR specified register with accumulator (A).• Store the result in accumulator.• Example: ORA B
  75. 75. AFTER EXECUTIONBEFORE EXECUTIONCY ACORA BA=A or R1010 1010=AAH0001 0010=12H1011 1010=BAHB 12 CD EH LA AAB 12 CD EH LA BACY 0 AC 0
  76. 76. (7) Logical Instructions• ORA M• OR specified register with accumulator (A).• Store the result in accumulator.• Example: ORA M
  77. 77. AFTER EXECUTIONBEFORE EXECUTIONCY ACORA MA=A or M0101 0101=55H1011 0011=B3H1111 0111=F7HH 20 L 50A 55 A F7CY 0 AC 0H 20 L 50B3 B32050H 2050H
  78. 78. (8) Logical Instructions• ORI 8-bit data• OR 8-bit data with accumulator (A).• Store the result in accumulator.• Example: ORI 08H
  79. 79. CY ACA B3AFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A BBORI 08HA=A or DATA(8)1011 0011=B3H0000 1000=08H1011 1011=BBH
  80. 80. (9) Logical Instructions• CMP Register• CMP M• Compare specified data in register or memorywith accumulator (A).• Store the result in accumulator.• Example: CMP D or CMP M
  81. 81. B 10 CD EH LAB CD B9 EH LA B8AFTER EXECUTIONCMP DA-RB CD B9 EH LA B8BEFORE EXECUTIONCY Z CY 0 Z 0AFTER EXECUTIONBEFORE EXECUTIONCY Z CY 0 Z 1A B8A B8H 20 L 50 H 20 L 50B8 B82050HCMP MA-M2050HA>R: CY=0,Z=0A=R: CY=0,Z=1A<R: CY=1,Z=0A>M: CY=0,Z=0A=M: CY=0,Z=1A<M: CY=1,Z=0
  82. 82. (10) Logical Instructions• CPI 8-bit data• Compare 8-bit immediate data withaccumulator (A).• Store the result in accumulator.• Example: CPI 30H
  83. 83. CY ZA BAAFTER EXECUTIONBEFORE EXECUTIONCY 0 AC 0A BACPI 30HA-DATAA>DATA: CY=0,Z=0A=DATA: CY=0,Z=1A<DATA: CY=1,Z=01011 1010=BAH
  84. 84. (11) Logical Instructions• STC• It sets the carry flag to 1.• Example: STC
  85. 85. CY 0AFTER EXECUTIONBEFORE EXECUTIONCY 1STCCY=1
  86. 86. (12) Logical Instructions• CMC• It complements the carry flag.• Example: CMC
  87. 87. CY 1AFTER EXECUTIONBEFORE EXECUTIONCY 0CMC
  88. 88. (13) Logical Instructions• CMA• It complements each bit of the accumulator.• Example: CMA
  89. 89. (14) Logical Instructions• RLC• Rotate accumulator left• Each binary bit of the accumulator is rotated leftby one position.• Bit D7 is placed in the position of D0 as well asin the Carry flag.• CY is modified according to bit D7.• Example: RLC.
  90. 90. B7 B6 B5 B4 B3 B2 B1 B0CYB6 B5 B4 B3 B2 B1 B0 B7B7AFTER EXECUTIONBEFORE EXECUTION
  91. 91. (15) Logical Instructions• RRC• Rotate accumulator right• Each binary bit of the accumulator is rotated right byone• position.• Bit D0 is placed in the position of D7 as well as in theCarry flag.• CY is modified according to bit D0.• Example: RRC.
  92. 92. B7 B6 B5 B4 B3 B2 B1 B0 CYB0 B7 B6 B5 B4 B3 B2 B1 B0AFTER EXECUTIONBEFORE EXECUTION
  93. 93. (16) Logical Instructions• RAL• Rotate accumulator left through carry• Each binary bit of the accumulator is rotated leftby one position through the Carry flag.• Bit D7 is placed in the Carry flag, and the Carryflag is placed in the least significant position D0.• CY is modified according to bit D7.• Example: RAL.
  94. 94. B7 B6 B5 B4 B3 B2 B1 B0CYB6 B5 B4 B3 B2 B1 B0 CYB7AFTER EXECUTIONBEFORE EXECUTION
  95. 95. (17) Logical Instructions• RAR• Rotate accumulator right through carry• Each binary bit of the accumulator is rotated leftby one position through the Carry flag.• Bit D7 is placed in the Carry flag, and the Carryflag is placed in the least significant position D0.• CY is modified according to bit D7.• Example: RAR
  96. 96. B7 B6 B5 B4 B3 B2 B1 B0 CYCY B7 B6 B5 B4 B3 B2 B1 B0AFTER EXECUTIONBEFORE EXECUTION
  97. 97. Concept of Subroutine• In 8085 microprocessor a subroutine is aseparate program written aside from mainprogram ,this program is basically theprogram which requires to be executedseveral times in the main program.• The microprocessor can call subroutine anytime using CALL instruction. after thesubroutine is executed the subroutine handsover the program to main program using RETinstruction.
  98. 98. Branching Instructions• The branch group instructions allows themicroprocessor to change the sequence ofprogram either conditionally or under certaintest conditions. The group includes,• (1) Jump instructions,• (2) Call and Return instructions,• (3) Restart instructions,
  99. 99. (1) Branching Instructions• JUMP ADDRESS• BEFORE EXECUTION AFTER EXECUTION• Jump unconditionally to the address.• The instruction loads the PC with the addressgiven within the instruction and resumes theprogram execution from specified location.• Example: JMP 200HPC PC 2000JMP 2000H
  100. 100. Conditional Jumps
  101. 101. (2) Branching Instructions• CALL address• Call unconditionally a subroutine whosestarting address given within theinstruction and used to transferprogram control to a subprogram orsubroutine.• Example: CALL 2000H
  102. 102. Conditional CallsInstruction Code Description Condition for CALLCC Call on carry CY=1CNC Call on not carry CY=0CP Call on positive S=0CM Call on minus S=1CPE Call on parity even P=1CPO Call on parity odd P=0CZ Call on zero Z=1CNZ Call on not zero Z=0
  103. 103. (3) Branching Instructions• RET• Return from the subroutine unconditionally.• This instruction takes return address fromthe stack and loads the program counterwith this address.• Example: RET
  104. 104. SP 27FDPC0062SP 27FFPC 62000062AFTER EXECUTIONBEFORE EXECUTIONRET27FFH27FEH27FDH27FFH27FEH27FDH
  105. 105. (4) Branching Instructions• RST n• Restart n (0 to 7)• This instruction transfers the programcontrol to a specific memory address. Theprocessor multiplies the RST number by 8 tocalculate the vector address.• Example: RST 6
  106. 106. SP 3000PC 2000SP 2999PC 00300120AFTER EXECUTIONBEFORE EXECUTIONRST 63000H2FFFH2FFEHSP-1ADDRESS OF THE NEXT INSTRUCTION IS 2001H3000H2FFFH2FFEH
  107. 107. Vector Address For ReturnInstructionsInstruction Code Vector AddressRST 0 0*8=0000HRST 1 0*8=0008HRST 2 0*8=0010HRST 3 0*8=0018HRST 4 0*8=0020HRST 5 0*8=0028HRST 6 0*8=0030HRst 7 0*8=0038H
  108. 108. (1) Control Instructions• NOP• No operation• No operation is performed.• The instruction is fetched and decoded but nooperation is executed.• Example: NOP
  109. 109. (2) Control Instructions• HLT• Halt• The CPU finishes executing the currentinstruction and halts any further execution.• An interrupt or reset is necessary to exit fromthe halt state.• Example: HLT
  110. 110. (3) Control Instructions• RIM• Read Interrupt Mask• This is a multipurpose instruction used to read thestatus of interrupts 7.5, 6.5, 5.5 and read serial datainput bit.• The instruction loads eight bits in the accumulatorwith the following interpretations.• Example: RIM
  111. 111. RIM INSTRUCTIONRIM INSTRUCTION
  112. 112. • SIM• Set Interrupt Mask• This is a multipurpose instruction and used toimplement the 8085 interrupts 7.5, 6.5, 5.5, andserial data output.• The instruction interprets the accumulatorcontents as follows.• Example: SIM
  113. 113. SIM Instruction
  114. 114. END OFINSTRUCTION SET

×