Here is the code we wrote today:
addi $v0, $zero, 5 #read in an integer and copy into $t0 syscall add $t0, $zero, $v0 addi $v0, $zero, 5 #read in an integer syscall add $a0, $t0, $v0 #add the integers addi $v0, $zero, 1 #print the sum syscall addi $v0, $zero, 10 #exit simulation syscall
Here is the code for the sample loop that I put on the board at the end of the period:
addi $t0, $zero, 0 # $t0=0; addi $t1, $zero, 5 # $t1=5; loop: bge $t0, $t1, exit # while($t0 < $t1) { #print stuff addi $t0, $t0, 1 # $t0++; b loop # } exit: #loop is done