• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 … 20 21 22 23 24 … 117 Next »

PowerPC lwzx
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
PowerPC lwzx
10-20-2017, 07:57 AM
#1
ryanebola16 Offline
Member
***
Posts: 61
Threads: 11
Joined: May 2016
I am actually trying to understand PowerPC assembly.

The green bar indicates the next instruction that will be performed. If r0 = 0000006c and r3 = 817d34e0, what will the result of lwzx r3, r3, r0 be?

Dolphin says the result is r3 = 920d5fd0 when I step into that instruction. I though the result would be the sum of r3 and r0 stored in r3 so r3 should equal 817d354c.

Where have I gone wrong?

Thanks!


Attached Files Thumbnail(s)
       
Find
Reply
10-20-2017, 10:15 AM (This post was last modified: 10-20-2017, 10:16 AM by JonnyH.)
#2
JonnyH Offline
Shameless AMD shill
**********
Developers (Some Administrators and Super Moderators)
Posts: 701
Threads: 0
Joined: May 2017
lwzx[0] appears to be a "load word from address" instruction - from my understanding it doesn't store the result of (r3 + r0) in r3, but it stores the memory value at address (r3 + r0) into r3.

So presumably there's the value 0x920d5fd0 in the memory at address 0x817d354c?

[0]
https://www.ibm.com/support/knowledgecen...nstrus.htm
Find
Reply
10-20-2017, 10:30 AM
#3
ryanebola16 Offline
Member
***
Posts: 61
Threads: 11
Joined: May 2016
That is correct. Thank you!

Memory is not the same thing as a register, duh.
Find
Reply
10-20-2017, 10:31 AM
#4
medevo
Unregistered
 
(10-20-2017, 07:57 AM)ryanebola16 Wrote: I am actually trying to understand PowerPC assembly.

The green bar indicates the next instruction that will be performed. If r0 = 0000006c and r3 = 817d34e0, what will the result of lwzx r3, r3, r0 be?

Dolphin says the result is r3 = 920d5fd0 when I step into that instruction. I though the result would be the sum of r3 and r0 stored in r3 so r3 should equal 817d354c.

Where have I gone wrong?

Thanks!

I think you might have gotten confused between an immediate load and an addressed load. From the documentation for the instruction at https://www.ibm.com/support/knowledgecen...nstrus.htm

LWZX Effectively just adds the values of RA and RB, but uses this value EA as the effective address for a memory load and stores it in Register RT

In your case, after executing line 8084fe98, R3= [R3+R0] or R3 = [817d354c]. If you pull up that location in memory I bet you will find 920d5fd0
Reply
11-03-2017, 03:20 PM (This post was last modified: 11-03-2017, 03:22 PM by CosmoCortney.)
#5
CosmoCortney Offline
Lawn Meower
**
Posts: 43
Threads: 11
Joined: Dec 2012
lwzx stands for load word zero indexed.
in your case the effective address is computed by the sum of r3 and r0. the value stored at the effective address is then loaded into r3
For reverence I recommend: http://wiibrew.org/wiki/Assembler_Tutori...structions
CPU: 2 x Intel Xeon e5 2687w @ 3.1GHz (3.8GHz turbo)
GPU: Asus GTX 980 STRIX
RAM: 16GB DDR3 1600MHz
Dolphin is installed on an SSD by OCZ; Vertex 3 with 530MB/s Rs, 500MB/s Ws
Website Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma