I figured out a simple way to add structured control-flow (IF ELSE ENDIF WHILE FOR etc) to almost any assembler, using macros. The generated code is exactly the same as if you had used labels and jumps/branches, but it doesn't read like spaghetti. Is something like this this already well known? If not, does anyone care? -- Dave Keenan
Posted on 2010-11-20 00:35:53 by dkeenan
MASM comes with a lot of those macros built-in, and especially in the Win32ASM world, they are commonplace. You'll find them being used often in tutorials for example (eg Iczelion's tutorials).
Likewise, macros/directives for function prototypes, arguments and local variables are also used quite often.
Posted on 2010-11-20 04:19:01 by Scali
The NASMX package http://sourceforge.net/projects/nasmx/ has many higher level support constructs for Nasm developers.
Posted on 2010-11-20 09:37:15 by p1ranha
Thanks Scali and p1rahna,

I'm glad to learn that the x86 community at least has the benefit of built-in support for structured control-flow. I decided to write up my method anyway, since it seems there are many processors for which no such assembler is available, or for which the free assemblers have no such support. And because you may not like the way the built-in support works and may want to define your own or extend the existing.

My tutorial can be found here:
http://dkeenan.com/AddingStructuredControlFlowToAnyAssembler.htm

Comments and suggestions are welcome.

-- Dave
Posted on 2010-11-21 22:42:18 by dkeenan
Thanks Dave for the good info.

Have a great day,
                          Andy

http://intouch.org/magazine/daily-devotional
http://www.happynews.com
Posted on 2010-11-22 07:29:11 by skywalker