(07-02-2019, 02:05 PM)Vega Wrote: 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
When I try to compile ASM into Gecko Codes it always says andi is not a valid instruction, and after looking at IBMs Power PC instructions, andi with the dot is the only and immediate instruction. So if you have been using andi without a dot successfully, could you please tell me what I might be typing wrong?
Super Mario Eclipse, what Super Mario Sunshine could've been.