Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Question about quadword

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Thu Oct 29, 2015 2:45 pm    Post subject: Question about quadword Reply with quote

So I have this one instruction "movq [esi+30],xmm0", and through some reading I found that means move quadword. So I registered a symbol and initialized it with "dq:". Yet when I do this
Code:
movq [esi+30],xmm0
fld [esi+30]
fstp [mySymbol]
I end up getting weird values, how to fix?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Thu Oct 29, 2015 3:36 pm    Post subject: Reply with quote

The bytecode of those instructions might give you the answer.

If fld and/or fstp is using the byte D9, then it's trying to load and store a single precision floating point value. Doubles would use the byte DD for both of those instructions.

If this is the case, try using this mnemonic instead:
Code:
movq [esi+30],xmm0
fld qword ptr [esi+30]
fstp qword ptr [mySymbol]

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Thu Oct 29, 2015 3:38 pm    Post subject: Reply with quote

Probably the fld need to specific the size, ie.
Code:
 
fld dword ptr [esi+80] // or
fld qword ptr [esi+80]

depends on the previous usage of xmm0.

xmm can be interpret as 16xbyte, 8xshort, 4xdword & 4xfloat or 2xdouble.

If xmm0 is used as single(one,1x,the lower one of four/two) float(also called 'single')/double previously, it can be store to a memory as
Code:

movss dword ptr[esi+80],xmm0 // float or
movsd qword ptr[esi+80],xmm0 // double


ADDED:
hmmm... why not
Code:

movq qword ptr [MySymbol],xmm0
?

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Thu Oct 29, 2015 3:56 pm    Post subject: Reply with quote

panraven wrote:
ADDED:
hmmm... why not
Code:
movq qword ptr [MySymbol],xmm0
?


movq stands for "move quadword". It can't access any other size of data, so qword ptr is already implied in the instruction's mnemonic.

For instructions like fstp and fld, they can store/load a variable number of bytes, so interpreters need to add dword ptr or qword ptr to distinguish how many bytes those instructions are working with.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Oct 29, 2015 4:03 pm    Post subject: Reply with quote

Just to point this out, for this specific example.

movq [esi+30],xmm0
is populating the value of [esi+30] at this moment

If you wanted your variable to have the same value, you could simply repeat the command.
movq [mySymbol],xmm0

And I assume at some point you'll want to overwrite the register with whatever value you stored previously:
movq xmm0,[mySymbol]
movq [esi+30],xmm0
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Thu Oct 29, 2015 4:10 pm    Post subject: Reply with quote

ParkourPenguin wrote:
panraven wrote:
ADDED:
hmmm... why not
Code:
movq qword ptr [MySymbol],xmm0
?


movq stands for "move quadword". It can't access any other size of data, so qword ptr is already implied in the instruction's mnemonic.

..snip..


yes, you are right, it is redundant.

_________________
- Retarded.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Oct 29, 2015 4:15 pm    Post subject: Reply with quote

Also note that the value isn't necessarily a double.
Could just as easily be an 8-byte long.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Thu Oct 29, 2015 4:16 pm    Post subject: Reply with quote

Zanzer wrote:
Just to point this out, for this specific example.

..snip..

And I assume at some point you'll want to overwrite the register with whatever value you stored previously:
movq xmm0,[mySymbol]
movq [esi+30],xmm0


...but I'll paranoiac on overwrite xmm's if it is just use as temporary storage for transferring. May be easily push/pop regular integer registers better suit this role.

_________________
- Retarded.
Back to top
View user's profile Send private message
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Thu Oct 29, 2015 4:42 pm    Post subject: Reply with quote

well, this is embarrassing , I actually did try using
Code:
movq [esi+30],xmm0
fld qword ptr [esi+30]
fstp qword ptr [mySymbol]
before I posted the topic but I still got weird results, turns out, I was viewing the wrong data type. Was double, not float, Laughing woops. Still weird though, because I did initially search for it under float, and the values did make sense at the time, guess not. Thanks for the help though guys.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites