
Originally Posted by
hell
j $XXXXXXXX ;Jumps to the first address of the routine
lui t0 $XXXX ;Loads first 16 bits of controller address
lw t0 $XXXX(t0) ;Loads last 16 bits of controller address
addiu t1 zero $XXXX ;Loads Mark button value into t1
addiu t2 zero $XXXX ;Loads Recall button value into t2
bne t0 t1 $XXXXXXXX ;Branches to the bne t0 t2, if t0 does not equal t1 (meaning if the desired mark button is not being pressed)
nop ;No Function, if the button is being pressed it allows the following to process.
lui t0 $XXXX ;Loads the first 16 bits of the Coordinates address' into t0
lw t1 $XXXX(t0) ;Loads the value of the first coords usually the x-axis coords into t1, the last 16 bits of the x-axis address
lw t2 $XXXX(t0) ;Loads the value of the second coords usually y-axis coords into t2, the last 16 bits of the y-axis address
lw t3 $XXXX(t0) ;Loads the value of the third coords usually z-axis coords into t3, the last 16 bits of the z-axis address
lui t4 $XXXX ;Loads first 16 bits of the address that will hold the coords values into t4
sw t1 $XXXX(t4) ;Saves the value of x-axis from t1 into the address that will hold the x-axis value.
sw t2 $XXXX(t4) ;Saves the value of y-axis from t2 into the address that will hold the y-axis value.
sw t3 $XXXX(t4) ;Saves the value of z-axis from t3 into the address that will hold the z-axis value.
bne t0 t2 $XXXXXXXX ;Branches to jr ra if Recall button is not being pressed
nop ;The following is just a reverse of the above.
lui t0 $XXXX
lw t1 $XXXX(t0)
lw t2 $XXXX(t0)
lw t3 $XXXX(t0)
lui t4 $XXXX
sw t1 $XXXX(t4)
sw t2 $XXXX(t4)
sw t3 $XXXX(t4)
jr ra
It could be shorter if you load the first 16 bits of the Coords address and Holding address before you branch.
MIP's is pointless........
Bookmarks