Home > Archive > A86 Assembler > July 2004 > Cmp
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Kleidemos 2004-07-17, 8:55 am |
| Hello,
I'm a 15 years old programmer.
I'm learning the x86 asm.
So... I have a question for you, asm experts and goru.
Suppose I have this code:
cmp dst, src
If I had understand the value of this operation, I can say that
cmp dst, src equals sub dst, src
Where (in metalanguage) Result := dst-src.
When I understod this, if it's correct, the ZF is setted if the
substraction is 0 and not setted if the sub operation is NOT 0.
Then I can use the Jump instruction.
In my deduction is there a fault???
Tanks and Regards
P.S: Sorry for my bad english, I'm Italian :P
--
Tnk
Luca "Kleidemos" Francesca
Un computer a un altro quando si incontrano:
"Ciao, come ti boota oggi???"
| |
| Dirk Wolfgang Glomp 2004-07-17, 3:55 pm |
| Hello beginner,
Kleidemos schrieb:
> Hello,
> I'm a 15 years old programmer.
> I'm learning the x86 asm.
Good age to learn.
I began to compute, as i'm over 30 years old.
> So... I have a question for you, asm experts and goru.
> Suppose I have this code:
>
> cmp dst, src
>
> If I had understand the value of this operation, I can say that
>
> cmp dst, src equals sub dst, src
> Where (in metalanguage) Result := dst-src.
But its not the same.
The compare-command leave the destination by the same value.
The substrakt-command decrese the destination-value by the source-value.
> When I understod this, if it's correct, the ZF is setted if the
> substraction is 0 and not setted if the sub operation is NOT 0.
> Then I can use the Jump instruction.
Yes by conditionel jump like jz(je).
Additional below(jb) and above(ja) result of CF,
jo=OF, js=SF, jp=PF.
All in negativ are jnz, jnb...
> In my deduction is there a fault???
No.
> P.S: Sorry for my bad english, I'm Italian :P
Sorry for my bad english too, I´m German.
Dirk
| |
| Kleidemos 2004-07-17, 3:55 pm |
| Dirk Wolfgang Glomp wrote:
> But its not the same.
> The compare-command leave the destination by the same value.
> The substrakt-command decrese the destination-value by the source-value.
I didn't remebmered to add this *very important* difference between the
2 methods.
Tnk bcoz youd had remembered to me.
--
Tnk
Luca "Kleidemos" Francesca
Un computer a un altro quando si incontrano:
"Ciao, come ti boota oggi???"
|
|
|
|
|