| View previous topic :: View next topic |
| Author |
Message |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
Posted: Thu Apr 17, 2008 6:50 pm Post subject: Assembler Help (jumps) |
|
|
If i do this:
newmem:
cmp eax,eax
je label
mov eax,ebx
label:
// do stuff
How do you make it go back and execute after the je so when it's finished it continues. In other words, i want it to execute some code if the cmp is true and then continue on with the rest of the code
|
|
| Back to top |
|
 |
Labyrnth Moderator
Reputation: 10
Joined: 28 Nov 2006 Posts: 6301
|
Posted: Thu Apr 17, 2008 11:39 pm Post subject: |
|
|
| Try looking at the AA template.
|
|
| Back to top |
|
 |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
Posted: Thu Apr 17, 2008 11:47 pm Post subject: |
|
|
Could you elaborate? I'm not quite sure what you're referring to. Are you talking about the "returnhere" label the template has? I don't think that'd work in my situation.. Here's an example of what i have
| Code: |
alloc(newmem,2048)
label(returnhere)
label(exit)
label(otherthing)
0123456:
jmp newmem
nop
returnhere:
newmem:
cmp eax,eax // always true
je otherthing // will always jump to otherthing
mov eax,[ebx] // will never get executed
otherthing:
mov edx,[eax] // random thing
|
Every time the game runs 0123456 it will jmp to my newmem and je to otherthing every time and the mov eax,[ebx] will never be executed. I want it to je to otherthing, then come back and execute mov eax,[ebx] and all remaining code. I'm not sure how to go about this though, i'm somewhat new to AA and assembly.
|
|
| Back to top |
|
 |
Labyrnth Moderator
Reputation: 10
Joined: 28 Nov 2006 Posts: 6301
|
Posted: Fri Apr 18, 2008 12:14 am Post subject: |
|
|
Move the je under the instruction so it jumps after it
| Code: |
alloc(newmem,2048)
label(returnhere)
label(exit)
label(otherthing)
0123456:
jmp newmem
nop
returnhere:
newmem:
cmp eax,eax // always true
mov eax,[ebx] // executed
je otherthing // will always jump to otherthing
otherthing:
mov edx,[eax] // random thing
|
AA template:
| Code: |
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
00000000:
jmp newmem
returnhere:
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
originalcode:
exit:
jmp returnhere
|
Enable/Disable "Toggle able" Script
| Code: |
[Enable]
alloc(newmem,2048)
label(returnhere)
label(exit)
label(otherthing)
0123456:
jmp newmem
nop
returnhere:
newmem:
cmp eax,eax // always true
mov eax,[ebx] // executed
je otherthing // will always jump to otherthing
otherthing:
mov edx,[eax] // random thing
[Disable]
0123456:
// put original code here so you ca nturn it off
dealloc(newmem)
|
Also go check out this thread to see how some scripts can be written:
http://forum.cheatengine.org/viewtopic.php?t=112385
|
|
| Back to top |
|
 |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
Posted: Fri Apr 18, 2008 12:24 am Post subject: |
|
|
What happens if i have multiple jumps in my newmem?
i.e.
| Code: |
newmem:
cmp eax,eax
je otherlabel
mov eax,[ebx]
cmp eax,edx
je otherlabel2
|
Once the second cmp is executed wont it replace the CF(or was it ZF?) flag with it's own result and then you'll only be able to jump if equal with the second one since the first CF(zf?) flag got wiped and is now the same as the second cmp's result?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25870 Location: The netherlands
|
Posted: Fri Apr 18, 2008 6:41 am Post subject: |
|
|
yes, thats why you jump BEFORE doing the next cmp
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Psy Grandmaster Cheater Supreme
Reputation: 1
Joined: 27 Mar 2008 Posts: 1366
|
Posted: Fri Apr 18, 2008 7:00 am Post subject: |
|
|
Lol DB
If you want to force something to jump why bother with the extra cmp/test?
Just make it a jmp or ret.
|
|
| Back to top |
|
 |
|