Last active
December 24, 2015 22:49
-
-
Save porterjamesj/6875101 to your computer and use it in GitHub Desktop.
silly mips program that works as expected in spim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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