Mario Kart Wii Gecko Codes, Cheats, & Hacks
how would i set a register's lower bits to the lower bits of some register? - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14)
+--- Forum: Code Support / Help / Requests (https://mariokartwii.com/forumdisplay.php?fid=61)
+--- Thread: how would i set a register's lower bits to the lower bits of some register? (/showthread.php?tid=1906)



how would i set a register's lower bits to the lower bits of some register? - jawa - 11-04-2021

how would i set a register's lower bits to the lower bits of some register?
example:
r12 is 3b00 0000
r11 is 0000 0005
and i want r10 to be 3b00 0005


RE: how would i set a register's lower bits to the lower bits of some register? - Vega - 11-05-2021

For that specific example you can do----

Code:
or r10, r11, r12

This does a logical OR with the values in r11 and r12, Result is written to r10. Anything in r10 beforehand is completed wiped out.

You also have the ability to use the Record feature (.) for a free use of cmpwi rX, 0 (rX being w/e register you are wanting to use)

Example:
Code:
or. r10, r11, r12 #Notice the dot in the instruction operand
bne+ some_label #Example branch



RE: how would i set a register's lower bits to the lower bits of some register? - Seeky - 11-05-2021

If you want to specifically get the upper and lower halves in cases where the registers have bits set in the halves you don't want, you can do it with a rlwinm with one register then a rlwimi with the other I think