hardware is done and software/CPLD updates
The tl;dr version of this update: The hardware is tested, no bugs found, and the PCB manufacturer prepares the series production now. The software is coming along, now written in C, with assembler libraries. New features in the CPLD allows to use the cartridge on a C128 in C64 mode and for starting C128 programs without fiddling with jumpers or the need for different menu systems.
The details:
I ported the menu program from assembler to C with CC65, only the time critical parts are in assembler anymore, which makes it easier to write programs for it. First I implemented lots of tests for the hardware, like a full RAM and flash test and MIDI in/out/thru tests. But there was still some room in the CPLD, so I implemented some more features (and tests) :
- RAM as ROM mode: now it is possible to use the RAM on the cartridge as ROM modules (in any combination, like ROM at $8000 only, or ROM at $8000 and $a000), instead of the flash (which is still possible)
- software reset generator
- not only the KERNAL, but the BASIC ROM can be replaced, too now. This is different from the usual cartridge replacement of $8000-$9fff and $a000-$bfff, because usually it is impossible to replace $a000-$bfff, only (emulating a ROM replacement), but I can do this with the CPLD by setting the EXROM/GAME line only when the address from $a000-$bffff are accessed and not from $8000-$9fff, for a fully transparent BASIC replacement
- HIRAM detection for using the C64 RAM under the KERNAL ROM when in KERNAL replacement mode
- the ability to override the LED state to turn them on (individually), instead of displaying the MIDI RX/TX state as in the default mode
The RAM as ROM feature makes it possible to program the RAM with the autostart cartridge id for the C128 and then generate a hardware reset, which then starts the C128 mode and the code in the cartridge. So the Kerberos cartridge is now one of the few cartridges, which works in C128 mode as well. I'll use this feature to implement a PRG start in C128 mode, same as PRG starts in C64 mode. Nice side effect: no jumpers are needed anymore. The cartridge starts always in C64 mode on a C128, but if you want to start a C128 program, it does setup the external RAM and registers and jumps to the C128 by generating a reset to start it.
In combination with the KERNAL and BASIC replacement feature, the RAM as ROM feature allows a quick turnaround time to upload a new BASIC or KERNAL to the cartridge to the RAM instead of flashing it all the time, in case you want to develop some BASIC or KERNAL extensions.
The new HIRAM hack allows to implement a fully transparent KERNAL replacement. Programs can still use the RAM below the KERNAL ROM. Unfortunately this hack doesn't work on a C128 in C64 mode, because the address lines are buffered on the expansion port on a C128. But the floppy emulation will still work, if the program doesn't use the RAM from $e000-$ffff, and I'll think of some workarounds with trampoline code in the external RAM, which needs the internal RAM. Then all you have to do is to patch the JSR addreses to the KERNAL function to point to the RAM trampoline code. For all programs with source code this is very easy, so for example with the SID-Wizard you can use the full floppy emulation on a C128 as well, for example to load or save instruments or your composed music.
BTW: I tested the EasyFlash emulation on a C128 in C64 mode and work without problems. Unfortunately Ubisoft doesn't allow me to pre-install Prince of Persia, but you can download it from CSDb and install it yourself, if you have a PC or Mac with a USB MIDI interface. I'll pre-install the EasyFlash SID collection on the cartridge.
If you are a coder, then C makes it even easier now to write your own programs for the cartridge. I'll provide some libraries and documentation, for example to use the MIDI functionality. Here is a quick test using the current MIDI library, which implements a synthesizer:
https://github.com/FrankBuss/kerberos/blob/master/c64/src/synthesizer.c
And this is how it looks like:
https://www.youtube.com/watch?v=18f_2yMQ8-Q
Next step will be to finish the menu, implementing some more features, like a disk file browser in the menu system to flash programs from floppy or SD2IEC, or to transfer whole disks to and from a PC or Mac, implementing the floppy emulation, and writing more documentation.