Subject:
Re: macro usage
From:
Noel Henson ####@####.####
Date:
30 Jun 2011 20:14:58 -0000
Message-Id: <1309464870.1920.24.camel@HP>
Have you check the .lst output file? If your radix is not set to
decimal, you may be generating mycalls 1-9,a,b,c,d,e,f.
Noel
On Tue, 2011-06-28 at 16:56 -0400, Joe M wrote:
> Hello,
>
> I am trying to figure out how the macros in gpasm work?
>
> 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"
>
> but, gpasm gives me these errors:
>
> cp ../src/test_macro_usage.asm ./ && gpasm --expand ON -c test_macro_usage.asm
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall11).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall11).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall12).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall12).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall13).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall13).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall14).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall14).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall15).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall15).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall16).
> test_macro_usage.asm:52:Error [113] Symbol not previously defined (mycall16).
>
> sample source file:
>
> ;==== test_macro_usage.asm BEGIN
>
> errorlevel 0
> list p=18f4455 ; set processor type
> list n=0 ; supress page breaks in list file
> include <p18f4455.inc>
>
> RESET_VECTOR CODE 00000h ; Reset and Interrupt Vectors
> pagesel start
> global start
> goto start
>
> MAIN CODE
>
> global start
> start
> nop
>
> mycall1
> return
> mycall2
> return
> mycall3
> return
> mycall4
> return
> mycall5
> return
> mycall6
> return
> mycall7
> return
> mycall8
> return
> mycall9
> return
> mycall10
> return
>
> ; macro to generate a list of call such as
> ; call mycall1
> ; call mycall2
> ; call mycall3
> 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
>
> loop
> goto loop
>
> return
>
> Any thoughts, please?
>
> Thanks
> Joe
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>