The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: kermit on November 28, 2006, 07:18:33 PM

Title: .if eax < 0 / zeroflag , noob question
Post by: kermit on November 28, 2006, 07:18:33 PM
hello,

i recently made a mistake in my code trying to use
.if eax<0
   ...
which wasn't working as expected, because eax was always treated as positive number, even though i explicitly moved -1 to eax  :P
is there a different way than coding:
.if eax<=-1
   ...

?
And i wondered if there is a way to check the flags with the .if/.elseif constructs, somehow like this:

.if zeroflag
...

?

oliver
Title: Re: .if eax < 0 / zeroflag , noob question
Post by: hutch-- on November 28, 2006, 07:26:45 PM
Hi Oliver,

Welcome on board. Try something like this.

.if SDWORD PTR eax < 0
Title: Re: .if eax < 0 / zeroflag , noob question
Post by: P1 on November 28, 2006, 09:33:12 PM
Oliver,

Welcome  :U

I nice learning tool is to use Svin tttn for op code jump decisions.

Regards,  P1  :8)



[attachment deleted by admin]
Title: Re: .if eax < 0 / zeroflag , noob question
Post by: Ehtyar on November 28, 2006, 09:44:36 PM
I think you're looking for ".IF (ZERO?)"?
Title: Re: .if eax < 0 / zeroflag , noob question
Post by: kermit on November 28, 2006, 09:51:48 PM
thanx for the welcome and the suggestions,
i'll give them a try

@ehtyar yes, that was what i was looking for, i guess there is an ".if (SIGN?) " also

thx,

oliver
Title: Re: .if eax < 0 / zeroflag , noob question
Post by: Ehtyar on November 28, 2006, 10:08:23 PM
You will find all of these operators in the masm32.hlp file that comes with masm32. The available flags are:
CARRY?
OVERFLOW?
PARITY?
SIGN?
ZERO?

Hope this helps, Ehtyar.