# The Kernel's Secret Recipe

I've been thinking about the possibility of a multisprite kernel with an asymmetric, reflected playfield, all with no line breaks. It's impossible via normal means, I know. But I was thinking about the repositioning routine and how inefficient it is to basically divide by 15 right smack dab in the middle of the kernel!

So I thought of a possible solution: write 12 or 13 one-line mini-kernels for repositoning, each containing routines to draw the playfield, but they will differ in when they hit RESPx (at 5 cycle increments.) Each mini-kernel would probably need to be accessed by an indirect jump to RAM. This could be set up outside the kernel.

The only timing issue I see is with a reflected playfield, the store for the second PF2 must be timed just right, so the difference between a RESPx before and after would be 6 cycles.

I can see one way around this. Incidentally, RESP0 is $10 and PF2 is $0F, so a JSR would write to each one cycle apart, with PCH going into RESP0 and PCL going into PF2. But to write one of 256 different values would require 3 full pages of JSR's, all pointing back to the next instruction. And we'd need another indirect jump to get us to the right JSR. This would mean that the RESP0 occurred at cycle 47 since the PF2 write must occur at 48, and so mini-kernels would need to have RESP0 occurring at cycles 22, 27, 32, 37, 42, 47, 42, 47, 52, 57, 62, 67, 72 (maybe the first or last one isn't necessary?)

This will be a 2LK with cycle 73 HMOVEs.

Questions I have are: have I missed anything that would make this impossible? And, has this been done before?

If y'all think this might work, does anyone want to help write this kernel, and/or write a mini-kernel or two to add to it?

## 14 Comments

## Recommended Comments