SlideShare a Scribd company logo
4/5/2023 1
Excercise
PC Based Programming
PROFESSIONAL DIPLOMA IN INDUSTRIAL
ENGINEERING
DR. FAZRUL FAIZ ZAKARIA
4/5/2023 2
EX.1
• Write an 8085-assembly language
program to add two 8-bit numbers
stored in memory locations 2000H and
2001H and store the result in memory
location 2002H.
Sol 1.
4/5/2023 3
LXI H, 2000H ; Load the address of the first number into the H-L pair
MOV A, M ; Move the first number into the accumulator
INX H ;
ADI M ; Add the second number to the accumulator
STA 2002H ; Store the result in memory location 2002H
HLT ; Halt the program
4/5/2023 4
EX.2
• Write an 8085-assembly language program to find
the largest number from a given array of 5 numbers
stored in memory locations 2000H to 2004H. Store
the largest number in memory location 2005H.
Assume that the numbers are signed and stored in
2's complement representation.
Sol 2.
4/5/2023 5
LXI H, 2000H ; Load the starting address of the array into H-L pair
MOV A, M ; Move the first number into accumulator
MOV B, A ; Move the first number into the B register for comparison
INX H ; Move to the next number in the array
MOV A, M ; Move the second number into accumulator
CMP B ; Compare the second number with the largest number stored in B
JC SKIP ; Jump if carry (i.e., if the second number is less than the largest number)
MOV B, A ; Move the second number into B if it is larger
SKIP: INX H ; Move to the next number in the array
MOV A, M ; Move the next number into accumulator
CMP B ; Compare it with the current largest
JNC CONTINUE ; If the current largest is greater or equal, move on to the next number
MOV B, A ; If accumulator is greater, set it as the new largest
CONTINUE:DCR C ; Decrement the counter
JNZ SKIP ; Jump to the skip loop if not zero, i.e., we have more numbers to process
MOV A, B ; Move the largest number stored in B into the accumulator
STA 2005H ; Store the largest number in memory location 2005H
HLT ; Halt the program
4/5/2023 6
EX.2
• An 8085-assembly language program is given below.
MVI A, B5H
MVI B, 0EH
XRI 69H
ADD B
ANI 9BH
CPI 9FH
STA 3010H
HLT
• After execution of the program line, what will the
flags' status be?

More Related Content

Similar to 8085_Excercise.pptx

03 addr mode & instructions
03 addr mode & instructions03 addr mode & instructions
03 addr mode & instructions
ShubhamBakshi14
 
8. 8085 programming example
8. 8085 programming example8. 8085 programming example
8. 8085 programming example
sandip das
 
microprocessor Laboratory experiments manual
microprocessor Laboratory experiments manualmicroprocessor Laboratory experiments manual
microprocessor Laboratory experiments manual
Ankit Kumar
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
cmkandemir
 
5.pptx
5.pptx5.pptx
5.pptx
Chanyalew21
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085 vijaydeepakg
 
Microprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. KawareMicroprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. Kaware
Prof. Swapnil V. Kaware
 
8085labmanual.pdf
8085labmanual.pdf8085labmanual.pdf
8085labmanual.pdf
SZahidNabiDar
 
Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)
Manoj Shahu
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
Vrushali Lanjewar
 
8085 instruction set
8085 instruction set8085 instruction set
8085 alp programs
8085 alp programs8085 alp programs
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
COMSATS Abbottabad
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture II
Dr.YNM
 
8085 Assembly programming.pptx
8085 Assembly programming.pptx8085 Assembly programming.pptx
8085 Assembly programming.pptx
bansidhar11
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdf
HimanshuPant41
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
JLoknathDora
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copymkazree
 
8086 alp
8086 alp8086 alp
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
Basil John
 

Similar to 8085_Excercise.pptx (20)

03 addr mode & instructions
03 addr mode & instructions03 addr mode & instructions
03 addr mode & instructions
 
8. 8085 programming example
8. 8085 programming example8. 8085 programming example
8. 8085 programming example
 
microprocessor Laboratory experiments manual
microprocessor Laboratory experiments manualmicroprocessor Laboratory experiments manual
microprocessor Laboratory experiments manual
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
 
5.pptx
5.pptx5.pptx
5.pptx
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
Microprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. KawareMicroprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. Kaware
 
8085labmanual.pdf
8085labmanual.pdf8085labmanual.pdf
8085labmanual.pdf
 
Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture II
 
8085 Assembly programming.pptx
8085 Assembly programming.pptx8085 Assembly programming.pptx
8085 Assembly programming.pptx
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdf
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
8086 alp
8086 alp8086 alp
8086 alp
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
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
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
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
 
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
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
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
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.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
 
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...
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 

8085_Excercise.pptx

  • 1. 4/5/2023 1 Excercise PC Based Programming PROFESSIONAL DIPLOMA IN INDUSTRIAL ENGINEERING DR. FAZRUL FAIZ ZAKARIA
  • 2. 4/5/2023 2 EX.1 • Write an 8085-assembly language program to add two 8-bit numbers stored in memory locations 2000H and 2001H and store the result in memory location 2002H.
  • 3. Sol 1. 4/5/2023 3 LXI H, 2000H ; Load the address of the first number into the H-L pair MOV A, M ; Move the first number into the accumulator INX H ; ADI M ; Add the second number to the accumulator STA 2002H ; Store the result in memory location 2002H HLT ; Halt the program
  • 4. 4/5/2023 4 EX.2 • Write an 8085-assembly language program to find the largest number from a given array of 5 numbers stored in memory locations 2000H to 2004H. Store the largest number in memory location 2005H. Assume that the numbers are signed and stored in 2's complement representation.
  • 5. Sol 2. 4/5/2023 5 LXI H, 2000H ; Load the starting address of the array into H-L pair MOV A, M ; Move the first number into accumulator MOV B, A ; Move the first number into the B register for comparison INX H ; Move to the next number in the array MOV A, M ; Move the second number into accumulator CMP B ; Compare the second number with the largest number stored in B JC SKIP ; Jump if carry (i.e., if the second number is less than the largest number) MOV B, A ; Move the second number into B if it is larger SKIP: INX H ; Move to the next number in the array MOV A, M ; Move the next number into accumulator CMP B ; Compare it with the current largest JNC CONTINUE ; If the current largest is greater or equal, move on to the next number MOV B, A ; If accumulator is greater, set it as the new largest CONTINUE:DCR C ; Decrement the counter JNZ SKIP ; Jump to the skip loop if not zero, i.e., we have more numbers to process MOV A, B ; Move the largest number stored in B into the accumulator STA 2005H ; Store the largest number in memory location 2005H HLT ; Halt the program
  • 6. 4/5/2023 6 EX.2 • An 8085-assembly language program is given below. MVI A, B5H MVI B, 0EH XRI 69H ADD B ANI 9BH CPI 9FH STA 3010H HLT • After execution of the program line, what will the flags' status be?