I have been spending some time today on the framework itself. Most of the time went into an effort to compare the disassembled sources of level 1 and 3 from The Last Ninja 2.
What I observed is that there is a big deal of invariant code shared between these 2. Such code is very likely to be invariant for all levels but it is loaded in different positions in RAM for each level.
As a short term plan, I’d like to simply break down the sources into smaller ones and try to have a baseline that can be reused for all levels. On top of that customizations should find their place. Of course I’d like to give things a logical structure. I doesn’t really matter if the same code is not located at the same RAM locations for all levels.
As a long term plan, I’d like things to change though. In fact, apart from the tune, the disassembled sources I have now are completely relocatable. What I think would make sense for a new game is to try and make tunes relocatable too so that they can be pushed to the top of the RAM together with most of the level specific code and data: the benefit is that the invariant code would only be loaded once in the lower segment of the RAM, thus reducing duplication and file sizes.
As a consequence of having invariant code at the same RAM locations would be, as example, that the POKEs for unlimited lives, unlimited energy, etc. would be the same for all levels.