Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a ASSEMBLY MIPS code ONLY: User Integer Transformations of the program begins by prompting for an integer from the user within a valid

Please write a ASSEMBLY MIPS code ONLY:

User Integer Transformations of the program begins by prompting for an integer from the user within a valid range. 1. Prompt the user with the string, int_prompt. Use the read integer syscall to obtain an integer value from the user. 2. Check that the integer is in the 2's complement range represented by = 2" (-65536 to 65536). 3. Validate the user input using a simple while loop. If the user enters a mumber outside of this range, the program will print "Bad Input" and prompt the user for input again umtil a valid integer is entered by the user. 4. Once a valid value is entered by the user, make 2 copies of the integer value (i.e. copy the value into two other registers that the program is not using). There should be the original number and two copies, so the number is in 3 different registers. 5. Print the integer back to the terminal along with its binary representation.

6.The first transtormation the program pertorms on the integer value is to convert the bnary representation to its equivalent is complement oir represenauo 7. Manipulate the bits of the value mto the I's complement representation, if necessary. Use a conditional if stareent to only manpulare tre vaue Waen necessaly reat tne vane a5 TU. Think back to lecture about how numbers are represented in different formats and the relations berween tne Iomats. 15. Print the I's complement bit representahon usmg the standard MPS nteger syscall (2s complement value), tne binary syscall, START CODE:

.globl main

.data str_prompt: .asciiz "Enter a ASCII string (max 8 characters): " int_prompt: .asciiz "Enter an integer in range +/- 2^16: " int_badinput: .asciiz "Bad Input! " .align 2 inputString: # additional label refering to the same address as 1stChar Char1: .space 1 Char2: .space 1 Char3: .space 1 Char4: .space 1 Char5: .space 1 Char6: .space 1 Char7: .space 1 Char8: .space 1 forNewline: .space 1 forNull: .space 1

.text

main: # Your code goes here

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions