Dynamic Gravity [JoshuaMK]
#6
I rush my notes on sources, since a lot of times I add them afterwards. Just a typo lol.

I set the button values in a register via Li, then did an AND, because of assumed issues with sign extension if trying to let users fill in negative button values (such as GCN Y button 0x0880 in the compiled code) for an AND IMMEDIATE, the sign extension would mess up the following comparison-branch.

But now looking back at it, when you logically AND 0xFFFF0880 with 0x00000880, the result is 0x00000880, so the sign extension doesn't matter. So the instructions to set the button values via Li, then doing a normal AND is redundant. AND Immediate with the user's button values without using Li is more efficient. So yes you are correct, thanks for catching that.

Btw you shouldn't use andi. (with the dot), unless you know your comparison afterwards is going to be cmpwi rX, 0. Basically because GCN exists (button value is 0x0080 when NO buttons are pressed), you will need to use andi (NO dot) and then cmpwi with the desired button value. If your code is wiichuck/wheel/classic only, you could use andi. (with the dot) and then do an opposite branch of what would have been if you did a normal And Immediate.

Fyi, the dot is a shortcut for cmpwi rX, 0.

Example.
andi. rX, rY, VALUE
bne/beq some_label

^That will work

Another example.
andi. rX, rY, VALUE
cmpwi rX, 0x0
bne/beq some_label

^redundant instruction

Another example.
andi. rX, rY, VALUE
cmpwi rX, SOME_VALUE_NOT_ZERO
bne/beq some_label

^added dot is pointless cuz you are not comparing to zero
Reply


Messages In This Thread
Dynamic Gravity [JoshuaMK] - by JoshuaMK - 07-01-2019, 03:37 AM
RE: Dynamic Gravity - by Vega - 07-01-2019, 03:15 PM
RE: Dynamic Gravity - by JoshuaMK - 07-01-2019, 04:21 PM
RE: Dynamic Gravity - by Vega - 07-01-2019, 07:40 PM
RE: Dynamic Gravity - by JoshuaMK - 07-02-2019, 06:15 AM
RE: Dynamic Gravity - by Vega - 07-02-2019, 02:05 PM
RE: Dynamic Gravity - by JoshuaMK - 07-02-2019, 05:55 PM
RE: Dynamic Gravity - by Vega - 07-02-2019, 06:43 PM
RE: Dynamic Gravity - by JoshuaMK - 07-02-2019, 08:11 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)