MACRO on ASM6809
Posted: Mon Nov 05, 2018 3:41 pm
Hello,
I would like to create a macro that should use a long branch or a short branch
upon the distance to the target label.
Say something like this:
IF (a00100 - (*+2) > 127) ; a00100 is the label where execution should branch if condition satisfied
lbeq a00100
ELSE
beq a00100
ENDIF
How could I create a macro that would receive TWO parameters: the condition Type and the destination label (both as strings)
for instance used that way: CONDJMP beq a00100 ; macro - condition - destLabel
CONDJMP MACRO
IF (\2 - (*+2) > 127) ; adding two because pointer will be already past compare line
"l"\1 ; l in front of condition to create a long branch
ELSE
\1
ENDIF
ENDM
When I compile this, I get a double error message
syntax error: TESTSPEED.ASM:9: no positional variables on stack
syntax error: TESTSPEED.ASM:11: no positional variables on stack
Does anybody know the right way to declare and use a macro with 2 parameters?
Any hint would be highly appreciated
cheers
pere
I would like to create a macro that should use a long branch or a short branch
upon the distance to the target label.
Say something like this:
IF (a00100 - (*+2) > 127) ; a00100 is the label where execution should branch if condition satisfied
lbeq a00100
ELSE
beq a00100
ENDIF
How could I create a macro that would receive TWO parameters: the condition Type and the destination label (both as strings)
for instance used that way: CONDJMP beq a00100 ; macro - condition - destLabel
CONDJMP MACRO
IF (\2 - (*+2) > 127) ; adding two because pointer will be already past compare line
"l"\1 ; l in front of condition to create a long branch
ELSE
\1
ENDIF
ENDM
When I compile this, I get a double error message
syntax error: TESTSPEED.ASM:9: no positional variables on stack
syntax error: TESTSPEED.ASM:11: no positional variables on stack
Does anybody know the right way to declare and use a macro with 2 parameters?
Any hint would be highly appreciated
cheers
pere