Hi team,
I would like to write a simple macro which do the following (pseudo-code)
define link 0
setlink MACRO
$1 dw link ; write the link value at the current compile time address, initial value is 0
define link $1 ; set link value to the current compile time address
ENDMACRO
Every time you call setlink (during compile time) the link value (an address) is write and link is set to current address.
this is the common way to build a linked list.
Well, using CCSV6.1 and asm430 (the inside assembler) I cannot do that, whatever I try ... Basically
.asg 0,link
setlink .macro
$1: .word link
.asg $1,link ; or .asg :$1:,link, which would be conceptually better
.endm
don't work, because you can't assign a label to a symbol. an other attempt, for example
setlink .macro
.word link
link .set $-2 ; or link .set $1 if previous statement was labeled withe $1
.endm
don't work because you cannot redefine link several time (each tiem you call the setlink macro) ...
I'm on the way to forgive CCS, unless someone have the right solution but I'm pessimistic ...
BR
Claude