My current game is an MMC3 game and I tried to maximize the amount of memory that is always available:
And I also have one 8 KB bank for actually switching out data on demand.
But now my source code has become so much that all four fixed banks are almost full. Maybe I can still save a bit by optimizing the code. But in case I can't:
What methods do you know to have more code that is either always available? Or that can be used with bank switching in an easy manner?
I mean, if I put code into banks, then it can only be functions that themselves don't access any other banked data, so bank switches in regards to actual code are severely limited.
I already put the code for text screens (title screen, password menu, artworks, credits etc.) into its own bank since this stuff is pretty self-contained, so it doesn't interfere with my other stuff. This way my main banks are all for actual gameplay stuff.
Likewise, I can make it a rule that I put every function that doesn't do a bank switch (and doesn't call other functions that do bank switches) into a separate bank. But that's probably just a small fraction of all functions anyway.
Do you have any other tactics how I can extend my normal game logic code beyond 32 KB without having too much hassle?
For example, for the text screens where the code is on its own bank and the data is on another bank, I have something like the following:
But this only works because the program logic in text screens is so little that a lag cannot really happen. But I could never access an array like that in real action scenes due to the CPU overhead.
- Two 8 KB banks are fix anyway.
- One of the switchable banks I set once in the beginning and never change it anymore, so it's also effectively fix.
(The other switchable bank is for actual bank switches.) - And then I copy code to the 8 KB additional RAM and execute it from there.
And I also have one 8 KB bank for actually switching out data on demand.
But now my source code has become so much that all four fixed banks are almost full. Maybe I can still save a bit by optimizing the code. But in case I can't:
What methods do you know to have more code that is either always available? Or that can be used with bank switching in an easy manner?
I mean, if I put code into banks, then it can only be functions that themselves don't access any other banked data, so bank switches in regards to actual code are severely limited.
I already put the code for text screens (title screen, password menu, artworks, credits etc.) into its own bank since this stuff is pretty self-contained, so it doesn't interfere with my other stuff. This way my main banks are all for actual gameplay stuff.
Likewise, I can make it a rule that I put every function that doesn't do a bank switch (and doesn't call other functions that do bank switches) into a separate bank. But that's probably just a small fraction of all functions anyway.
Do you have any other tactics how I can extend my normal game logic code beyond 32 KB without having too much hassle?
For example, for the text screens where the code is on its own bank and the data is on another bank, I have something like the following:
Code:
/* On global bank: */byte GetTextScreenArrayItem(byte *array, byte index){byte item;SwitchBank(TextScreenData);item = array[index];SwitchBank(TexScreenCode);return item;}/* On text screen data bank: */const byte SomeStuff[] = { ... };/* On text screen code bank: */for (i = 0; i < sizeof(SomeStuff); ++i){byte value = GetTextScreenArrayItem(SomeStuff, i);...}
Statistics: Posted by DRW — Sat Oct 19, 2024 2:40 pm — Replies 1 — Views 84