Skip to content

Instantly share code, notes, and snippets.

@porterjamesj
Last active December 24, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porterjamesj/6875101 to your computer and use it in GitHub Desktop.
Save porterjamesj/6875101 to your computer and use it in GitHub Desktop.
silly mips program that works as expected in spim
main:
addi $sp $sp -4 # allocate space for one thing on the stack
addi $t0 $zero 30
sw $t0 4($sp)
addi $t1 $sp 4 # put the address we want in t1
lw $t1 0($t1) # <- this works, 30 ends up in $t1
# exit syscall
li $v0 10 # system call code for exit = 10
syscall # call operating sys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment