Quick update: I’ve finally managed to get a version synthesised that has video, audio & gpio all working… and even managed to just squeak in at 17.1MHz timing… it’s been quite a fight to get it all to fit though, and naturally some things had to be sacrificed…
For one, the LCD CS, RW and backlight enable pins were all sacrificed - they were essentially constant drivers anyway.
On the audio side of things, some sacrifices were made:
- it’s still 4 channel, and there are still 4 available waveform generators (square, saw, triangle, noise), but…
- each channel’s waveform generator now produces only 6-bit output (down from 12)
- there is no ring modulation or sync support
- channel (and global) volume controls are now 4-bits instead of 8.
- pulse-width selection for square waveform is now 4-bits instead of 12.
- the phase accumulator width has been trimmed, and with it the sample rate (from 1MHz - which was way overkill anyway), to 62500Hz.
It’s not great, but it could have been worse
On the video side, fewer sacrifices were made, but the code is now incompatible with the VGA sync generator as I made a few changes to simplify the code somewhat. Turns out there were lots of savings to be made just by rearranging the way things like hsync/vsync worked.
I’ve also trimmed the number of available colours from 256 down to 64. (RRGGBB instead of RRRGGGBB). As well as allowing me to save a few gates, I believe this also allowed me to create a better palette with better neutral greys.
I’ve also added a raster interrupt register, that allows one to trigger an interrupt based on the y position currently being rastered out. This means that, in theory, it should be possible to set an interrupt at a particular line, and do things like swapping out the palette, or sprite pointers, or a bunch of other fun things (eg. if you want more than 8 sprites, or more than the standard 16 colours you should be able to swap to a new set every 16 lines if you can process the interrupts fast enough)… Actually, this should allow you to do things like have multiple non-scrolling windowed areas on the screen at one time too.
Although the demo below doesn’t look much different to last time, there’s been a surprising amount of work that’s gone into it
Now it’s time to start working on some C and assembly code again