.text .globl main main: # put 3 and 4 on the stack using the register $sp subi $sp, $sp, 8 li $s0, 3 li $s1, 4 sw $s0, 0($sp) sw $s1, 4($sp) # call fee. You'll probably want to use the jal instruction to # store the current address in $ra jal fee # load results from stack to registers lw $a0, 0($sp) addi $sp, $sp, 4 # print result li $v0, 1 syscall # exit li $v0, 10 syscall fee: # copy a and b from stack to local registers lw $s1, 4($sp) lw $s0, 0($sp) # add a and b add $t0, $s1, $s0 # place result on stack addi $sp, $sp, 4 # No need to keep $sp allocated for two words when we're just returning a result sw $t0, 0($sp) # return using jr instruction jr $ra # Start .data segment (data!) .data