Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
BEQ $t0,$t1,Label ;branch to label if $t0 = $t1. If not, fallthrough to the instruction after the delay slot.
|
||||
nop ;branch delay slot
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
addu $t0,$t1 ;I'm going to branch based off this addition, but there's other things I want to do first.
|
||||
lw $t3,($t4)
|
||||
nop ;load delay slot
|
||||
BEQ $t0,$t1,Label
|
||||
nop ;branch delay slot
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
BNEZ $t0,loop ;branch if $t0 is nonzero.
|
||||
subiu $t0,1 ;this finishes at the same time the jumpback occurs.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
BGEU $t0,$t1,label ;branch if $t0 >= $t1, treating both as unsigned.
|
||||
NOP
|
||||
BLT $t7,$t3,label ;branch if $t7 < $t3, treating both as signed
|
||||
NOP
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
switchExample:
|
||||
;this implementation assumes that all destinations end in jr ra, so you'll need to arrive here with JAL switchExample.
|
||||
;$t0 = index (must be a multiple of 4 or the program counter will jump to a location that's not guaranteed to properly return.)
|
||||
la cases,$t1
|
||||
addiu $t1,$t0 ;MIPS can't do variable indexed offsetting so we have to add the offset ourselves.
|
||||
lw $t8,($t1) ;dereference the pointer, $t8 contains the address we wish to "call"
|
||||
nop
|
||||
jr $t8 ;jump to the selected destination.
|
||||
nop
|
||||
|
||||
cases:
|
||||
.word foo
|
||||
.word bar
|
||||
.word baz
|
||||
|
||||
foo:
|
||||
;code goes here
|
||||
jr ra
|
||||
|
||||
bar:
|
||||
;code goes here
|
||||
jr ra
|
||||
|
||||
baz:
|
||||
;code goes here
|
||||
jr ra
|
||||
Loading…
Add table
Add a link
Reference in a new issue