[comp.sys.amiga.tech] a68k macros

a218@mindlink.UUCP (Charlie Gibbs) (06/01/90)

In article <10005@hydra.gatech.EDU> gt5784a@prism.gatech.EDU
(Walter G. Reynolds (JJ) writes:

>   Does anyone know if there is a way to pass more than 9 parameters
>to macro calls in A68k?  I have the metacompco assembler, and it allows
>up to 15 (an undocumented feature, I think) by using \A through \F.
>
>When I tried to compile my code using a68k, it didn't recognize the
>\A-F parameters.  Charlie?

     Silly me, I didn't realize that those parameter numbers were
supposed to be limited to a single digit.  I whipped up a little
test program using a macro with 20 parameters (\1 through \20) and
it works just fine.  You should be limited only by available memory.
Go nuts!

     I never could figure out how to impose arbitrary restrictions... :-)

Charlie_Gibbs@mindlink.UUCP
"Argue for your limitations, and they're yours."
        -- Richard Bach, Illusions

gt5784a@prism.gatech.EDU (Walter G. Reynolds (JJ)) (06/01/90)

   Does anyone know if there is a way to pass more than 9 parameters
to macro calls in A68k?  I have the metacompco assembler, and it allows
up to 15 (an undocumented feature, I think) by using \A through \F.

When I tried to compile my code using a68k, it didn't recognize the
\A-F parameters.  Charlie?

(incidentally, if you are wondering why I am using so many god-awful
parameters, I am doing my menu declarations (including intuitext strs)
using macros...)

W.Reynolds.

-- 
"I think, therefore I am." - Descartes               |          Only Amiga
"I know you are, but what am I?" - Pee Wee Herman    |    // makes .sigs like
"I think not, therefore I am not." - ?               |\\ //   this possible.
"I thought I think I was. Am I?" - Me, on Fri Nights | \X/

a218@mindlink.UUCP (Charlie Gibbs) (06/05/90)

In article <12286@cbmvax.commodore.com> valentin@cbmvax.commodore.com
(Valentin Pepelea) writes:

>I think Walter was pointing out that A68K was not accepting \A-\F explicitly.
>Normally it would be a good thing for A68K to mimic Metacompco's behavior,
>but since this was an allegedly undocumented feature, this is not so
>important.

     Ah.  Yes, this was sneaky of Metacomco.  However, in a similar
fit of sneakiness (actually, by popular demand) I extended A68k so
that any label preceded by a backslash is treated as a local label
in the same manner as Metacomco's nnn$ construct (which I also
support).  Things like \A would fit into this category.  I didn't
realize that there would be a conflict (as you said, Metacomco's
behaviour is undocumented, at least in the Bantam manual) but my
loyal fans like named local labels better anyway.

>So, when can we expect A68K to handle 030/040 instructions?

     Can you say Real Soon Now?  :-)  Maybe in the fall when the
weather turns too rotten to spend what little spare time I have
outside.  The 68020's assembly language syntax was as big a break
with the 68000's as the 68000 hardware was with the 6800; I'll
have to completely rewrite the operand parser and code generator.

Charlie_Gibbs@mindlink.UUCP
"I'm cursed with hair from HELL!"  -- Night Court

valentin@cbmvax.commodore.com (Valentin Pepelea) (06/05/90)

In article <1969@mindlink.UUCP> a218@mindlink.UUCP (Charlie Gibbs) writes:
>
>> When I tried to compile my code using a68k, it didn't recognize the
>> \A-F parameters.  Charlie?
>
>     Silly me, I didn't realize that those parameter numbers were
> supposed to be limited to a single digit.  I whipped up a little
> test program using a macro with 20 parameters (\1 through \20) and
> it works just fine.  You should be limited only by available memory.
> Go nuts!

I think Walter was pointing out that A68K was not accepting \A-\F explicitly.
Normally it would be a good thing for A68K to mimic Metacompco's behavior,
but since this was an allegedly undocumented feature, this is not so
important.

So, when can we expect A68K to handle 030/040 instructions?

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be

a218@mindlink.UUCP (Charlie Gibbs) (06/06/90)

In article <10150@hydra.gatech.EDU> gt5784a@prism.gatech.EDU
(Walter G. Reynolds (JJ) writes:

>Actually, I hate to say this, but I believe that the metacompco way
>is actually better in it's own way.  For instance, suppose I had the
>following macro:
>
>Blah    MACRO
>\10: dc.b 0
>\11: dc.b 2
>\12: dc.b 5
>        ENDM
>
>..and then made this call..
>
>   Blah   Lbl
>
>I would expect my generated macro to produce this code:
>
>Lbl0: dc.b 0
>Lbl1: dc.b 2
>Lbl2: dc.b 5
>
>In the way that Mr Gibbs has done this, there is no way to have another
>number immediately follow the parameter within the macro (unless I am
>mistaken..).  Therefore, having your parameters limited to a single char-
>acter would be advantageous.

     I was afraid someone was going to mention this.  I ran your
example through assem and you're absolutely right.  It reminds me
of the solution taken by the IBM 360/370 assemblers: optionally
follow the parameter by a period which serves as a terminator
(if present, it's eaten when the actual value is substituted).
In my defense I can only say that in the Bantam book it was never
explicitly stated that the parameter number was restricted to a
single digit, so I fell back on a more traditional definition of
"number."

     I suppose I should provide a workaround.  Try this:

Blah    MACRO
\@0:    dc.b 0
\@1:    dc.b 2
\@2:    dc.b 5
        ENDM
Lbl:
        Blah
        end

Both A68k and assem generate:

.0010:  dc.b 0
.0011:  dc.b 2
.0012:  dc.b 5

Note that I moved "Lbl" to a label ahead of the macro call.
Unfortunately, there's no way to relate "Lbl" directly to ".001"
but you could at least do relative addressing from "Lbl" by
pointing an address register to it.  Then you could even get
rid of the \@ construct.

     Hope this helps.  (tm)

>Then again, having unlimited passable parameters is nice, too :)

     I thought so too.

>(wishing I even HAD an 030 or 040)

     Don't bother.  It just makes people want support for those
weird new instructions and addressing modes (arghhh... :-).
But it sure does a fast imitation of a 68000.

>W.Reynolds.

Charlie_Gibbs@mindlink.UUCP
If your nose runs and your feet smell, you're built upside-down.

gt5784a@prism.gatech.EDU (Walter G. Reynolds (JJ)) (06/06/90)

In article <12286@cbmvax.commodore.com> valentin@cbmvax (Valentin Pepelea) writes:
>In article <1969@mindlink.UUCP> a218@mindlink.UUCP (Charlie Gibbs) writes:
>>
>>> When I tried to compile my code using a68k, it didn't recognize the
>>> \A-F parameters.  Charlie?
>>
>>     Silly me, I didn't realize that those parameter numbers were
>> supposed to be limited to a single digit.  I whipped up a little
>> test program using a macro with 20 parameters (\1 through \20) and
>> it works just fine.  You should be limited only by available memory.
>> Go nuts!
>
>I think Walter was pointing out that A68K was not accepting \A-\F explicitly.
>Normally it would be a good thing for A68K to mimic Metacompco's behavior,
>but since this was an allegedly undocumented feature, this is not so
>important.

Actually, I hate to say this, but I believe that the metacompco way
is actually better in it's own way.  For instance, suppose I had the
following macro:

Blah    MACRO
\10: dc.b 0
\11: dc.b 2
\12: dc.b 5
        ENDM

..and then made this call..

   Blah   Lbl

I would expect my generated macro to produce this code:

Lbl0: dc.b 0
Lbl1: dc.b 2
Lbl2: dc.b 5

In the way that Mr Gibbs has done this, there is no way to have another
number immediately follow the parameter within the macro (unless I am 
mistaken..).  Therefore, having your parameters limited to a single char- 
acter would be advantageous.

Then again, having unlimited passable parameters is nice, too :)

>So, when can we expect A68K to handle 030/040 instructions?

(wishing I even HAD an 030 or 040)

W.Reynolds.

-- 
"I think, therefore I am." - Descartes               |          Only Amiga
"I know you are, but what am I?" - Pee Wee Herman    |    // makes .sigs like
"I think not, therefore I am not." - ?               |\\ //   this possible.
"I thought I think I was. Am I?" - Me, on Fri Nights | \X/