# sample1.asm # like sample0.asm, but loads the registers. # Now you need to change and reload to use different numbers main: # Every program needs a starting point addi $s0, $zero, 5 # f = 5 You can use addi to add a constant addi $s1, $zero, 4 # g = 4 to a register. By using register addi $s2, $zero, 3 # h = 3 zero, which always contains 0, addi $s3, $zero, 2 # i = 2 I'm loading a constant into a addi $s4, $zero, 1 # j = 1 register. add $t0, $s1, $s2 # temp0 = g + h add $t1, $s3, $s4 # temp1 = i + j sub $s0, $t0, $t1 # f = temp0 - temp1 jr $ra # return to Operating System