phase 2 complete.
Phase 1 was simple. Just adjusting the hotspots for the existing rom and adding 2 dummy banks. I did that in 10 minutes without any glitches.
Phase 2 was more challenging. The moving of all vertical blank code out of the Display Bank (bank 0) into it's own bank (bank 2) and then adjusting the code to allow quick movement between the banks. One problem with this is that I also wanted the startup code out of the Display Bank. But the Display Bank was where the labels were. Got around this the cheap way by compiling the Display Bank first, then looking through the output for the label values to plug into Bank 2 before compiling it. The less unnecessary code I have in the Display Bank, the more space I have for different monsters/items.
After replacing a few labels here and there and patching the values in, it assembled properly. Of course, it had better have assembled properly since I didn't edit the code itself, and I was after re-re-re-re-re-rechecking the code and stepping through the source code to make sure it was all linked properly long before the first assembly attempt. Yeah, that's why there haven't been any real updates in a week.
Plus I procrastinate.
The final phase is to take the remaining tick-based code, collision code, and other misc overscan logic and shove it into Bank 3.
This will give me a general layout of:
Bank 0: Display Code + Object Graphics.
Bank 1: Room Loader + Room Data.
Bank 2: Screen Setup (positioning/loading sprites etc) + Object AI.
Bank 3: Collision testing and Game Tick code. (Game Tick code being stuff that only triggers once every 5-6 frames.)
Eventually I'll probably step up to 32k to get the extra 4 banks but we'll see about that a bit later. It should be easier to add banks from this since different banks hold different things. For instance some room types may require a new display kernel. I could just write the new kernel in bank 4 and have the vertical blank switch to the proper kernel with a quick test on room-type or something similar.
Additionally I'll eventually be wanting sound effects etc. Sound code could all go into it's own bank and I'd probably add Atarivox related code to that bank as well.
Food for thought for now at any rate. One thing I want to do at the end of this upgrade is to modify the random-number routine. Right now it's just:
NextRandom SUBROUTINE lda random beq .doEor lsr bcc .skipEor .doEor: eor #RAND_EOR_8 .skipEor: sta random rts
A routine I yanked from either the Atari Age forums themselves, or the mini-dig or something like that.
RAND_EOR_8 is a constant defined in constants.h based on suggestions given with the routine. It works well, but it's a bit predictable and limited when you really try to see it's effects in the version roms I've released up to now. (The repositioning hearts are using it to determine their new position)
So the new routine will probably run something like this
NextRandom SUBROUTINE lda random beq .doEor lsr adc SWCHA adc Incrementer adc GameTick bcc .skipEor .doEor: eor #RAND_EOR_8 sbc SWCHB .skipEor: sta random rts
Essentially the same routine but with a few constantly changing variables thrown in. Incrementer is incremented by 1 every frame. GameTick works similarly, but it only advances up to 5-6 (based on tv type) before it wraps around. the SWCHA and SWTCB are self explanatory. Any other variables I add will have to be something I can depend on changing over frames. The sweet spot would be finding X changing variables while keeping the speed of the function itself within reason.
There's all sorts of variables I suppose that could be used really, but perhaps the above should be fine. I'll test it out later after the overscan is moved. ![]()

3 Comments
Recommended Comments