One of the goals for Compy is not only to provide a computer for new retro-games, but also to port existing games from different computers of the 8-bit era adding improved options for graphics and sound. One of the key elements to help on this goal is the dual CPU feature, the system will boot with a Z80 CPU and if a certain function key is pressed, it will transfer the control to a 6502 CPU (details at the end). This will allow the users to boot the machine with the processor of their preference.
Today there are many people that is doing “remakes over original hardware”, they take an existing game from a specific computer and they patch the game to create a better version on that same computer. They are also porting games from similar architectures, for example they take an ZX Spectrum game and create an improved port for a more advanced computer like the MSX2. In the past, the game companies ported ZX games to the MSX but as budget was scarce they just made the minimum effort and they didn’t use the improved hardware. Today the only limit is the will to do it.
Compy provides improved graphics and sound but the design should allow a game to be ported with minimal changes. Chroni – the video processor – has Atari 800, Amstrad and ZX Spectrum like video modes and as of today, it provides dual POKEY audio with PSG (AY-3810) is planned. I don’t think there would be ports from C64 or MSX machines, they already have great hardware and older games still have room to push the limit on those computers.
A port should be easy to make at the base level, this being having a version that is just identical to the original. From there on many improvements could be made, starting with using a better color palette and as much as redoing all the graphics, using hardware sprites and improving the music and sound.
Multi clocks for the CPUs
Making such improvements may push the Z80 and 6502 to their limits, some games were designed to use all available cycles and making small changes like adding more sound channels may consume those scarce spare cycles. So to give greater flexibility these processors will run at a variable clock rate, they will start running at their original clock rate and the games will have the ability to switch the processor to a higher clock rate just writing to a specific port.
This will not only allow a game to do more stuff, it will also make CPU intensive games run faster. This has been already been done and there are excellent results in games like Rescue in Fractalus using accelerator cards.
In their original computers these processors were clocked around the TV NTSC and PAL standards, because they worked in sync with the video processor and pixel generation. Common frequencies for the 6502 and Z80 were 1.79 and 3.58Mhz respectively. Note that even when the 6502 was clocked at half the speed of the Z80, the internal design made the 6502 ran very well at that speed.
I still have to test it and see if this can be done but I would like to have a master clock at the speed required for video generation, and divide that clock to provide lower clock rates for each processor. Let’s say the video processor runs at 28.64Mhz, then using clock dividers I can provide 14.32Mhz, 7.16Mhz, 3,58Mhz and 1.79Mhz (CLK/2, CLK/4, CLK/8, CLK/16). The 6502 would use CLK/16 and the Z80 would use CLK/8 at boot, but writing to a specific port they can switch to a faster CLK/4 and CLK/2. That would give enough power to make new games or make greatly improved ports, but as I said, I still have to test if this would work or not in FPGA given the original designs of these processors and other timing considerations like DRAM access and shared memory between the CPU and Chroni.
For this to work Chroni will receive the CLK signal and it will provide a derived signal for each processor. At all times Chroni will have the control over the clock – hence the name – and this will give it the power to halt the CPU and/or switch it to a different clock line as requested.
To boot the system and select the active processor, this will be the boot sequence:
- The system starts with the Z80 ROM mapped at the bottom of the memory map
- The Z80 boot code checks if certain function key is pressed
- If pressed, the 6502 ROM is mapped to the top of the memory map
- The Z80 code writes to a port on Chroni to switch the CPU
- Chroni halts the clock for the Z80
- Chroni gives the clock to the 6502 and proceed with a reset procedure
- The 6502 ROM code disables the Z80 ROM
- The 6502 continues booting the system
At this moment there are no plans to switch back to the Z80 once the control to the 6502 has been given, that would make the design too complex even though it may open the doors to advanced programming tricks, but this is still too much beyond in the future.