Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!