gnupic: macro usage
Subject:
macro usage
From:
Joe M ####@####.####
Date:
30 Jun 2011 20:03:50 -0000
Message-Id: <BANLkTikQaKfT_-cx-_S-+4F3Lw3aubTpwQ@mail.gmail.com>
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