Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created May 4, 2014 20:51
Show Gist options
  • Save tonussi/477692e78c49b1532c92 to your computer and use it in GitHub Desktop.
Save tonussi/477692e78c49b1532c92 to your computer and use it in GitHub Desktop.
patterson exercise 2-21-1a
.data
my_global: .word 100
.text
.globl main
main:
addi $s0, $0, 10
addi $s1, $0, 20
addi $a0, $s0, 0
addi $a1, $s1, 0
jal my_funct
addi $s3, $v0, 0
j exit
my_funct:
addi $sp, $sp, -4
sw $ra, 0($sp)
sub $v0, $a0, $a1
la $t0, my_global
lw $t1, 0($t0)
add $v0, $v0, $t1
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra
exit:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment