The following warnings occurred:
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.18 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/printthread.php(287) : eval()'d code 2 errorHandler->error_callback
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



Mario Kart Wii Gecko Codes, Cheats, & Hacks
PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14)
+--- Forum: Resources and References (https://mariokartwii.com/forumdisplay.php?fid=18)
+--- Thread: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set (/showthread.php?tid=1846)

Pages: 1 2 3


RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - JimmyKazakhstan - 06-29-2021

(06-28-2021, 10:44 PM)Vega Wrote: Yes.

Thanks!


RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - JimmyKazakhstan - 07-03-2021

Hey, This isn't related to the last question but I'm wondering, is my understanding of these instructions correct?




lwzu


Load Word Zero Update
The value in Register A will be loaded into whatever Address is in Register B.
After the instruction is executed, The address in Register B is updated by the value you specify

 


EXAMPLE :
lwzu r1, 4(r2)

* The address in Register B starts as 0x80000004. After execution of this instruction, it becomes 0x80000008. It changed because it was updated by the pointer, which was 0x4. 


lwzx
Load Word Zero Indexed
The value in Register A will be loaded into whatever Address is in Register C.
After the instruction is executed, The address in Register C is updated by the value in Register A.
The new address is stored in Register B


 
EXAMPLE :
lwzx r1, r2, r3

*When I figure out how this works, I'll add an example



RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - Vega - 07-03-2021

lwzu looks good but lwzx is wrong, you could write them like this....

lwzu rA, VALUE (rB)

Register A is loaded with the word located at rB+VALUE. Afterwards, rB is incremented by the amount in VALUE.

--

lwzx rA, rB, rC

Register A is loaded with the word located at rB+rC.

--

Simple and straight to the point.


RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - JimmyKazakhstan - 07-04-2021

(07-03-2021, 11:15 PM)Vega Wrote: lwzu looks good but lwzx is wrong, you could write them like this....

lwzu rA, VALUE (rB)

Register A is loaded with the word located at rB+VALUE. Afterwards, rB is incremented by the amount in VALUE.

--

lwzx rA, rB, rC

Register A is loaded with the word located at rB+rC.

--

Simple and straight to the point.


So whatever is the sum of register b and c added together becomes the pointer added to the address in register A? (for lwzx)


RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - Vega - 07-04-2021

It's called the Effective Address and that's how store and load instructions work.

Examples~

stw r0, VALUE (r3) #Effective Address aka EA (where store occurs) is VALUE+r3
lbz r5, VALUE (r10) #EA = VALUE+r10

These calculations are signed because all store and load instructions are signed. Meaning VALUE can be negative. If it is, do the sum accordingly.

Example~

lhzu r11, 0xFFFFFFFC (r9) #EA = -4 + r9, or easier to write it as r9 - 4 = EA.

Final Example (using lwxz)~

r5 = 0xFFFFFFF0 (aka -16 or -0x10)
r6 = 0x80001000

lwxz r4, r5, r6

EA = r5+r6 (0x80001000 minus 0x10)
Thus EA = 0x80000FF0

So the lwzx instruction will load the word located at 0x80000FF0 into r4.