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 


RAX vs other Registers difference?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
thethiny
Cheater
Reputation: 0

Joined: 01 Apr 2012
Posts: 38
Location: earth

PostPosted: Sun May 31, 2020 2:59 pm    Post subject: RAX vs other Registers difference? Reply with quote

Hello all, I'm running into a bit of a problem that only RAX seems to be able to fix and I would like to understand why.

Code:

aobscan(P1Focus,48 8B 87 F8 00 00 00 48 63 80 70) // should be unique
alloc(newmem,$1000,P1Focus)
globalalloc(player, $1000)

newmem:
  push rbx
  mov [player], rbx



This code works

Code:

aobscan(P1Focus,48 8B 87 F8 00 00 00 48 63 80 70) // should be unique
alloc(newmem,$1000,P1Focus)
globalalloc(player, $1000)

player:
DB 1, 1, 1, 1

newmem:
  push rbx
  mov rbx, [player]


This doesn't work

Code:

aobscan(P1Focus,48 8B 87 F8 00 00 00 48 63 80 70) // should be unique
alloc(newmem,$1000,P1Focus)
globalalloc(player, $1000)

newmem:
  push rax
  mov rax, [player]


This works.

Why is it that only rax works but nor rbx?[/code]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 379

Joined: 09 May 2003
Posts: 22652
Location: The netherlands

PostPosted: Sun May 31, 2020 4:08 pm    Post subject: This post has 1 review(s) Reply with quote

only rax can address a 64-bit address in the instruction itself. It's the only one that has been designated an instruction to do so, all others can only do RIP relative addressing

your alloc of player without specifying the region will likely be more than 2GB away, so RIP relative addressing can not target it (RIP relative is only 32-bit)


you can allocate player near newmem and fix it like that, or use rax, or do:
Code:

mov rbx,player
mov rbx,[rbx]

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
thethiny
Cheater
Reputation: 0

Joined: 01 Apr 2012
Posts: 38
Location: earth

PostPosted: Sun May 31, 2020 11:25 pm    Post subject: Reply with quote

Dark Byte wrote:
only rax can address a 64-bit address in the instruction itself. It's the only one that has been designated an instruction to do so, all others can only do RIP relative addressing

your alloc of player without specifying the region will likely be more than 2GB away, so RIP relative addressing can not target it (RIP relative is only 32-bit)


you can allocate player near newmem and fix it like that, or use rax, or do:
Code:

mov rbx,player
mov rbx,[rbx]


Thank you for your response. I tried to allocate player near newmem but RBX didn't work, so I thought that isn't the issue here, but now that you've explained it it makes sense.
Do you have a list of special functions for the registers that I can look into? Like for example you said RAX is the only one with 64bit address, are there any other things I can find out about other registers maybe? Thanks again!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 379

Joined: 09 May 2003
Posts: 22652
Location: The netherlands

PostPosted: Mon Jun 01, 2020 12:27 am    Post subject: Reply with quote

https://software.intel.com/content/dam/develop/public/us/en/documents/325462-sdm-vol-1-2abcd-3abcd.pdf

volume 2 has what you wish to look up

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
thethiny
Cheater
Reputation: 0

Joined: 01 Apr 2012
Posts: 38
Location: earth

PostPosted: Mon Jun 01, 2020 2:18 am    Post subject: Reply with quote

Thank you, it has everything I'd ever need 👍🏻
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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