On 1/19/2006 at 12:00 AM Jim Leonard wrote:
And what's everyone's opinion on IDEAL mode? I
find people either love
macros/high-level structure stuff in an assembler, or completely hate
it...
It's like any preprocessor. You can obscure what you're trying to do with
too much content; on the other hand, a preprocessor can be a real godsend.
Before MASM incorporated things like CALL with argument-list and
procedure-local variables, I had a nice macro library that essentially did
the same thing. I still use macros to do things like maintain enum list
orderings and encapsulate little things like I/O delays. But by and large,
with the MASM 6 improvements, I use macros very sparingly.
But that's not to say that there's no use for them. Suppose I wanted to
write a cross-assembler for some alien CPU. If the restrictions on binary
format weren''t too onerous, I'd probably just write up a bunch of macros
and let MASM do the grunt work. Similarly, when programming Windoze DLL's
and device drivers, macros can come in very handy to encapsulate the
Windows-specific conventions.
Occasionally, you have the task of taking a list of data items and creating
a complex structure with them. Macros make the job easy.
I occasionally wish that C's preprocessor were more powerful, like that of
PL/I. But while the C preprocessor is standard, I've seen assembler macro
facilities that were so weak as to be almost useless and some that were
wonders (support for macro arrays, typed variables and so on).
Years ago, a friend wrote an assembler for the amZ8000. He wasn't much of
an assembly-language writer, but he was a real compiler guru. So the
result was an assembler with a syntax that resembled a HLL. I wasn't sure
that I liked the idea. Assembly is the first cousin to machine language
and ought not to overly obscure that relationship.
Cheers,
Chuck