Hi Mark,
I'm sure there are many macro sets for Nasm that include while/endwhile. One I know about is Nasm64developers's "control_flow.zip", available from the "files" page here. I was going to cut-and-paste his while/endwhile, but I thought "No, the forum software will screw up the formatting. Give him a specific link to download it, instead." But the "files" page seems to be down for repairs right now, so back to cut-and-paste. :)
;---------------------------------------
; WHILE...ENDWHILE
;---------------------------------------
%imacro WHILE 1.nolist
; allow nesting: omit %if(n)ctx while
%push while
%define %$cc %+1
jmp %$eval
%$beg:
%endmacro
%imacro ENDWHILE 0.nolist
%ifnctx while
%error ENDWHILE: must use WHILE first
%else
%$eval: j%$cc %$beg
%$end:
%pop
%endif
%endmacro
;---------------------------------------
; CONTINUE and BREAK
;---------------------------------------
%imacro CONTINUE 0.nolist
%ifctx repeat while
jmp %$eval
%else
%error CONTINUE: must use REPEAT or WHILE first
%endif
%endmacro
%imacro BREAK 0.nolist
%ifctx repeat while switch
jmp %$end
%else
%error BREAK: must use REPEAT or WHILE or SWITCH first
%endif
%endmacro
As I read this, it isn't really equivalent to Masm's ".while". The parameter has to be a condition code - "WHILE z", etc. You can't do ".while eax != ebx" or so, as I think you can in Masm. Looks like "nagoa+.inc" would accept "while eax, ne, ebx", which is a little closer...
http://www.visual-assembler.pt.vu/Compared to Masm's "built in macros", the best part of Nasm's system is that anyone can write their own macros. The worst part is that everybody does! :)
Best,
Frank