SlideShare a Scribd company logo
1 of 6
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 & instructionsShubhamBakshi14
 
8. 8085 programming example
8. 8085 programming example8. 8085 programming example
8. 8085 programming examplesandip das
 
microprocessor Laboratory experiments manual
microprocessor Laboratory experiments manualmicroprocessor Laboratory experiments manual
microprocessor Laboratory experiments manualAnkit 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 Instructionscmkandemir
 
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. KawareProf. Swapnil V. Kaware
 
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
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086COMSATS Abbottabad
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture IIDr.YNM
 
8085 Assembly programming.pptx
8085 Assembly programming.pptx8085 Assembly programming.pptx
8085 Assembly programming.pptxbansidhar11
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdfHimanshuPant41
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction setJLoknathDora
 
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
 
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

Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsmeharikiros2
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfsumitt6_25730773
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 

Recently uploaded (20)

Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 

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?