gnupic: macro usage
Subject:
Re: macro usage
From:
Dave Tweed ####@####.####
Date:
30 Jun 2011 21:26:22 -0000
Message-Id: <E1QcOki-00013Z-Tx@elasmtp-mealy.atl.sa.earthlink.net>
Joe M wrote:
> I am trying to generate a table of calls such as:
>
> call mycall1
> call mycall2
> call mycall3
>
> and this is the code I am trying it with:
>
> repeat macro label,firstIndex,no_of_times
> if (no_of_times > 0)
> call label#v(firstIndex)
> repeat label, (firstIndex + 1),(no_of_times - 1)
> endif
> endm
>
> repeat mycall,1,10
>
> repeat mycall,1,9 works fine. But, not "repeat mycall,1,10"
Recursive macro expansion?!?
It wouldn't surprise me in the least if the stack limit for expanding macros
is on the order of 10 levels. But I guess I would be surprised that gpasm
doesn't give you an explicit error message about exceeding that.
It would be better to use a loop. MPASM has while/endw directives -- does
gpasm have this as well?
-- Dave Tweed