SlideShare a Scribd company logo
1 of 3
Write an assembly language program in the Pep/8 simulator that corresponds to the
following C++ program:
#include <iostream>
using namespace std;
int num1;
int num2;
int main() {
cin >> num1 >> num2;
cout << num2 << endl << num1 << endl;
return 0;
}
Solution
c++ Program:
#include<iostream>
using namespace std;
int num1;
int num2;
int main()
{
cin>>num1>>num2;
cout<<num2<<endl<<num1<<endl;
return 0;
}
Assembly Language:
BR main
Sum1: .WORD 0x0000
Sum2: .WORD 0x0000
Num1: .BLOCK 2
Num2: .BLOCK 2
Main: LDA sum1,sum2,d ; ‘d’ = direct
DECI num1,d
ADDA num1,d
STA sum1,d
DEC2 num2,d
STA sum2,d
DECO sum1,d
DECO sum2,d
STOP
.END
Write an assembly language program in the Pep-8 simulator that corresp.docx

More Related Content

More from karlynwih

Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxkarlynwih
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxkarlynwih
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxkarlynwih
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxkarlynwih
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxkarlynwih
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxkarlynwih
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxkarlynwih
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docxkarlynwih
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxkarlynwih
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxkarlynwih
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxkarlynwih
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docxkarlynwih
 

More from karlynwih (12)

Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docx
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docx
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docx
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docx
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docx
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docx
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docx
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docx
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docx
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docx
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docx
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docx
 

Recently uploaded

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Write an assembly language program in the Pep-8 simulator that corresp.docx

  • 1. Write an assembly language program in the Pep/8 simulator that corresponds to the following C++ program: #include <iostream> using namespace std; int num1; int num2; int main() { cin >> num1 >> num2; cout << num2 << endl << num1 << endl; return 0; } Solution c++ Program: #include<iostream> using namespace std; int num1; int num2; int main() {
  • 2. cin>>num1>>num2; cout<<num2<<endl<<num1<<endl; return 0; } Assembly Language: BR main Sum1: .WORD 0x0000 Sum2: .WORD 0x0000 Num1: .BLOCK 2 Num2: .BLOCK 2 Main: LDA sum1,sum2,d ; ‘d’ = direct DECI num1,d ADDA num1,d STA sum1,d DEC2 num2,d STA sum2,d DECO sum1,d DECO sum2,d STOP .END