A 6-bit display

Some applications need complex, ever-flexible graphics. But some applications need graphics that are only controlled by a handful of bits. An old Game and Watch successfully entertained youngsters using a handful of bits. In a Game and Watch a few CPU control lines get updated to create the image.

This image was deleted by MailChimp when they shut down TinyLetter.
(Since some of my children read this, and hence have no idea what a "Game and Watch" was, here goes. They were an 80s series of single-game toys. You played it until you were sick of it, then you bought another. The LCD lit showed an incredibly realistic graphic rendition of a thrilling scenario, like driving down an obstacle-strewn road. A tiny microprocessor ran the gameplay. Update rates were quite slow, maybe two updates per second. Interestingly, this puts the bandwidth at around 20 bits per second, the best guess at the bandwidth of human perception. There was just enough information coming from a Game and Watch to take all your attention.)

There is some piece of code on the tiny game's CPU to "draw a log" -- but all it does is set one bit. All the graphics work is the job of the LCD designer.

Forty years on, this is the Dazzler's "boot menu". It's a screen that pops up and lets you boot from a different FPGA image. There's an eight-way selector down the left-hand-side and three indicators at the bottom right.

This image was deleted by MailChimp when they shut down TinyLetter.
However the code to run this display is very simple indeed. Six bits control all the elements, and the CPU just outputs a 6-bit code to activate different elements on the screen.

This image was deleted by MailChimp when they shut down TinyLetter.
That's the whole of the "API" to work the display. This is obviously much easier for the UI code to drive. Its job is just to toggling bits and write them to a BT815 register. So the microcontroller loop looks like:
 

send a static display list to the  BT815
forever {
  sense joystick
  update 6-bit display state
}

This is great for a small CPU. It doesn't need any knowledge of pixels, colors or drawing commands. It only needs to send a binary "blob" down as the display list, then light up parts of the screen by updating a single byte register.

The actual magic is done by the BT815's stencil feature. Stencil lets you make drawing conditional on an 8-bit stencil value. It's got a quite rich set of comparisons; you can mask of some bits of the stencil value, and compare them against a reference:
This image was deleted by MailChimp when they shut down TinyLetter.
The display list sets the whole screen to a fixed stencil byte at the start of drawing. Then every varying element is made conditional using a STENCIL_FUNC. For example first the microSD icon is drawn "unlit":

This image was deleted by MailChimp when they shut down TinyLetter.
Then the "lit" version is drawn using StencilFunc(EQUAL, 8, 8), because this element is controlled by stencil bit 3:
This image was deleted by MailChimp when they shut down TinyLetter.
That's all there is to it. It's a simple way of making the UI code very lightweight.

Thanks for reading.

This image was deleted by MailChimp when they shut down TinyLetter.
The Gameduino 3X Dazzler modules are all here, being programmed with their firmware today, and I am expecting the shield PCBs shortly. If UPS does their job, shipping will happen in a few days time. If you backed the campaign, now would be a good time to check your delivery address. Thanks!