Dear Diary - updating what I'm working on at the moment

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

Right now I'm wrapping my head around the "weird" way the CDFJ+ template handles kernels. Well, not weird, just different. Efficient, even.

The template has this concept of "game state" and "kernel".  Any game state can use any kernel. And any kernel can use any "handler". It's a bit tricky to explain.  Let's say we have a kernel that just sets the PF registers on each scanline.  That is, copies from RAM to the PF registers, each scanline on an asymmetrical playfied.  This is the gist of many CDFJ type games. That is, the guts of the game graphics live in the C/ARM code, and the 6502 kernel simply copies memory to TIA registers.

Well, that kernel can be used in many parts of the game - for example, in my previous games we had a menu screen with asymmetrical PF and 6-sprite routine. We had a copyright screen for the Champ Games Presents stuff. We had a game-screen with a 40-pixel asymmetrical playfield. Each of those would be a different kernel - they are sufficiently different that the actual guts of the kernel - the part that runs while the beam is drawing stuff - needs to be different.  But there are opportunities to re-use kernels by allowing what happens in the vertical blank (VB) and the overscan (OS) to be different.

That is, if we have a kernel that handles asymmetrical playfield - then that kernel doesn't have to be tied to a single "game state" that is perhaps actually playing the game. So the CDFJ+ template allows you to have custom VB and OS called for a particular kernel, based on the game state. It's elegant, and pretty cheap to implement.

Furthermore, the template is setup so that kernels can live in any 6502 bank. There are 7 4K banks in the current implementation. A kernel can live in any of those.  The kernel call uses a short RAM-based bankswitch routine that switches to the kernel bank, executes the kernel's VB or OS code, swithes the bank out, and returns. It's pretty clean, and allows any 6502 bank to hold kernel code.

OK, that's simplistic, but the gist of it.  Hopefully if you care to check out the code, some of it will make sense now.

Right now I'm working on getting the "copyright" sequence up and running. That is, the Champ Games Presents logo - because it's a good example of a simple kernel to work from, and the couch compliant "kernel".  Both of these (Champ and Couch) use a single kernel (6-sprite routine centered, plus asymmetrical PF), but different game states. Thus an ideal use of the CDFJ+ template to just get my hand in on how to use it properly.