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 


Figure out bytes from opcode?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
noobpwner5
Newbie cheater
Reputation: 0

Joined: 28 Nov 2010
Posts: 12

PostPosted: Mon Jun 13, 2016 9:22 am    Post subject: Figure out bytes from opcode? Reply with quote

Hey everyone, im wondering if theres a way to calculate the bytes in an opcode that involves calling a function or address in a game. For example, the opcode call 3EEFF240 gives the bytes E8 33F28F3D. I know E8 is for the call function but how does cheat engine calculate the address 3EEFF240 into the bytes 33F28F3D? I've been looking for quite a while now but havent found much results, if anyone has any suggestions or knows how the bytes are calculated i would gladly appreciate it!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Jun 13, 2016 9:55 am    Post subject: Reply with quote

Terminology: an instruction is the thing that's executed. It encompasses both the operation to be performed and the information used to perform said operation. The bytes it's composed of is called machine code. The opcode is the bytes used to represent the operation to be performed (i.e. the byte E8). The operands are the information used to perform the operation (i.e. the dword 3D8FF233).

That particular addressing mode of the call instruction uses a rel32 displacement from the address of the next instruction. This means that the instruction call 3EEFF240 must have been located at the address 01600008: 3EEFF240 (end address) - 3D8FF233 (rel32) - 5 (call instruction).

Let's say you want to jump to address B via a call instruction located at address A. The opcode would be E8, and the dword operand would be B - A - 5.

2 notes: the dword operand is stored in little endian, and you can't do this in a 64-bit process if the address you're jumping to is greater than 2GB away.

_________________
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
noobpwner5
Newbie cheater
Reputation: 0

Joined: 28 Nov 2010
Posts: 12

PostPosted: Mon Jun 13, 2016 11:06 am    Post subject: Reply with quote

awesome i understand it now, thanks for the explanation!
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