## arrays and recursion in mips

Code:
```	.text
addi \$s0, \$zero, 0	# register to transfer the user input.
addi \$s1, \$zero, 10	# register to hold integer value 10.
addi \$s2, \$zero, 2	# register to hold integer value 2.
addi \$s3, \$zero, 0	# initialize register for store of multiplication.
addi \$s4, \$zero, 0	# initialize register for case1b result.
addi \$t0, \$zero, 0	# initialize register for store of lower 32 bits of multiplication.
addi \$t1, \$zero, 0	# initialize register for store of lower 32 bits of multiplication 2nd time.
addi \$s7, \$zero, 0	# initialize register for array.
LOOP0:
la \$a0, Prompt		# load Prompt string into \$a0.
li \$v0, 4		# system call to print Prompt string.
syscall

li \$v0, 5		# system call to read integer from user.
syscall

bgt \$v0, 10, LOOP0	# branch if greater than 10, force user to enter lower number.
blt \$v0, 1, LOOP0	# branch if less than 1, force user to enter a positive number.
ble \$v0, 6, CASE1	# branch to CASE1 if input is less than or equal to value 6.
blt \$v0, 10, CASE2	# branch to CASE2 if input is less than value 10.
beq \$v0, 10, CASE3	# branch to CASE3 if input value is equal to value 10.

CASE1: 				# CASE1
move \$s0, \$v0		# move the input value from \$v0 to \$s0.
ble \$s0, 2, CASE1A	# branch to CASE1A if \$s0 (the input value) is less than or equal to 2.
ble \$s0, 6, CASE1B	# branch to CASE1B if s\$0 is less than or equak to 6.

CASE1A:				# CASE1A
la \$a0, MSG1		# Load MSG1 string to \$a0.
li \$v0, 4		# system call to print MSG1 string.
syscall
la \$a0, 0(\$s1)		# Load \$s1 to \$a0, the value is 10.
li \$v0, 1		# system call to print the integer.
syscall

CASE1B:
mult \$s0, \$s2		# multiply \$s0 by \$s2.
mfhi \$v0		# move the upper 32 bits to \$v0.
mflo \$v1		# move the lower 32 bits to \$v1.
move \$t0, \$v1		# move \$v1 to \$t0.
addi \$s3, \$s0, -1	# \$s3 = \$s0 - 1 or n-1.

mult \$s3, \$s2		# multiply \$s3 by \$s2 or 2(n-1).
mfhi \$v0		# move the upper 32 bits to \$v0.
mflo \$v1		# move the lower 32 bits to \$v1.
move \$t1, \$v1		# move \$v1 to \$t1.

mult \$t0, \$t1		# multiply \$t0 by \$t1.
mfhi \$v0		# move the upper 32 bits to \$v0.
mflo \$v1		# move the lower 32 bits to \$v1.
move \$s4, \$v1		# move \$v1 to \$s4

la \$a0, MSG1		# Load MSG1 string into \$a0.
li \$v0, 4 		# system call to print MSG1 string.
syscall
la \$a0, 0(\$s4)		# Load \$s4 into \$a0.
li \$v0, 1		# system call to print integer.
syscall

CASE2:
la \$s7, ARRAY		# Load base address of array into \$t9
li \$s6, 36		# Initialize loop counter to 36

LOOP:
la \$a0, Prompt2		# Load Prompt2 string into \$a0.
li \$v0, 4		# system call to print string Prompt2.
syscall

li \$v0, 12 		# read character input.
syscall
move \$s6(\$s7), \$v0	# move input character to an array element.

la \$a0, \$s6(\$s7)	# load array element into \$a0.
li \$v0, 11		# system call to print array element.
syscall
addi \$s6, \$s6, -4	# decrement loop counter.
bgtz \$s6, LOOP

la \$a0, MSG2		# load MSG2 string into \$a0.
li \$v0, 4		# system call to print MSG2 string.
syscall
LOOP2:
la \$a0, \$s6(\$s7)	# load element of array into \$a0.
li \$v0, 11		# system call to print char.
addi \$s6, \$s6, 4	# increment \$t8.
blt \$s6, 36, LOOP2 	# branch if \$t8 is less than 36
j EXIT			# when \$t8 reaches 36 jump to EXIT.

CASE3:
la \$a0, JOKE		# Load JOKE string into \$a0.
li \$v0, 4		# system call to print JOKE string.
syscall

EXIT:				# EXIT
li \$v0, 10		# system call to exit the program.
syscall

.data
Prompt: .asciiz "Enter an integer between 1 and 10: "
MSG1: 	.asciiz "\nThe result is: "
MSG2: 	.asciiz "\nThe reverse is: \n"
Prompt2:.asciiz "\nEnter a character: "
JOKE: 	.asciiz "\nAdam and Eve Virus: Takes a couple of bytes out of your Apple\n"
ARRAY:	.space 10 		# 10 bytes of storage to hold an array of 10 characters```
The problem is to get the user to enter a number from 1 to 10, if its 3 to 6 its suppose to go into this function "F(n) = 2n*F(n-1)" and print the result. If its 7 to 9 its suppose create an array of ten elements and ask the user to input ten characters and print each character as its being entered, after that its suppose to display the array contents in reverse order. If its 1 to 2 its suppose to display the result 10. If the input is 10 then the program should display a joke.
I got the program to respond to inputs 1,2,10 but 3,4,5,6,7,8,9 aren't producing the outputs that i need.
Any suggestions and help would be greatly appreciated.