Say I have a source file, entities.asm, which is structured roughly like this:
.linecont +
.include "ndxdebug.h"
.include "entities.inc"
.include "entity.inc"
.segment "ROM05"
.include "enemy1.inc"
And in entity.inc I have a macro:
.macro my_macro
;do fun stuff with code
.endmacro
Then say my enemy1.inc includes a file called enemy1_constants.inc:
;define a bunch of constants here
;now try to use the macro from entity.inc
my_macro ;DOES NOT COMPILE!!!
I find that in this inner include file, I can see equates and other symbols that had been previously included in entity.asm but not macros unless I re-include the header file containing the desired macro.
Does anyone understand this behavior? I did not see any comments about macros having different visibility rules within includes.
If this is known/correct behavior of CA65 it is tempting me to factor out all my macro definitions in each module into its own header file, and re-include them where needed...
Code:
.linecont +
.include "ndxdebug.h"
.include "entities.inc"
.include "entity.inc"
.segment "ROM05"
.include "enemy1.inc"
And in entity.inc I have a macro:
Code:
.macro my_macro
;do fun stuff with code
.endmacro
Then say my enemy1.inc includes a file called enemy1_constants.inc:
Code:
;define a bunch of constants here
;now try to use the macro from entity.inc
my_macro ;DOES NOT COMPILE!!!
I find that in this inner include file, I can see equates and other symbols that had been previously included in entity.asm but not macros unless I re-include the header file containing the desired macro.
Does anyone understand this behavior? I did not see any comments about macros having different visibility rules within includes.
If this is known/correct behavior of CA65 it is tempting me to factor out all my macro definitions in each module into its own header file, and re-include them where needed...