Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created May 4, 2014 20:52
Show Gist options
  • Save tonussi/c0b73f99980256799bae to your computer and use it in GitHub Desktop.
Save tonussi/c0b73f99980256799bae to your computer and use it in GitHub Desktop.
patterson exercise 2-21-1b
.data
my_global: .word 100
.text
.globl main
main:
la $t0, my_global
lw $t1, 0($t0)
addi $t1, $t1, 1
sw $t1, 0($t0)
addi $a0, $t1, 0
jal leaf_funct
addi $s3, $v0, 0
j exit
leaf_funct:
addi $sp, $sp, -4
sw $ra, 0($sp)
addi $v0, $a0, 1
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