Over the years, I've developed some techniques to make my ASM6 code more organized, but as my projects grow bigger, it becomes harder to keep track of everything, and some design decisions require me to propagate changes across several files, in addition to some other minor annoyances. So now I'm again wondering if I could improve my workflow if I switched to CA65. Looking at it again, it doesn't look as complex as I used to think it was, and some of the features I've been reading about sound pretty useful to me. However, there are some things I'm used to doing in ASM6 that I absolutely can't live without, and I can't find equivalent examples for CA65. So I decided to ask here, and list some of the things I need, to see if anyone can tell me how I can do them in CA65.
1- Permanent variables vs. temporary variables:
Some parts of my program are active the whole time, such as the video, audio and input systems, so their variables don't share RAM with anything else, but other parts, such as cutscenes and gameplay, are temporary, so the RAM that comes after the permanent stuff is shared between the parts that don't run concurrently. In ASM6 I have a "memory counter" symbol for each RAM page that's updated for the permanent stuff, but not for the temporary stuff. How would I do this is CA65?
2- Fake fixed bank of flexible size:
Working with a mapper that switches 32KB PRG-ROM pages, I need a block of code/data to be present in the end of every bank. In ASM6, I mark the start and the end of such block with labels, and the difference between these labels gives me the size of the block, which I can subtract from $10000 to .org the block to the end of each bank. What would be the CA65 equivalent to this?
3- Repeated labels:
There's code and data that must be included multiple times (in different banks), but labels can't be redefined, so instead of using labels I save the current PC in a symbol, which can be redefined. What's the correct way to approach this in CA65?
4- What's the deal with .import and .export?
This one has nothing to with ASM6, it's just that I still can't figure out what exactly a "module" is in CA65, and when .import and .export are needed. Can anyone sum it up for me?
This is all I can think of right now, and if I can get around these issues I might be able to convert my code to CA65. I probably forgot something, so I may need to ask more questions later. I don't plan on wasting much time on this though, so if it ends up being too complicated I might not go through with it. We'll see. Thanks in advance for helping me out.
1- Permanent variables vs. temporary variables:
Some parts of my program are active the whole time, such as the video, audio and input systems, so their variables don't share RAM with anything else, but other parts, such as cutscenes and gameplay, are temporary, so the RAM that comes after the permanent stuff is shared between the parts that don't run concurrently. In ASM6 I have a "memory counter" symbol for each RAM page that's updated for the permanent stuff, but not for the temporary stuff. How would I do this is CA65?
2- Fake fixed bank of flexible size:
Working with a mapper that switches 32KB PRG-ROM pages, I need a block of code/data to be present in the end of every bank. In ASM6, I mark the start and the end of such block with labels, and the difference between these labels gives me the size of the block, which I can subtract from $10000 to .org the block to the end of each bank. What would be the CA65 equivalent to this?
3- Repeated labels:
There's code and data that must be included multiple times (in different banks), but labels can't be redefined, so instead of using labels I save the current PC in a symbol, which can be redefined. What's the correct way to approach this in CA65?
4- What's the deal with .import and .export?
This one has nothing to with ASM6, it's just that I still can't figure out what exactly a "module" is in CA65, and when .import and .export are needed. Can anyone sum it up for me?
This is all I can think of right now, and if I can get around these issues I might be able to convert my code to CA65. I probably forgot something, so I may need to ask more questions later. I don't plan on wasting much time on this though, so if it ends up being too complicated I might not go through with it. We'll see. Thanks in advance for helping me out.