Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the program in Notepad and run it successfully in SPIM before uploading it to eCampus by the due date. If not running correctly, include

image text in transcribed

Write the program in Notepad and run it successfully in SPIM before uploading it to eCampus by the due date. If not running correctly, include comments on what assembly error or output you are getting Your program is to print the binary representation of a decimal number using a divide by 2 conversion routine 1. Use svscall 4 to prompt for a number between -128 and 127 as listed in the data declaration label prompt: 2. Input a number (using svscall5) 3. If the number is not within the limits, print message at label err: and try again. 4. Convert this decimal number to binary and output its binary representation to the console using divide by 2 method 4a. Store each remainder as its ASCII code at memory space1 output the result with svscall 4 after a header as listed in the data declaration label 5. The magnitude of the number will always be 8 bits with MSB-1 for negative numbers and 0 for positive numbers. 6. The program will continue prompting for a number as long as y is entered as listed in the data declaration label 6a. If any other character is entered, the program prints the message at label term: in the data declaration and exits the program. Hint The 8-bit binary representation of a negative number m is the same as that of positive number equal to 258 m. The beginning of the program and the data declaration are given below # Program to convert a number between-128 and 127 to its binary equivalent and # outputs its binary representation to the console text main: data prompt:-asciiz"ln Input a decimal number between -128 and 127: " aas -ass" errascizn input error try again!" term oewio: -asciiz "Do you want to try another number? (y for yes)" "In Binary repr esentation is In Program terminated Write the program in Notepad and run it successfully in SPIM before uploading it to eCampus by the due date. If not running correctly, include comments on what assembly error or output you are getting Your program is to print the binary representation of a decimal number using a divide by 2 conversion routine 1. Use svscall 4 to prompt for a number between -128 and 127 as listed in the data declaration label prompt: 2. Input a number (using svscall5) 3. If the number is not within the limits, print message at label err: and try again. 4. Convert this decimal number to binary and output its binary representation to the console using divide by 2 method 4a. Store each remainder as its ASCII code at memory space1 output the result with svscall 4 after a header as listed in the data declaration label 5. The magnitude of the number will always be 8 bits with MSB-1 for negative numbers and 0 for positive numbers. 6. The program will continue prompting for a number as long as y is entered as listed in the data declaration label 6a. If any other character is entered, the program prints the message at label term: in the data declaration and exits the program. Hint The 8-bit binary representation of a negative number m is the same as that of positive number equal to 258 m. The beginning of the program and the data declaration are given below # Program to convert a number between-128 and 127 to its binary equivalent and # outputs its binary representation to the console text main: data prompt:-asciiz"ln Input a decimal number between -128 and 127: " aas -ass" errascizn input error try again!" term oewio: -asciiz "Do you want to try another number? (y for yes)" "In Binary repr esentation is In Program terminated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions