So I'm running out of time in my current draft of my kernel. This is what I'm trying to achieve by using SpiceWare's Collect tutorial as a framework:
- Blank Playfield and load scanline index Y (13 cycles)
- Load playfield scanline colour (8 cycles)
- Load Player0 graphics (18 cycles)
- SLEEP 15 for timing of left side of playfield (15 cycles)
- Draw left side of asymmetric playfield (PF0, PF1) (16 cycles) (70 cycles total)
- =========NEW SCANLINE=====
- Draw COLUP0
- Draw GRP0
- Draw Left PF2
- Draw right PF0,PF1,PF2
- Decrement scanline index Y (52 cycles total)
Continuation of Kernel Line 2:
- Calculate Missile1 (14 cycles) (66 cycles running total)
- Calculate Player1 Graphics (18 cycles) (84 cycles total)
Falling into the "stub" of Line 2 takes too long. I originally thought that I could not draw the playfield for the first scanline in the Preload section, but what I think I am going to do is get rid of Missile1 entirely. The NPCs will not have missiles to fire. They will just chase the player.
I checked the original plan I had for the game and I didn't want the NPCs to shoot anything anyway! So if I remove calculating Missile1, I will end up with 70 cycles before the end of the second line of the kernel. The issue is there is the "first part" of Line 2 down the bottom after Line 1. Remember this is how the kernel is structured:
- Second "stub" of Line 2
- Line 1
- First "stub" of Line 2
- Loop back to second "stub" of Line 2
So I have to make sure the second "stub" doesn't take longer than 76 minus 18 cycles (58 cycles).
Line 1 of the kernel is taking too long, but I think by removing the need to enable Missile1 at the beginning of Line 1, we will free up enough time to draw Left PF0.
There is more to talk about, but I think I have used this blog post sufficiently to clarify my thoughts.