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 


jump if value is below 0
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Tue Mar 13, 2012 10:21 am    Post subject: jump if value is below 0 Reply with quote

this does not work
Code:
cmp dword ptr [label],00000000
jb whatever


label is a float an equals to -1

why the code above does not jump ?
how to make it jump if label < 0 ?

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Tue Mar 13, 2012 11:46 am    Post subject: Re: jump if value is below 0 Reply with quote

Try this
Code:
fld dword ptr [value]  ; load -1
ftst                                     ; compare with 0
fstsw ax                              ; load status word to ax
sahf                                    ; transfer condition to flag register
jb here                      ; jump if below

_________________
Back to top
View user's profile Send private message Send e-mail
Kavvman
Master Cheater
Reputation: 2

Joined: 17 Apr 2004
Posts: 316

PostPosted: Tue Mar 13, 2012 12:25 pm    Post subject: Re: jump if value is below 0 Reply with quote

Fresco wrote:
this does not work
Code:
cmp dword ptr [label],00000000
jb whatever


label is a float an equals to -1

why the code above does not jump ?
how to make it jump if label < 0 ?


Try JL the signed version of it. Or JS should work as well if the sign is set (negative)

_________________
...
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 9:08 am    Post subject: Re: jump if value is below 0 Reply with quote

Freiza wrote:
Try this
Code:
fld dword ptr [value]  ; load -1
ftst                                     ; compare with 0
fstsw ax                              ; load status word to ax
sahf                                    ; transfer condition to flag register
jb here                      ; jump if below

I see you push [value] into the fpu, but when do you pop it out ? because in then game i play it is crucial that the fpu does not get messed with.
should i push and pop flasg too ? pushfd popfd

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 10:41 am    Post subject: Re: jump if value is below 0 Reply with quote

Fresco wrote:
Freiza wrote:
Try this
Code:
fld dword ptr [value]  ; load -1
ftst                                     ; compare with 0
fstsw ax                              ; load status word to ax
sahf                                    ; transfer condition to flag register
jb here                      ; jump if below

I see you push [value] into the fpu, but when do you pop it out ? because in then game i play it is crucial that the fpu does not get messed with.
should i push and pop flasg too ? pushfd popfd


Yes you should pop the the elements using
fstp st
and also save the state of the flags.

_________________
Back to top
View user's profile Send private message Send e-mail
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 11:07 am    Post subject: Reply with quote

i have tried both solution but unfortunately no one works

Code:
cmp dword ptr [label],00000000 // float
jb whatever

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 11:36 am    Post subject: Reply with quote

Code:
globalalloc(value,4)
value:
dd (float)-1

fld dword ptr [value]  ; load -1
ftst                                     ; compare with 0
fstsw ax                              ; load status word to ax
sahf                                    ; transfer condition to flag register
jb here                      ; jump if below




This didn't worked? And also use fstp st.

Code:
cmp dword ptr [label],00000000
jl whatever


jl should also work.

_________________
Back to top
View user's profile Send private message Send e-mail
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 1:43 pm    Post subject: Reply with quote

Freiza wrote:
Code:
globalalloc(value,4)
value:
dd (float)-1

fld dword ptr [value]  ; load -1
ftst                                     ; compare with 0
fstsw ax                              ; load status word to ax
sahf                                    ; transfer condition to flag register
jb here                      ; jump if below




This didn't worked? And also use fstp st.

Code:
cmp dword ptr [label],00000000
jl whatever


jl should also work.


none of the above worked

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 1:47 pm    Post subject: Reply with quote

Technically both of them are correct.
_________________
Back to top
View user's profile Send private message Send e-mail
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 1:50 pm    Post subject: Reply with quote

Freiza wrote:
Technically both of them are correct.

i know, thanks
is there anything else i could try?

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 2:22 pm    Post subject: Reply with quote

Converting float to integer or Using hexadecimal value instead of float.
But it's shooting arrow in dark night. Can you give some info of what you are doing?

_________________
Back to top
View user's profile Send private message Send e-mail
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 2:41 pm    Post subject: Reply with quote

Freiza wrote:
Converting float to integer or Using hexadecimal value instead of float.
But it's shooting arrow in dark night. Can you give some info of what you are doing?

there's this code that writes a float that goes from 0 to 100
if the user inserts a value bigger than 100 or smaller than zero ( 0 ) the game crashes, the game uses
fstp dword ptr [destination pointer] //it's a float
to store the val between 0 and 100 (0 & 100) included

in my code ...
0_100val = the user input's that value
Code:
pushfd
cmp dword ptr [0_100val],42C80000 // 42C8 = 100 float
ja Store_MAX
cmp dword ptr [0_100val],00000000
jb Store_MIN
Continue:
nop
popfd
// ::code:: //
Store_MAX:
nop
mov dword ptr [0_100val],42C80000
jmp Continue
nop
Store_MIN:
nop
mov dword ptr [0_100val],00000000
jmp Continue
nop


i hope that is enough for you, to tell me where this code doesn't work.
if user input = < 0 then write 0
if user input = > 100 then write 100

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 3:07 pm    Post subject: Reply with quote

Make sure 0_100val is assigned value before your code is running and is not changing by your other codes.
And make jb to jl.

_________________
Back to top
View user's profile Send private message Send e-mail
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Wed Mar 14, 2012 3:17 pm    Post subject: Reply with quote

yes 0_100val is assigned
and no other code is modifying it
also tried jl, but still not positive results

_________________
... Fresco
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Wed Mar 14, 2012 3:22 pm    Post subject: Reply with quote

Then I don't know. Btw identifiers shouldn't be starting with a number. Ofcourse it is working in ce . But it is not right doing so. And if you come to any solution do let me know.
_________________
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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