Hello fellow-coders!
I am using CC65/CA65 to code for my 65C02 machine.
Does anyone of you know if and how i could use Macro's in included files?
Example:
i have a main file that includes another file using:
.include "extrafile.s"
That extrafile.s file uses macro's:
.macro somefunction
bla
bla
bla
etc.
.endmacro
This is where the compiler throws an error, because it doesn't recognize the macro's when included in the main file.
Is this at all possible? Or should i give up trying to use macro's in this way?
Thanks for the help, people!
Greetings,
Jacco
CC/CA65 - Use macro's in included files
-
jaccodewijs
- Posts: 29
- Joined: 20 Mar 2019
- Location: Rotterdam, The Netherlands
-
leepivonka
- Posts: 167
- Joined: 15 Apr 2016
Re: CC/CA65 - Use macro's in included files
Does your macro definition occur before the .include ?
Re: CC/CA65 - Use macro's in included files
I have a large amount of code that works like that - ie. an included file defines the macro which is then expanded in files that include that header file.
(It probably makes no difference, but I use the .h suffix for included 'header' files to make it more obvious)
Also, if you think about it, (and if you use it), doing something like:
pulls in macros from the standard cc65 library for you.
But (as above), make sure you have the .include line before you use the included macro your main file.
So double check the order they're included and declared it, but it all should work just fine.
-Gordon
(It probably makes no difference, but I use the .h suffix for included 'header' files to make it more obvious)
Also, if you think about it, (and if you use it), doing something like:
Code: Select all
.macpack genericBut (as above), make sure you have the .include line before you use the included macro your main file.
So double check the order they're included and declared it, but it all should work just fine.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
-
jaccodewijs
- Posts: 29
- Joined: 20 Mar 2019
- Location: Rotterdam, The Netherlands
Re: CC/CA65 - Use macro's in included files
Thank you once again, people!
I got it to work.
Was indeed the order in which includes should be.
Thanks.
I got it to work.
Was indeed the order in which includes should be.
Thanks.