Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that does the following: Initialize an accumulator ( variable or register ) to zero. Display a prompt to the user: Enter a
Write a program that does the following:
Initialize an accumulator variable or register to zero.
Display a prompt to the user: Enter a number:
Use the system call function to read a string into a buffer.
If the first character in your buffer is the New Line character
Go to step
If the first character in your buffer is the minus sign, remember that so you can reverse the sign of the number.
Convert the number to a binary integer one digit at a time. If there are any characters other than decimal digits:
If it is not a New Line, show an error message and go back to step
If it is a new line, continue to
Add the binary number to your accumulator.
Go to step
Print the sum of the numbers, the total number of valid numbers entered, and the total number of errors.
Exit the program.
Write this program in MIPS assembly language using the MARS simulator.
For example, if the user enters
Your program should mark this as an error, since it contains two minus signs.
Error Minus sign, if present, must be first.
Your program would print what is shown in red below:
Error:
Error:
Sumsum of and
Count of valid numbers
Total number of errors:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started