SlideShare a Scribd company logo
MICROPROCESSOR 8085
LECTURE 14
INSTRUCTION SET-VI
PROGRAMMING EXAMPLE-IV
PROF. SANDIP DAS
INSTRUCTION CLASSIFICATION
• Data Transfer group
• Arithmetic group
• Logical group
• Branch group
• Stack, I/O and Machine Control group
IN port addr Input to accumulator from I/O port T-states: 10 Flags affected: none
M-cycle-3
OUT port addr Output from accumulator to I/O port T-states: 10 Flags affected: none
M-cycle-3
PUSH rp Push the content of register pair to stack T-states-12 Flags affected: none
M-cycle-3
PUSH PSW Push the content of program status word T-states-12 Flags
affected: none M-cycle-3
POP rp Pop the content of register pair from stack T-states-12 Flags affected: none
M-cycle-3
POP PSW Pop the content of PSW pair from stack T-states-12 Flags affected: none
M-cycle-3
HLT Stops the execution of instruction T-states-12 Flags affected: none
M-cycle-3
XTHL Exchange stack top with H-L T-states-16 Flags affected: none
M-cycle-5
SPHL Move the contents of H-L pair T-states-6 Flags affected: none
M-cycle-1
EI Enable interrupts T-states-4 Flags affected: none
STACK, I/O AND MACHINE CONTROL
GROUP
WRITE A PROGRAM FOR 8 BIT DIVISION
Memory address Labels Mnemonics, operands Comments
2000 LDA 2501H Get divisor in
Accumulator
2003 MOV C,A Move divisor in
register C
2005 LDA 2500H Get dividend in
Accumulator
2008 MVI B,00H Initialize Counter
200A LOOP CMP C Compare Divisor and
Dividend. Is
Dividend>Divisor?
200C JC AHEAD
200F SUB C Subtract dividend from
divisor
2011 INR B Increment Quotient
2012 JMP LOOP Unconditional Jump
2015 AHEAD STA 2503H Store remainder in 2503H
2018 MOV A,B Move quotient in
register B
Suppose
2500H-08H (Dividend)
2501H-03H (Divisor)
Step 1:
A=03H, C=03H
New value of A=08H,B=00H
Comparing of A and C, since
A>C, so-
A=08H
- C=03H
05H
Now, Increment B, so B=01H
Again Compare A and C, A>C.
Repeat Step 1.
Step 2:
A=05H, C=03H, Subtracting
we get 02H, Increment B,
B=02H
Thus, 02H is remainder and
stored in 2503H.
B is moved to A and then
moved to 2502H as quotient.
WRITE A PROGRAM TO FIND SQUARE OF A NUMBER FROM LOOK
UP TABLE
Memory address Mnemonics, operands Comments
2000 LDA 2500H Get data in accumulator
2003 MOV L,A Get data in
register L
2004 MVI H,26H Get 26 in register H
2006 MOV A,M Square of data in
accumulator
2007 STA 2501H Store square in 2501H
200A HLT Halt
Data
2500H-07D
Result
2501H-49D
Look Up Table
Address
Square
(Hex) (Decimal)
2600 00
2601 01
2602 04
2603 09
2604 16
2605 25
2606 36
2607 49
2608 64
2609 81

More Related Content

Similar to 11. 8085 programming example iii

Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
Shubham Singh
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
Swapnil Mishra
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
Sajan Agrawal
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
JLoknathDora
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
ssuser47c811
 
Ee2356 lab manual
Ee2356 lab manualEe2356 lab manual
Ee2356 lab manual
dhameee
 
MPMC LAB MANUAL EEE
MPMC LAB MANUAL EEEMPMC LAB MANUAL EEE
180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc
homeworkping10
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Katrina Little
 
Intel 8085 - Smallest number in a data array
Intel 8085 -  Smallest number in a data arrayIntel 8085 -  Smallest number in a data array
Intel 8085 - Smallest number in a data array
DEPARTMENT OF PHYSICS
 
8085 instruction set
8085 instruction set8085 instruction set
9. 8085 instruction set v
9. 8085 instruction set v9. 8085 instruction set v
9. 8085 instruction set v
sandip das
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
Ravi Anand
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
Jathin Kanumuri
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
Saumitra Rukmangad
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
Jathin Kanumuri
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
cmkandemir
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingAmitabh Shukla
 
Lec14
Lec14Lec14
8085-instruction-set.ppt
8085-instruction-set.ppt8085-instruction-set.ppt
8085-instruction-set.ppt
HarishRagavB
 

Similar to 11. 8085 programming example iii (20)

Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
Ee2356 lab manual
Ee2356 lab manualEe2356 lab manual
Ee2356 lab manual
 
MPMC LAB MANUAL EEE
MPMC LAB MANUAL EEEMPMC LAB MANUAL EEE
MPMC LAB MANUAL EEE
 
180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
 
Intel 8085 - Smallest number in a data array
Intel 8085 -  Smallest number in a data arrayIntel 8085 -  Smallest number in a data array
Intel 8085 - Smallest number in a data array
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
9. 8085 instruction set v
9. 8085 instruction set v9. 8085 instruction set v
9. 8085 instruction set v
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacing
 
Lec14
Lec14Lec14
Lec14
 
8085-instruction-set.ppt
8085-instruction-set.ppt8085-instruction-set.ppt
8085-instruction-set.ppt
 

More from sandip das

31. 8086 addressing modes
31. 8086 addressing modes31. 8086 addressing modes
31. 8086 addressing modes
sandip das
 
30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture
sandip das
 
29. 8086 microprocessor pin diagram
29. 8086 microprocessor pin diagram29. 8086 microprocessor pin diagram
29. 8086 microprocessor pin diagram
sandip das
 
28. 8251 programmable communication interface
28. 8251 programmable communication interface28. 8251 programmable communication interface
28. 8251 programmable communication interface
sandip das
 
27. 8259 programmable interrupt controller
27. 8259 programmable interrupt controller27. 8259 programmable interrupt controller
27. 8259 programmable interrupt controller
sandip das
 
26. 8255 control word programming
26. 8255 control word programming26. 8255 control word programming
26. 8255 control word programming
sandip das
 
25. 8255 programmable peripheral interface
25. 8255 programmable peripheral interface25. 8255 programmable peripheral interface
25. 8255 programmable peripheral interface
sandip das
 
24. direct memory access
24. direct memory access24. direct memory access
24. direct memory access
sandip das
 
23. serial and parallel data communication
23. serial and parallel data communication23. serial and parallel data communication
23. serial and parallel data communication
sandip das
 
22. interrupts ii
22. interrupts ii22. interrupts ii
22. interrupts ii
sandip das
 
21. interrupts
21. interrupts21. interrupts
21. interrupts
sandip das
 
20. io interfacing ii
20. io interfacing ii20. io interfacing ii
20. io interfacing ii
sandip das
 
19. io interfacing i
19. io interfacing i19. io interfacing i
19. io interfacing i
sandip das
 
18. memory interfacing iv
18. memory interfacing iv18. memory interfacing iv
18. memory interfacing iv
sandip das
 
17. memory interfacing iii
17. memory interfacing iii17. memory interfacing iii
17. memory interfacing iii
sandip das
 
16. memory interfacing ii
16. memory interfacing ii16. memory interfacing ii
16. memory interfacing ii
sandip das
 
15. memory interfacing i
15. memory interfacing i15. memory interfacing i
15. memory interfacing i
sandip das
 
14. 8085 programming example vi
14. 8085 programming example vi14. 8085 programming example vi
14. 8085 programming example vi
sandip das
 
13. 8085 programming example v
13. 8085 programming example v13. 8085 programming example v
13. 8085 programming example v
sandip das
 
12. 8085 programming example iv
12. 8085 programming example iv12. 8085 programming example iv
12. 8085 programming example iv
sandip das
 

More from sandip das (20)

31. 8086 addressing modes
31. 8086 addressing modes31. 8086 addressing modes
31. 8086 addressing modes
 
30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture
 
29. 8086 microprocessor pin diagram
29. 8086 microprocessor pin diagram29. 8086 microprocessor pin diagram
29. 8086 microprocessor pin diagram
 
28. 8251 programmable communication interface
28. 8251 programmable communication interface28. 8251 programmable communication interface
28. 8251 programmable communication interface
 
27. 8259 programmable interrupt controller
27. 8259 programmable interrupt controller27. 8259 programmable interrupt controller
27. 8259 programmable interrupt controller
 
26. 8255 control word programming
26. 8255 control word programming26. 8255 control word programming
26. 8255 control word programming
 
25. 8255 programmable peripheral interface
25. 8255 programmable peripheral interface25. 8255 programmable peripheral interface
25. 8255 programmable peripheral interface
 
24. direct memory access
24. direct memory access24. direct memory access
24. direct memory access
 
23. serial and parallel data communication
23. serial and parallel data communication23. serial and parallel data communication
23. serial and parallel data communication
 
22. interrupts ii
22. interrupts ii22. interrupts ii
22. interrupts ii
 
21. interrupts
21. interrupts21. interrupts
21. interrupts
 
20. io interfacing ii
20. io interfacing ii20. io interfacing ii
20. io interfacing ii
 
19. io interfacing i
19. io interfacing i19. io interfacing i
19. io interfacing i
 
18. memory interfacing iv
18. memory interfacing iv18. memory interfacing iv
18. memory interfacing iv
 
17. memory interfacing iii
17. memory interfacing iii17. memory interfacing iii
17. memory interfacing iii
 
16. memory interfacing ii
16. memory interfacing ii16. memory interfacing ii
16. memory interfacing ii
 
15. memory interfacing i
15. memory interfacing i15. memory interfacing i
15. memory interfacing i
 
14. 8085 programming example vi
14. 8085 programming example vi14. 8085 programming example vi
14. 8085 programming example vi
 
13. 8085 programming example v
13. 8085 programming example v13. 8085 programming example v
13. 8085 programming example v
 
12. 8085 programming example iv
12. 8085 programming example iv12. 8085 programming example iv
12. 8085 programming example iv
 

Recently uploaded

Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 

Recently uploaded (20)

Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 

11. 8085 programming example iii

  • 1. MICROPROCESSOR 8085 LECTURE 14 INSTRUCTION SET-VI PROGRAMMING EXAMPLE-IV PROF. SANDIP DAS
  • 2. INSTRUCTION CLASSIFICATION • Data Transfer group • Arithmetic group • Logical group • Branch group • Stack, I/O and Machine Control group
  • 3. IN port addr Input to accumulator from I/O port T-states: 10 Flags affected: none M-cycle-3 OUT port addr Output from accumulator to I/O port T-states: 10 Flags affected: none M-cycle-3 PUSH rp Push the content of register pair to stack T-states-12 Flags affected: none M-cycle-3 PUSH PSW Push the content of program status word T-states-12 Flags affected: none M-cycle-3 POP rp Pop the content of register pair from stack T-states-12 Flags affected: none M-cycle-3 POP PSW Pop the content of PSW pair from stack T-states-12 Flags affected: none M-cycle-3 HLT Stops the execution of instruction T-states-12 Flags affected: none M-cycle-3 XTHL Exchange stack top with H-L T-states-16 Flags affected: none M-cycle-5 SPHL Move the contents of H-L pair T-states-6 Flags affected: none M-cycle-1 EI Enable interrupts T-states-4 Flags affected: none STACK, I/O AND MACHINE CONTROL GROUP
  • 4. WRITE A PROGRAM FOR 8 BIT DIVISION Memory address Labels Mnemonics, operands Comments 2000 LDA 2501H Get divisor in Accumulator 2003 MOV C,A Move divisor in register C 2005 LDA 2500H Get dividend in Accumulator 2008 MVI B,00H Initialize Counter 200A LOOP CMP C Compare Divisor and Dividend. Is Dividend>Divisor? 200C JC AHEAD 200F SUB C Subtract dividend from divisor 2011 INR B Increment Quotient 2012 JMP LOOP Unconditional Jump 2015 AHEAD STA 2503H Store remainder in 2503H 2018 MOV A,B Move quotient in register B Suppose 2500H-08H (Dividend) 2501H-03H (Divisor) Step 1: A=03H, C=03H New value of A=08H,B=00H Comparing of A and C, since A>C, so- A=08H - C=03H 05H Now, Increment B, so B=01H Again Compare A and C, A>C. Repeat Step 1. Step 2: A=05H, C=03H, Subtracting we get 02H, Increment B, B=02H Thus, 02H is remainder and stored in 2503H. B is moved to A and then moved to 2502H as quotient.
  • 5. WRITE A PROGRAM TO FIND SQUARE OF A NUMBER FROM LOOK UP TABLE Memory address Mnemonics, operands Comments 2000 LDA 2500H Get data in accumulator 2003 MOV L,A Get data in register L 2004 MVI H,26H Get 26 in register H 2006 MOV A,M Square of data in accumulator 2007 STA 2501H Store square in 2501H 200A HLT Halt Data 2500H-07D Result 2501H-49D Look Up Table Address Square (Hex) (Decimal) 2600 00 2601 01 2602 04 2603 09 2604 16 2605 25 2606 36 2607 49 2608 64 2609 81