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" command. Need help, thanks.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Sat Feb 20, 2016 8:13 pm    Post subject: "cmp" command. Need help, thanks. Reply with quote

I have a question about the "cmp" command.
From my understanding, "cmp" compares two registers or numbers and return "false" or "true", but it does not give a value to such registers. If so, what does the following code mean?
Code:

cmp ecx,01
mov eax,ecx


I understand that if "cmp ecx,01" is followed by "je XXXX", because it means if exc is equal to 01, then jump to somewhere. But from my understanding, the code above(in green color) basically means comparing ecx to 01, and moving ecx to eax regardless of the comparison between ecx and 01. So my question is: why bother comparing ecx and 01? Isn't redundant? BTW, the code is correct because I copied it from a game.
Thanks in advance.

Updated because of typo.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Feb 20, 2016 8:36 pm    Post subject: Reply with quote

The CMP sets various EFLAGS.
The jump does not need to immediately follow.
Flags will remain set until overridden.
There are other instructions which set those flags too though.
So care must always be taken.
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Sat Feb 20, 2016 8:37 pm    Post subject: Reply with quote

Zanzer wrote:
The CMP sets various EFLAGS.
The jump does not need to immediately follow.
Flags will remain set until overridden.
There are other instructions which set those flags too though.
So care must always be taken.


Oh, thanks a lot. Is there any tutorial about assembly commands? They are so confusing to me. Sad
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