Author Topic: "Return if equal" - how to  (Read 9917 times)

nobody

  • Guest
"Return if equal" - how to
« 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

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: "Return if equal" - how to
« Reply #1 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