Friday, January 31, 2014

256-colour modes now mostly working

The past few days I have been fixing some bugs in the VIC-IV character generator that were causing various glitches.  Today I got the last of the important ones fixed, and so now when the C65GS boots, it looks just like a real C64:

I also had time to finish implementing the palette.  The palette is mostly like on the Commodore 65, with $D1xx holding the red component, $D2xx the green and $D3xx the blue components.  These are 8-bit registers, in principle allowing for 24-bit colour, but for now the simple VGA output I am using is limited to 12-bit colour.  I have plans to make an HDMI out that would have 24 colour digitally.  Here is what happens when you run:  LDA $D012; STA $D020; JMP *-6, you get nice beautiful solid raster bars with the default palette (which is 128 colours repeated twice).

$D012 is the VIC-II compatibility raster counter, so it is counting every 5th raster.  If we use $D052 instead, we get the physical raster counter, which means the raster bars get much, much finer:

You really need to see a zoomed detail to see just how fine they are:

With these various other bugs and problems fixed, I was also able to test fullcolour character mode.  This tells the VIC-IV to use 64 bytes for each character instead of 8, and each byte is the colour value for a single pixel of the character.  Just flip bit 1 in $D054 on and it is engaged for all characters.   The display then changed to the following, showing the 1970s carpet stripe pattern from the default contents of RAM, as well as some horizontal gradient I POKEd in, just because I could.

Here is the same thing with the resolution increased from 320x200 to 800x500 using the hardware scale registers ($D042, $D043). It is really 960x600 resolution if you used the border area, which is easy to do.

What is not apparent in the above is that I have also implemented four palette banks, so there is really a 1,024 colour palette available.  I will most likely make it possible to use a different palette bank for background and sprites at the same time.

Finally, here is the hardware and the monitor together, before the FPGA board gets put inside a C64 case and uses a real C64 keyboard for interaction.  There will still be plenty more to do before the FPGA design is complete, including of course sound and sprites.

No comments:

Post a Comment