1 Run whats downloadable from Assignment 2 on eLearning in S
1.   Run what.s (downloadable from \"Assignment 2\" on eLearning) in SPIM, examine some of the registers etc in the SPIM windows, and look in the code of what.s, and try to work out what it does. Check whether the program works if the argument is changed to 6, 1, 0, 10, 20, etc? Answer what the program does in one sentence.
 2.   Modify what.s so that it takes two arguments. If the arguments are both the same then the answer should be the same as that of what.s that takes only one argument. If they are different then you should figure out what your program should do based on the above. Try to make as few changes as possible. Give your new program a sensible name.
 3.   Enhance the program to allow it to receive the two arguments from the keyboard and display the result in the console window of SPIM. If any of the input arguments is a negative number (less than zero), your enhanced program should display a zero in the console.
 SUBMISSION:
 You should store your enhanced program (only a SINGLE program for Parts 2 & 3) in one SINGLE file called \"X.s\", where \"X\" is your last name (use only the first eight characters if it is more than eight). At the top of the program, use comments (starting with \"#\") to write your name and also use comments to answer Part 1. Your submitted program must be in plain text format and must be runnable on SPIM.
what.s
.data
arg: .word 5
.text
.globl main
main:
la $t3, arg
lw $t2, 0($t3)
lw $t3, 0($t3)
addi $t1, $zero, 0
beqz $t2, fin
fori:
add $t1, $t1, $t2
addi $t3, $t3, -1
bnez $t3, fori
fin:
li $v0, 10
syscall
Solution
what.s
.data
arg: .word 5
.text
.globl main
main:
la $t3, arg
lw $t2, 0($t3)
lw $t3, 0($t3)
addi $t1, $zero, 0
beqz $t2, fin
fori:
add $t1, $t1, $t2
addi $t3, $t3, -1
bnez $t3, fori
fin:
li $v0, 10
syscall


