I have a qustion, which has been jumping in and out of my head for some time now, how does one do in assembly a compound if statement? What I mean by this is something along the lines of:


IF (var != val1 && var <= val2)
{
  do some junk here
}

or

IF (var != val1 && var <= val2 || var > 25 && var != val3)
{
  do some junk here
}

I know that I can do it this way:


.IF var != val1
  .IF var <= val2
     do some junk
  .ENDIF
.ENDIF

but I would like to get rid of the second IF statement. Thanks MadPrgmr
Posted on 2001-05-10 17:31:00 by madprgmr
You'll shake your head now ;) Your code:

IF (var != val1 && var <= val2)
{
  do some junk here
}

or

IF (var != val1 && var <= val2 || var > 25 && var != val3)
{
  do some junk here
}
Translated code:

mov eax,var
.IF eax!=val1 && eax<=val2
  do some junk here
.ELSEIF (eax!=val1 && eax<=val2) || (eax>25 && eax!=val3)
  do some junk here
.ENDIF
tataaa ... (/me is smiling broadly)
Posted on 2001-05-10 17:49:00 by JimmyClif
Thanks.. The solution is so straight forward and simple that I am practically ashamed that I asked :o Guess I just needed some assistance in removing my head from my third point of contact so that I could restore the oxygen/blood flow to my brain
Posted on 2001-05-10 18:09:00 by madprgmr