Re: A83: Question About Storing Words (.dw)


[Prev][Next][Index][Thread]

Re: A83: Question About Storing Words (.dw)




the homonerdicus wrote:
> 
> And how do you define a word using the
> #DEFINE xxx xxx
> statement ?

The # directives are taken straight outta C - this means #define,
#include, and whatever else you can do (I haven't tried, but I'll bet
there's also #if, #else, #undef, and a whole slew of other directives).

Now if TASM includes a full pre-processor (the doodad that handles all
the #-lines), then the #define directive is probably much more powerful
than you would realize.

It's basically a macro replacement system, with two forms:

    #define name <replacement text>

This replaces instances of "name" with the replacement text, which can
be anything really.  More interesting, though, is this form:

    #define name(arg1[,arg2[,...]]) <replacement text>

This replaces instances of "name" with the replacement text, but with
parameter substitution.  For example

    #define WHATS_AT(p) (p)

would replace calls to WHATS_AT like so:

    WHATS_AT (45h)   becomes   (45h)
    WHATS_AT (hl)    becomes   (hl)

and so on.  This could help make code a bit more readable, less complex,
whatever.  Use at your own risk.

-- 
John Kugelman.  jkugelman@mgfairfax.rr.com

I believe we can change anything.
I believe in my dream.
    - Joe Satriani


References: