# # "starter" program -- might be useful in testing code fragments in (x)spim # #### start of standard boilerplate .text .globl main main: # # opening linkage (save return address) # addi $sp, $sp, -4 sw $ra, 0($sp) #### end of standard boilerplate # # put code to assign initial values to registers here # examples: addi $s0, $zero, 10 # sets $s0 to 10 la $s1, A # sets $s1 to address of A # # put code to test here # example: sw $s0, 0($s1) # stores 10 in A[0] #### start of more standard boilerplate # # closing linkage (get return address and restore stack pointer) # lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra .end main .data #### end of standard boilerplate # # area for variables and constants # # example: A: .word 0, 0, 0, 0 # defines the equivalent of # "int A[4]"