subject
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

ansver
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 14:10, aliceohern
The y form of iron is known as: a) ferrite b) cementite c) perlite d) austenite
Answers: 3
image
Engineering, 04.07.2019 18:10, demarcuswiseman
Calculate the bore of a cylinder that has a stroke of 18 inches and an extension time of 6 seconds at a flow rate of 4 gal/min.
Answers: 3
image
Engineering, 04.07.2019 18:10, juansoto227711
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
image
Engineering, 04.07.2019 18:20, kendrawalraven
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
Answers: 3
You know the right answer?
Write a MIPS program that utilizes subroutine. This program should take input of an integer from the...

Questions in other subjects: