NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nobody on April 10, 2007, 08:47:39 PM

Title: "Return if equal" - how to
Post by: nobody on April 10, 2007, 08:47:39 PM
hello all
I'm a newbie to NASM. I have a CMP AL,0 and want to return from that proc if EQUAL.  sort of RETE call. Is this possible in NASM. Can someone shed some light on this please.

thanks a lot
Title: Re: "Return if equal" - how to
Post by: Frank Kotler on April 10, 2007, 10:13:28 PM
Well, there's no "rete" instruction I know of (an x86 issue, not a Nasm issue).

cmp al, 0
jne dont_ret
ret
dont_ret:
...

Might be better to:

cmp al, 0
je exit_this_function
...
...
exit_this_function:
pop ?
leave ?
ret

Multiple exit-points in a function might make for hard-to-maintain code...

Best,
Frank