Engineering
Engineering, 28.02.2020 19:04, oryunnis

Write a MIPS program that utilizes subroutine. This program should take input of an integer from the user and then pass that number to BaseChange subroutine. The subroutine should then calculate the binary form of that number by use of the stack and display the result to the user. An Example of sample input and output would be:Input a number in decimal form: 5The number 5 in binary is: 00000000000000000000000000000101Thi s is what is what I have so fardatastr: .asciiz "\nInput a number in decimal form: "str1: .asciiz "\nThe number in binary is \n"newLine: .asciiz "\n".textli $v0, 4 # Display promptla $a0, strsyscallli $v0, 5 # User inputsyscalladd $s0, $v0, $0 # Store $v0 to $s0jal binary # Jump to subroutine binarymain:li $v0, 4la $a0, str1 # Display final promptsyscallli $v0, 1add $a0, $s5, $0 # Display integersyscallli $v0, 4la $a0, newLine # New linesyscallli $v0, 10 # Terminate programsyscallbinary:bne $0, $s0, mainli $t0, 2 # Hardcode to 2 for divisiondiv $s0, $t0 # divide user input by 2mfhi $s2 # Remaindermflo $s3 # Quotientaddi $sp, $sp, -4 # Decrement by 4sw $s2, 0($sp) # Store $sp to $s1addi $s0, $s0, 1j binary # Jump backjr $ra

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, 19deleonl
Coiled springs ought to be very strong and stiff. si3n4 is a strong, stiff material. would you select this material for a spring? explain.
Answers: 2
image
Engineering, 04.07.2019 18:10, redrosesxx
Water at 55c flows across a flat plate whose surface temperature is held constant at 95c. if the temperature gradient at the plate's surface for a given value of x is 18 c/mm, find a) local heat transfer coefficient. b) heat flux
Answers: 3
image
Engineering, 04.07.2019 18:10, colin774
The higher the astm grain size number, the finer the gran is. a)-true b)-false
Answers: 2
image
Engineering, 04.07.2019 18:20, karatsgrande3772
Determine the damped natural frequencies and the steady state response of a decoupled damped forced two degrees of freedom system. 10รค1 + 2q1 20q1 10 cos t; 10q2 +4q2 + 40q2 10 cos t
Answers: 3
Do you know the correct answer?
Write a MIPS program that utilizes subroutine. This program should take input of an integer from the...

Questions in other subjects: