Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete this following MIPS assembly language program that takes a decimal integer from a user and outputs a 8-bit binary number. Basically, the only work

Complete this following MIPS assembly language program that takes a decimal integer from a user and outputs a 8-bit binary number.

Basically, the only work to do on this code is to :

1- Print a space character between each of the four (4) bits

2- Display a meaningful error message and terminate if the number is out of range. Recall that the largest signed one byte number is 0111 11112= 27 - 1 = 127. The smallest possible number is 1000 00002 = -27 = -128.

The MIPS Code :

# gets user input

.data

msg: .asciiz "Enter a number: "

.text

li $v0, 4

la $a0, msg

syscall

# Reads integer

li $v0, 5 # take 5 times

syscall

add $t0, $zero, $v0

# use loop

li $t1, 7

Loop:

blt $t1, 0, EndLoop

srlv $t2, $t0, $t1

and $t2, 1

# print the result

li $v0, 1

move $a0, $t2

syscall

#show decrement

sub $t1, $t1, 1

b Loop

EndLoop:

# Exit

li $v0, 10

syscall

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

1. What might have led to the misinformation?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago