View previous topic :: View next topic |
Author |
Message |
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Oct 19, 2014 3:00 pm Post subject: Quick question about compares |
|
|
Whats the ASM equivalent of
(if(something) && if(something)){}
|
|
Back to top |
|
|
hesho28 Newbie cheater Reputation: 0
Joined: 03 Oct 2009 Posts: 13
|
Posted: Sun Oct 19, 2014 3:17 pm Post subject: |
|
|
CMP (compare) instruction and jmp (jump) instructions
for example if you are comparing values of eax and ebx
Code: | cmp eax,ebx
je Found // jump if equal to the code named found [which is a message box]
jmp @F
Found:
push 0
push offset MsgT
push offset MsgT
push 0
Call MessageBoxA
@@:
ret |
there is alot of jumps like :
je (jump if equal)
jne (jump if not equal)
jge (jump if greater than or equal)
and alot more , just learn about these two instructions.
_________________
sssssss |
|
Back to top |
|
|
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Oct 19, 2014 3:21 pm Post subject: |
|
|
your missing my question, I need to compare the end results of two comparisons and make a jump off that.. you know... like
1&1=1
1&0=0
|
|
Back to top |
|
|
hesho28 Newbie cheater Reputation: 0
Joined: 03 Oct 2009 Posts: 13
|
Posted: Sun Oct 19, 2014 3:29 pm Post subject: |
|
|
vng21092 wrote: | your missing my question, I need to compare the end results of two comparisons and make a jump off that.. you know... like
1&1=1
1&0=0 |
You missing the point , with these instructions you can compare easily.
You mean you do want to make 2 comparisons for example
if this number greater than 1 and less than 4 (2 compares ) then do something
Watch this: [A Loop to check the two conditions]
// if al = 10
Code: | Loop:
Cmp al,1
jl NotFound // jump if less than
Cmp al,4
jg NotFound // jump if greater than
Found:
invoke MessageBox,0,offset MsgT,offset MsgT,MB_OK
jmp @f
NotFound:
dec al
jmp Loop
@@:
ret |
This code won't stop until [If al greater than 1 && if al less than 4]
_________________
sssssss |
|
Back to top |
|
|
|