Article View: comp.sys.amiga.tech
Article #3806Re: a68k macros
From: Charlie Gibbs
Date: Tue, 05 Jun 1990 20:27
Date: Tue, 05 Jun 1990 20:27
77 lines
2616 bytes
2616 bytes
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.
Technical Details
Message-ID:
<2016@mindlink.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!van-bc!rsoft!mindlink!a218Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!van-bc!rsoft!mindlink!a218 From: a218@mindlink.UUCP (Charlie Gibbs) Newsgroups: comp.sys.amiga.tech Subject: Re: a68k macros Message-ID: <2016@mindlink.UUCP> Date: 5 Jun 90 20:27:45 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 77