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 


I don't get this 'comiss' behaviour

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

Joined: 19 May 2014
Posts: 74

PostPosted: Wed Jan 13, 2016 2:37 pm    Post subject: I don't get this 'comiss' behaviour Reply with quote

Code:
amountY:
dd (float)211

newmem:
movss xmm0,[rcx+000010B4]
comiss xmm0,[amountY]
JL/JG returnhere
addss xmm0,[amountX]
movss [rcx+000010B4],xmm0
jmp returnhere


I don't get it. The comiss absolutely doesn't work here, and I had it working somewhere earlier like this.

When [rcx+000010B4] and therefore xmm0 (I had tested whether the xmm0 returns correct with a separate registersymbol and viewed in cheat engine) is EITHER above or below amountY:

-jl -> never jumps to returnhere, so xmm0 keeps increasing by amountX perpetually, as if comiss never existed in the first place
-jg -> always jumps to returnhere, as if a jmp was put there instead.

What the heck?

EDIT/SOLVED:
JA and JB worked perfectly.

Additional question from me, copied from my third post down the topic:

So, it seems for signed normal integers you need jg and jl, but for floats ja and jb are all right? How come this difference?


Last edited by Noobrzor on Wed Jan 13, 2016 3:59 pm; edited 2 times in total
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Wed Jan 13, 2016 2:45 pm    Post subject: Reply with quote

What is the value stored in "[rcx+10b4]"?

Because if it's always lower than the one stored in xmm0 (211.0), then of course it always jumps at "jg" ...
Back to top
View user's profile Send private message
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Wed Jan 13, 2016 2:53 pm    Post subject: Reply with quote

I meant it always jumps at JG whether xmm0 or rcx+10b is float 111 or float 333.

I said it, I believe - "When [rcx+000010B4] and therefore xmm0 (I had tested whether the xmm0 returns correct with a separate registersymbol and viewed in cheat engine) is EITHER above or below amountY: "
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 13, 2016 3:32 pm    Post subject: Reply with quote

Comiss is a brain breaker sometimes.

But use jb and ja instead of jl, jg

Jump below, jb

Jump above, ja

_________________


Last edited by akumakuja28 on Thu Jan 14, 2016 1:35 am; edited 1 time in total
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jan 13, 2016 3:35 pm    Post subject: Reply with quote

Use ja/jb.
Back to top
View user's profile Send private message
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Wed Jan 13, 2016 3:55 pm    Post subject: Reply with quote

Unbelieveable coincidence. I had just tried doing exactly that, and it worked perfectly - whether I used down to negative float values or not.
I had been searching on float comparisons, and I found someone referring to comiss'es as to be used with jg and jl, not ja and jb.
Any way, both above responses had been problem-solving.

So, it seems for signed normal integers you need jg and jl, but for floats ja and jb are all right? How come this difference?


Last edited by Noobrzor on Wed Jan 13, 2016 4:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Jan 13, 2016 3:58 pm    Post subject: Reply with quote

From this reference:
Quote:
Compares the single-precision floating-point values in the low doublewords of source operand 1 (first operand) and source operand 2 (second operand), and sets the ZF, PF, and CF flags in the EFLAGS register according to the result (unordered, greater than, less than, or equal). The OF, SF, and AF flags in the EFLAGS register are set to 0.

If you also look up the jcc instructions, you'd see the JG and JL instructions check the SF and OF flags (both always set to 0). The JA and JB instructions check the flags set according to the result of the comparison.

_________________
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
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Wed Jan 13, 2016 4:02 pm    Post subject: Reply with quote

I see, thanks a lot for clearing it up.

To sum it up, cmp is different from comiss, and floats are different than normal integers in a way that JA and JB from comiss understands negative values inherently from floats with comiss, but in CMP it still is required to use JG and JL for negative values, yes?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Jan 13, 2016 4:25 pm    Post subject: This post has 1 review(s) Reply with quote

I wouldn't word it exactly that way. More so:
comiss is an instruction used for a signed comparison of single-precision floating point numbers. It sets the ZF, PF, and CF flags.
cmp is an instruction used to compare two bytes/words/dwords. It is used for signed and unsigned comparisons of integers and sets a bunch of flags.
AFAIK it's just a coincidence that comiss sets the same flags that are checked after a cmp of unsigned integers.

_________________
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
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Wed Jan 13, 2016 4:45 pm    Post subject: Reply with quote

Oh, I see. Thanks a lot for your help and time.
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 Gamehacking 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