Question

In: Computer Science

Im having issues with this project, I keep geting errors and idk why. here are the...

Im having issues with this project, I keep geting errors and idk why.

here are the instructions for the project:

"Create  "simple integer calculator using the MARIE computer.
The program should execute as follows:
Using the INPUT instruction wait for the user to enter a decimal number.
Using the INPUT instruction wait for the user to enter a second decimal number.
Using the INPUT instruction wait for the user to enter the character +, - or *.
Perform the desired addition, subtraction or multiplication operation.
Store the result in a variable in memory.
Display the result via the OUTPUT instruction.
The multiply can be done by repeated additions. For example, 12 * 3 would be calculated as 12 + 12 + 12."


What I have so far:

INPUT
Store X
INPUT
Store Y
INPUT
Store c
Subt 43
/ Skipcond can be used here if c<0 then its Multiplication , if c=0 then its Addition , if c>0 then its substraction
loop,Load num
Add X
Store num
Load Y
Subt one
Store Y
Skipcond 400
Jump loop /no
Load num
Output
Halt/Declarelabelshere
X, DEC 0
Y, DEC 0
one, DEC 1
num, DEC 0
c, DEC 0
A, DEC 42
B, DEC 43
C, DEC 45


what I get when I run:

Assembly listing for: Calc project.mas
                Assembled: Tue Oct 13 17:14:46 CDT 2020

000 5000 |         INPUT             
001 2012 |         STORE X           
002 5000 |         INPUT             
003 2013 |         STORE Y           
004 5000 |         INPUT             
005 2016 |         STORE c           
006 4043 |         SUBT 043          
         |                          / Skipcond can be used here if c0 then its Multiplication , if c=0 then its Addition , if c>0 then its substraction
007 ???? |  loop   NUM               
   **** Instruction not recognized.
   **** Missing operand.
008 3012 |         ADD X             
009 2015 |         STORE num         
00A 1013 |         LOAD Y            
00B 4014 |         SUBT one          
00C 2013 |         STORE Y           
00D 8400 |         SKIPCOND 400      
00E 9007 |         JUMP loop        /no
00F 1015 |         LOAD num          
010 6000 |         OUTPUT            
011 7000 |         HALT             /Declarelabelshere
012 0000 |  X      DEC 0             
013 0000 |  Y      DEC 0             
014 0001 |  one    DEC 1             
015 0000 |  num    DEC 0             
016 0000 |  c      DEC 0             
017 002A |  A      DEC 42            
018 002B |  B      DEC 43            
019 002D |  C      DEC 45            

2 errors found.  Assembly unsuccessful.

         SYMBOL TABLE
         --------------------------------------------------
          Symbol | Defined | References 
         --------+---------+-------------------------------
          A      |   017   | 
          B      |   018   | 
          C      |   019   | 
          X      |   012   | 001, 008
          Y      |   013   | 003, 00A, 00C
          c      |   016   | 005
          loop   |   007   | 00E
          num    |   015   | 009, 00F
          one    |   014   | 00B

Solutions

Expert Solution

Greetings!!

Code:

            INPUT                         /READ X

            STORE X                    /STORE X

            INPUT                         /READ Y

            STORE Y                    /STORE Y

            INPUT                         /READ DECIMAL VALUE OF OPERATOR

            STORE C                    /STORE OPERATOR

            SUBT OP                    /SUBTRACT 43

            SKIPCOND 800         /CHECK AC>0, THEN MUL           

            JUMP ADSUB            /ELSE ADSUB

            JUMP MUL   

ADSUB,          SKIPCOND 000/AC<0, THEN SUB

            JUMP ADD                /ELSE ADD

            JUMP SUB

ADD,   LOAD X                     /ADDITION

            ADD Y

            STORE ANS               /STORE ANSWER

            JUMP OUT                 /DISPLAY

SUB, LOAD X                     /SUBTRACTION

            SUBT Y

            STORE ANS               /STORE ANSWER

            JUMP OUT                 /DISPLAY

MUL, LOAD Y                     /LOAD MULTIPLIER

            SUBT ONE                 /MULTIPLIER - 1

            STORE Y                    /SAVE

            LOAD ANS                /LOAD ANS

            ADD X                        /REPEATED ADDITION

            STORE ANS

            LOAD Y                     /LOAD MULTIPLIER

            SKIPCOND 400         /IF MULTIPLIER IS 0,THEN LOAD ANSWER

            JUMP MUL                /ELSE REPEAT ADDITION

            LOAD ANS                /LOAD ANS OR DISPLAY

OUT,   OUTPUT

            HALT

X,        DEC 0

Y,        DEC 0

C,        DEC 0

OP,      DEC 43

ONE,   DEC 1

ANS,   DEC 0

Output screenshots:

Addition:34+45=79

Subtraction: 78-67=11

Multiplication: 23 x 15 = 345

Hope this helps


Related Solutions

Im trying to figure out the errors as to why these test case will not work...
Im trying to figure out the errors as to why these test case will not work for myvector.h. The issue I have with these test cases is the fact that when I implement these test cases into a grader the program declares that it is not working. So I need help in myvector.h to make the test cases work for my function. myvector.h #pragma once #include // print debugging #include // malloc, free using namespace std; template class myvector {...
I get errors in my merge method and Im not sure how to fix it to...
I get errors in my merge method and Im not sure how to fix it to make the code work public class OrderedApp1 { public static void main(String[] args) {    int maxSize = 100; // array size int searchKey = 55; OrdArray1 arr, a1, a2, a3; // reference to arrays arr = new OrdArray1(maxSize); // create the arrays a1 = new OrdArray1(maxSize); a2 = new OrdArray1(maxSize); a3 = new OrdArray1(maxSize);    //int a3[] =new int [ a1.length + a2.length];...
I working on this program in C++ and I keep getting 20 errors of the same...
I working on this program in C++ and I keep getting 20 errors of the same type again.cpp:36:11: error: use of undeclared identifier 'Polynomial' int main() { // create a list of polinomials vector<Polynomial> polynomials; // welcome message cout << "Welcome to Polynomial Calculator" << endl; int option = 0; while (option != 6) { // display menu displayMenu(); // get user input; cin >> option; if (option == 1) { cout << "Enter a polynomial :" << endl; string...
please , im sorting by name, address, dependent and hours. i got a lot of errors...
please , im sorting by name, address, dependent and hours. i got a lot of errors i need help please. Thanks package application; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; class Emprec { String name; String address; double hours; double rate; int dependents; char gender; boolean degree; // This is the classes's constructor !!!! Emprec(String name, String address, String hours,String dependents) { try { this.name = name; this.address = address; this.hours = Double.valueOf(hours).doubleValue(); this.dependents = Integer.parseInt(dependents); } catch (NumberFormatException...
Hi, Working on a project in my group for class and I am having some issues...
Hi, Working on a project in my group for class and I am having some issues My part is current state of the business. It is a store and the annual sales are $460,000 Other info I have is: Ownership and Compensation; Percent Ownership Personal Investment Mitchell George, Founder & CEO 25% $125,000Katie Beauseigneur, COO 15% $75,000 Melissa Dunnells, CFO15% $75,000 Also, a medium coffee price from store is $3.75 Sarah Griffin, Marketing Officer 10% $50,000 Katharina Ferry, HR Director10%...
For this discussion, comment on any programming errors you encountered. Did the same issues keep recurring?
For this discussion, comment on any programming errors you encountered. Did the same issues keep recurring?
I keep getting minor errors I can't figure out and I don't know how to convert...
I keep getting minor errors I can't figure out and I don't know how to convert decimal .10 to percentage 10% either.   With these functions defined now expand the program for a company who gives discounts on items bought in bulk. Create a main function and inside of it ask the user how many different items they are buying. For each item have the user input a price and quantity, validating them with the functions that you wrote. Use your...
I am currently having trouble understanding/finding the errors in this python code. I was told that...
I am currently having trouble understanding/finding the errors in this python code. I was told that there are 5 errors to fix. Code: #!/usr/bin/env python3 choice = "y" while choice == "y": # get monthly investment monthly_investment = float(input(f"Enter monthly investment (0-1000):\t")) if not(monthly_investment > 0 and monthly_investment <= 100): print(f"Entry must be greater than 0 and less than or equal to 1000. " "Please start over.")) #Error 1 extra ")" continue # get yearly interest rate yearly_interest_rate = float(input(f"Enter...
I have to write a random password generator in Python 3 and im having some trouble...
I have to write a random password generator in Python 3 and im having some trouble writing the code and i dont really know where to start. The prompt goes as such: The problem in this assignment is to write a Python program that uses functions to build (several options of) passwords for the user. More specifically, your program will do the following: 1. Prompt the user for the length of the password to be generated. Call this length lenP....
Im writing an unknown project for microbiology and I have to briefly introduce the subject of...
Im writing an unknown project for microbiology and I have to briefly introduce the subject of microbiology.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT