flat assembler
Message board for the users of flat assembler.
Index
> Main > test instruction problem.. |
Author |
|
r22 28 Jun 2011, 13:15
Code: DEC ebx ; changes Z flag Try using JNS instead of JNZ *edit* also you really don't need the TEST instruction at all... Last edited by r22 on 28 Jun 2011, 13:15; edited 1 time in total |
|||
28 Jun 2011, 13:15 |
|
revolution 28 Jun 2011, 13:15
DEC also alters the Z flag. Indeed in your code TEST is superfluous.
|
|||
28 Jun 2011, 13:15 |
|
Overflowz 28 Jun 2011, 13:16
But why ? First time it does not, second time it does.
I'll try JNS.. |
|||
28 Jun 2011, 13:16 |
|
revolution 28 Jun 2011, 13:17
JNS will give you two loops, and thus the code will execute three times. Is that what you want?
|
|||
28 Jun 2011, 13:17 |
|
Overflowz 28 Jun 2011, 13:21
Oh yes, I need 3 times with value of 2.. But I don't understand why DEC EBX modifies Z flag.. First time it does not and second time it does.. Can someone explain me please ? Thanks.
|
|||
28 Jun 2011, 13:21 |
|
revolution 28 Jun 2011, 13:24
DEC always changes the Z flag according to the result. The first time through the DEC Z flag result is the same as the TEST result so you don't see the change.
BTW: It is explained in the manuals. |
|||
28 Jun 2011, 13:24 |
|
Overflowz 28 Jun 2011, 13:27
ahh.. I got it, thank you!
|
|||
28 Jun 2011, 13:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.