Introduction
Last year I presented a simple hand-held platform game, based on uChip, a 16-PDIP-sized development board, featuring an ATSAMD21E18 (Cortex M0+).
Despite the good results (dual playfield, parallax scrolling, 16-bit colors, at 40 fps), I wanted an even more challenging project with uChip. About games, of course!
What about a VGA-based console?
VGA signal generation represents quite a heavy constraint, as it must be performed in software on an ATSAMD21E18, and precise timings are required. In fact, the ATSAMD21E's DMA is not connected to the port pins, therefore software bit banging is required. Furthermore, even if the DMA were connected to the port, I would still have to generate the graphics on-the-fly, because there is no enough RAM for a framebuffer.
Software bit-banging means that the CPU is busy in generating the signals for the majority of its time, leaving only few milliseconds per frame, for actual game logic and console I/O handling.
Actually, to show uChip's potentialities, last year I implemented a very rudimentary VGA-based Tetris console, but later I realized that I still got a good deal of margin, for fancier graphics.
Of course, due to memory, speed and I/O pin limitations we must forget about 16 bit graphics, so I will have to limit myself to only 256 on-screen colors. Still, check the differences between the old and the new version of tetris!
In a big surge of fantasy, I have named this simple uChip-based VGA console as "uChip Simple VGA console" or uSVC...
So, let's see some details of this 9-bit retro-gaming console!
A 9 bit console?
Gaming consoles were once classified by their number of bits. 8 vs 16 vs 32 (and later vs 64). The higher the number of bits, the more powerful they were (at least from the marketing viewpoint...).
As we will see later, this console, despite the 32-bit 48 MHz Cortex M0+ (much more powerful even than the Genesis 68k processor), cannot compete with any of the 16-bit consoles of the early '90s. This is because consoles had custom hardware that allowed not only to generate the video/audio signals, but also handled 2D graphics, and mostly important, they had hardware sprites. Everything here must be done in software.
Still, as we will see later that, in some cases, this console is more powerful than an 8-bit console of the '80s. In particular, we have a higher resolution, more on-screen colors and a bit of more memory and CPU "residual" speed (see later).
Therefore neither 8, nor 16 bits, just 9!
The specs
Here is an incomplete list of specs!
- CPU: ATSAMD21E18 @48MHz
- RAM: 32kB
- Flash: 256kB (232 for games due to bootloader + game loader)
- Games stored in SD and moved to Flash when you switch between games.
- Modular USB Host to support standard USB peripherals.
- Native support for standard USB Gamepads and keyboards.
- Up to 256 on-screen color (256 color palette, RGB 332 color space)
- Standard resolution of 320x200, at 57 Hz (30kHz horizontal frequency. These can be changed, but will leave less time for the CPU. All the VGA monitors and LCD TV sets I tested include 30kHz support). 400 vertical lines can be easily supported. Some effects already support 400 lines for better graphics.
- 8-bpp or 4-bpp Tile-based modes. 4bpp tile mode include a inline color changing engine, which support arbitrary color changing for each vertical scanline.
- 2-bpp bitmapped mode. The palette can be changed at every 8 horizontal pixels, allowing up to 256 simultaneous on-screen colors.
- Tile-based modes support sprites.
- More than 64 onscreen sprite (8x8 pixel size) in tile modes. Larger sprites are automatically handled, no need to create smaller sprites.
- Sprite 90-180-270° rotation and X-Y mirroring.
- Partially transparent sprites on 8-bpp, for explosions, lights, ghost, etc.
- Tile and sprite priorities....
Also: I wonder how much it would take to turn this into a more general-purpose computing box... more like what the Commodore Plus/4 was intended to be (and wasn't, because they dropped a barely-usable blooper instead of the decent office box they were aiming for), vs the C64...
I'd be interested in an exploration of that ;) something with a decent BASIC editor (say, comparable to what shipped with Windows 3.x), a lightweight word processor, and maybe a few other such utilities.