Re: macro usage
Dave Tweed <[email protected]> Thu, 30 Jun 2011 21:26:44 +0000 (UTC)
| Newsgroups | gmane.comp.hardware.microcontrollers.gnupic |
|---|---|
| Organization | Embedded Computer Engineering |
| Message-ID | <[email protected]> |
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