Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MIPS assembly language program that takes a decimal integer from a user and outputs a 32-bit binary number. Example: For the following user

Write a MIPS assembly language program that takes a decimal integer from a user and outputs a 32-bit binary number.

Example: For the following user inputs, your program should output the following binary numbers.

User Enters: 5

Output: 0000000000000000000000000000101

User Enters: 500

Output: 0000000000000000000000111110100

User Enters: 100000

Output: 0000000000000011000011010100000 (NOTE - Do not use syscalls #35 or #36 )

This is my code could you pls help me on this????

# READ integer from user li $v0, 5 # service 5 (read integer) syscall add $t0, $zero, $v0 # Get number read from previous syscall and put it in $t0

# set up a loop for the Loop:

#bit mask for the first byte li $t1, 255 and $t3, $t0, $t1

# t0 is 1 followed by 31 0s addi $t1, $zero, 1 sll $t1, $t0, 31 #

bne $s1, $zero, Loop # Keep looping if loop counter is not zero # dispaly the value into ascii format so you can show the result into 0'1 in binary addi $t5, $zero, 1 #this willl print the charect addi $a0, $zero, 48 #ACII VALUE syscall # //move $a0, $t3 # Output the ASCII character why this is adding insted?? 3line below # //li $v0, 1 # //syscall

#Display number add $a0, $zero, $t3 li $v0, 1 # service 1 (print integer) syscall Exit:

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 Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

My opinions/suggestions are valued.

Answered: 1 week ago