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 


Reading a register value help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
PinPoint
Expert Cheater
Reputation: 10

Joined: 07 Apr 2016
Posts: 223
Location: Scotland

PostPosted: Sun Jan 17, 2021 1:46 pm    Post subject: Reading a register value help Reply with quote

Its been a while since ive done anything with CE and think i'm a bit rusty:D

I am trying to read the value of the following instruction;

Code:
 movsd [r9+r11*8+07],xmm0


My script seems to not like it when i try this and it doesnt execute.

Code:
mov [base],r9


it executes if I change r9 to RAX so thinking I dont understand the Rn registers.

I have globally allocated (base,Cool and (base1,Cool- which I also tried as with 64 a memory
and was trying the code:


Code:

  mov [base],r9
  add [base],r11
  mov [base1],base
  add [base1],base
  add [base1],base
  add [base1],base
  add [base1],base
  add [base1],base
  add [base1],base
  add [base1],base


I feel there is a simpler way than this anyway if anyone could help?


edit.
it has been a long time Very Happy

I chnaged the code to this and it workd

Code:

  mov [keep], rax
  pop rax
  mov rax,r11
  imul rax,8
  add rax,r9
  add rax,7
  mov [base],rax
  pop rax
  mov rax,[keep]
  movsd [r9+r11*8+07],xmm0
  jmp return



Is there anything I should do different or a smoother way of doing this?

_________________
Will you be my friend Hitler?
Rep me then
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jan 17, 2021 6:51 pm    Post subject: Reply with quote

RIP-relative addressing shouldn't be affected by the REX prefix AFAIK...
Might be a bug in CE. I can't test this now, but this should assemble fine:
Code:
globalalloc(testcode,256)
label(foo)

testcode:
// assembles to: 4c 89 0d 00 00 00 00
mov [foo],r9
foo:

If that test works, you're probably doing something weird in your script.

Post the entire script if you want more help.

_________________
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
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sun Jan 17, 2021 7:05 pm    Post subject: Reply with quote

only RAX can directly address memory that's further than 2GB away

any other register has to use indirection
e.g:
Code:

push rbx
mov rbx,foo //you can assign 64-bit values directly to registers though
mov [rbx],r9
pop rbx


or
Code:

push rax
mov rax,r9
mov [foo],rax //only rax can access >2GB regions
pop rax



or just allocate foo nearby the code using the 3th alloc prameter

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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