No title to the post. Megaman stuffs…
Anyway, I got all the sprites for Cutman’s stage done. That is to say, all the new sprite sheets are in order. Hacking the room loading routine is next. I’ve already traced through it more times than I care to admit. I might be pretty fluent in 65x, but that doesn’t reading/understanding someone else’ code is easy.
The game makes it easy though. The game breaks down a sprite/palette load for a given room, over about 40 frames. That slow pan up or down, left or right, it’s updating vram sprites (which is why all sprites except megaman/score/powermeter are turned off). The game divides a level into 16k banks. There’s a variable for ‘currentlevel’; the game grabs this, maps it, uses the ‘current room’ as an index, and reads from a table (this table is in every level and in the same spot, just different values corresponding to the level), then maps in the tile bank and transfers to vram. All my hook needs to do, is get ‘currentlevel’ and ‘currentroom’, and the rest is just loading my own graphics to vram.
That part is fairly easy. The problem I’m running into now, is that there’s no room left in the ’emulation’ bank. There is where all the apu/ppu/mapper emulation code is. Since this is a fixed bank, this is also where my hack code and tables are. As of yesterday, I had to move all the enemy sprite sheets (object information, not the cell data) to another bank. Even with that, I’m left with 500bytes free in that 8k bank. So now I’m tasked with creating a second ‘library’ bank for code, and move non essential code to there (APU reg write code, PPU reg write code). I’m taking a note from the NES games, and duplicating the TIMER and VDC/NMI code into the second lib bank at the same place. That way when I swap in the far bank, the interrupt code still behaves as normal.
Eventually, I’ll won’t be needing the APU and PPU emulation code anymore. Actually, I soon plan to convert the sound FX in the game to a different format. Something along the lines of VGM format. That is to say, the sound FX will be streaming port writes at 1/60 tick (anything higher seems wasteful). It takes up very little room, compresses easily (and light on cpu resource), and allows me to make new sound FX outside of any music/sound engine design (and I don’t have to worry about a new PCE sound engine having legacy support too). Though OAM emulation will probably be the first to go. Once all the sprites have been converted over, I won’t need NES OAM (SAT) emulation anymore. That’ll free up a little bit of cpu resource. The tilemap code will probably be one of the last to go, leaving the game completely native PCE in execution (albeit limited to game logic).
But back to the ‘currentlevel’ and ‘currentgame’ variables. Knowing these two, I can create new stages. I just need to hook the bank changing routine for the higher level #’s. I want to add in two more Robot Master levels. Not MM: Powered Up levels, but something unique to this PCE version. That also means two new items or weapons. I figured I’ll probably make them ‘item-ish’ rather than weapons, as that would be harder to balance the game with new weapons. Or maybe new ‘moves’, like slide and charge power shot (you won’t need to ‘equip’ them). I do want to make a weapon/function that’s equivalent to ‘enery tanks’ in later MM games. I figured something along the lines of; convert weapon energy to health. And depending on the difficulty of the game setting, will be the ratio of transfer from energy to health.