This tutorial is on how to decode your non-working subroutines and find out what line is wrong.

Steps:

1) Make sure your hook is working
2) Checking everything else

1) Make sure your hooks work

Write a subroutine like this:

Code:
Lui t0, $0880
Lui t1, $1010
Sw t1, $1000(t0)
Jr ra
Nop
Now don't write the subroutine at address 0x1000, start at like 0x2000. Use the hook, go to the address 0x00001000 in the decoder, if you see the value: 0x10100000 in the decoder at that address then the hook works fine, if not then the problem is your hook.

2) Checking everything else

Now that you know the hook is not your problem you can de-bug your subroutine, you will need to re-write it with a extra line each line but it is very usefull. Here is an example subroutine that doesn't work:

Code:
Lui t0, $0880
Lw t0, $1000(t0)
J $00000000
Jr ra
Now the line that will freeze at is line three. So here is what I would add:

Code:
Lui t0, $0880
Beq zero, zero, $2
Nop
Lw t0, $1000(t0)
Beq zero, zero, $2
Nop
J $00000000
Nop
Beq zero, zero, $1 //Make sure this is 1 and not 2
Nop
Jr ra
Nop
Now this will execute the first line and then do nothing because it would keep jumping from branch to branch all the way to the jr ra. The value of 'Beq zero, zero, $2' is 0x10000002 now in game you want to change these the 2 to a 1, this will change the branch from branching to the next branch and to the next line, so the branch that you freeze on means that the next actual line after that branch has a problem, in this case the second 'Beq zero, zero, $2' will be the one that will freeze when I change it from 2 to 1.

This can be a bit anoying to have to re-write your subroutine but you can use copy and paste because it is the same MIPS line when you add in the branches.


Hope this help fix your subroutines!