1. Engineering
2. Computer Science
3. i was wondering if you could help me with a...

# Question: i was wondering if you could help me with a...

###### Question details

I was wondering if you could help me with a MIPS program, i Need to write a program that will convert from any base from 2-10 to decimal. I have a skeleton of the code i need to write which is :

###############################################################################
## Author: __________________
## Date: __________________
## Purpose: Convert a number in some base to its decimal equivalent
##
###############################################################################
.data
imsg1:   .asciiz   "Enter a number in another base using at most 10 digits: "
imsg2:   .asciiz   "Enter the base number: "
omsg1:   .asciiz   "Decimal equivalent: "
newln:   .asciiz "\n"
num:   .space   12
base:   .word   0
ans:   .word   0
len:   .word    0

.text
START:

li   $v0, 4 # Print the 1st prompt la$a0, imsg1
syscall

li   $v0, 8 # Get the digits from the user la$a0, num   # Setup a pointer to the destination array
li   $a1, 12 # there will be a newline syscall # and a null char at the end li$v0, 4       # Print the 2nd prompt
la   $a0, imsg2 syscall li$v0, 5       # read integer
syscall
la   $a1, base sw$v0, 0($a1) # store base to memory variable la$a0, num     # Load the address of num
la   $a1, base # Load the address of the base lw$t0, 0($a1) # load the base number ## Add your code here ## To convert to decimal we start a sum with the most-significant digit. ## Then for each subsequent digit we multiplying the sum by the base ## and add the next digit # When done, print the converted number using syscall service 1 # Do not alter code below this point li$v0, 4       # print newline
la   $a0, newln syscall # Quit li$v0, 10
syscall Here are the verbatim procedures^

###### Solution by an expert tutor 