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 


cmp with more than 1 offset

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

Joined: 06 Aug 2014
Posts: 36

PostPosted: Sun May 09, 2021 11:23 am    Post subject: cmp with more than 1 offset Reply with quote

What's the syntax for cmp's in assembler with more than one offset?

Such as RSI offset 0 = 28, offset 1 = 4, offset 2 = 8

I've tried cmp [rsi+28+4+8] and [rsi+28]+4]+8]
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun May 09, 2021 12:32 pm    Post subject: Re: cmp with more than 1 offset Reply with quote

Turkeychopio wrote:
What's the syntax for cmp's in assembler with more than one offset?

Such as RSI offset 0 = 28, offset 1 = 4, offset 2 = 8

I've tried cmp [rsi+28+4+8] and [rsi+28]+4]+8]


You have to iterate through the pointer.
Code:

push rax
mov rax,[rsi+28]
test rax,rax
jz @f
  mov rax,[rax+4]
  test rax,rax
  jz @f
    cmp [rax+8],0
@@:
pop rax

_________________
Back to top
View user's profile Send private message Visit poster's website
Turkeychopio
Cheater
Reputation: 0

Joined: 06 Aug 2014
Posts: 36

PostPosted: Sun May 09, 2021 1:39 pm    Post subject: Re: cmp with more than 1 offset Reply with quote

TheyCallMeTim13 wrote:
You have to iterate through the pointer.
Code:

push rax
mov rax,[rsi+28]
test rax,rax
jz @f
  mov rax,[rax+4]
  test rax,rax
  jz @f
    cmp [rax+8],0
@@:
pop rax


Is this always the syntax I should always use?


This is my context below, I need to cmp rsi+4C+28+4

Code:

newmem:
  cmp [rsi+4C],0
  jne code
  movss [rsi+14],xmm2
  jmp return

code:
  mov [rsi+14],(float)1600
  jmp return

INJECT:
  jmp newmem
return:


So would it be like this?

Code:

newmem:
  push rax
  mov rax,[rsi+4C]
  test rax,rax
  jz @f
    mov rax, [rax+28]
    test rax,rax
    jz @f
      cmp [rax+4],0
  jne code
  movss [rsi+14],xmm2
  pop rax
  jmp return

code:
  mov [rsi+14],(float)1600
  jmp return

INJECT:
  jmp newmem
return:
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun May 09, 2021 2:29 pm    Post subject: Re: cmp with more than 1 offset Reply with quote

Turkeychopio wrote:
...

Move the POP so it's always ran, for any PUSH you want a matching POP, which would be missing if jumping to "code".
Code:
newmem:
  push rax
  mov rax,[rsi+4C]
  test rax,rax
  jz @f
    mov rax, [rax+28]
    test rax,rax
    jz @f
      cmp [rax+4],0
  pop rax
  jne code
  movss [rsi+14],xmm2
  jmp return

code:
  mov [rsi+14],(float)1600
  jmp return

INJECT:
  jmp newmem
return:

_________________
Back to top
View user's profile Send private message Visit poster's website
Turkeychopio
Cheater
Reputation: 0

Joined: 06 Aug 2014
Posts: 36

PostPosted: Sun May 09, 2021 2:42 pm    Post subject: Reply with quote

Thanks a lot for help Smile
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