I'm trying to figure out the best way to organize my bank switching for code (im working with an MMC3).
Basically I made one of the (two) switchable 8KB banks for data, and the other one for code. Seems like the best setup.
For code, some big chunks are relatively independent of the rest so they can be easily moved in their own banks, simply remember to switch before calling and it's all good.
Some parts are most susceptible from being called from all the over the code (ex: a procedure to draw text). Sometimes calls can be made from one code bank to another. It can get pretty annoying to track all the dependencies. But these functions can be big and are not called hundreds of times per frame, so moving them to a bank makes sense to me.
Ideas I tried so far (they work, but none make me 100% happy) :
How do you guys organize your code in multiple banks?
-Mat
Basically I made one of the (two) switchable 8KB banks for data, and the other one for code. Seems like the best setup.
For code, some big chunks are relatively independent of the rest so they can be easily moved in their own banks, simply remember to switch before calling and it's all good.
Some parts are most susceptible from being called from all the over the code (ex: a procedure to draw text). Sometimes calls can be made from one code bank to another. It can get pretty annoying to track all the dependencies. But these functions can be big and are not called hundreds of times per frame, so moving them to a bank makes sense to me.
Ideas I tried so far (they work, but none make me 100% happy) :
- Keep all the generic code the fixed bank, more specialized code in swappable banks. Swap bank manually.
- Create little stubs for these big functions that are called all-over the place that automatically push/restore the code bank when the function is called. I'm worried about perf with this idea (easily 50-100 cycles or overhead).
How do you guys organize your code in multiple banks?
-Mat