iostream> using namespace std; const numLoops = 10; int main(){   int x = 0;    do {       cout << x << endl;      ++x;   } while (x < numLoops);   return 0; } pep/9 code i tried to translate BR main numLoops: .EQUATE 10 x: .EQUATE 0 main: SUBSP 2,i LDWA 0, i STWA x, s do: cpwa numLoops, i   DECO x, s LDBA '\n', i STBA 0XFC16, d LDWA x, s ADDA 1, i STWA x, d     while: Ldwa x, cpwa numLoops,s BRLT do   STOP .END

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter3: Assignment, Formatting, And Interactive Input
Section3.6: A Case Study: Acid Rain
Problem 9E
icon
Related questions
icon
Concept explainers
Question

I need help in this program. I am trying to create a pep/9 assembly program which uses do while loops and prints number from 0 to 9. i have provided c++ program and the pep/9 i am trying to translate it. please solve the pep/9 assembly language and show the screenshot of it.

c++ code

#include <iostream>
using namespace std;

const numLoops = 10;
int main(){
  int x = 0;
   do { 
     cout << x << endl;
     ++x;
  } while (x < numLoops);

  return 0;
}

pep/9 code i tried to translate

BR main

numLoops: .EQUATE 10

x: .EQUATE 0

main: SUBSP 2,i

LDWA 0, i

STWA x, s

do: cpwa numLoops, i

 

DECO x, s

LDBA '\n', i

STBA 0XFC16, d

LDWA x, s

ADDA 1, i

STWA x, d

 

 

while: Ldwa x,

cpwa numLoops,s

BRLT do

 

STOP

.END

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr