Menu

#49 Macro in Macro Error with "%"-labels

v1.1.0
open
nobody
None
5
2006-05-28
2006-05-28
floyd_42
No

I'm using the following macros:

.MACRO _m_bris ; Branch if bit in I/O Reg is set
; Param: I/O Reg, Bit, Adr
sbic @0,@1 ; skip next if bit is clear
rjmp @2 ; bit set -> @2
.ENDMACRO

.MACRO _m_bric ; Branch if bit in I/O Reg is clear
; Param: I/O Reg, Bit, Adr
sbis @0,@1 ; skip next if bit is set
rjmp @2 ; bit clear -> @2
.ENDMACRO

.MACRO _m_specialWaitHi
; Busy Wait until C1 hi, branch C5 hi (abort)
; Param: Adr_C5Hi
_m_specialWaitHi_%:
_m_bris PINC, PINC5, @0 ; C5 hi -> @0
_m_bric PINC, PINC1, _m_specialWaitHi_%
.ENDMACRO

Using "_m_specialWaitHi" does not work, the following code

someLabel:
... code ...
_m_specialWaitHi someLabel
... code ...

give the error "[Macro: test.asm: 50:] Found no
label/variable/constant named _m_specialWaitHi_1".

Removing the Macro-in-Macro works

.MACRO _m_specialWaitHi
; Busy Wait until C1 hi, branch C5 hi (abort)
; Param: Adr_C5Hi
_m_specialWaitHi_%:
_m_bris PINC, PINC5, @0 ; C5 hi -> @0
sbis PINC, PINC1
rjmp _m_specialWaitHi_%
.ENDMACRO

I know that Macro-in-Macro handling brings up some
wired issues and handling all cases is very difficult.
But any plans to fix this?

Discussion


Log in to post a comment.

MongoDB Logo MongoDB