Displaying QR codes on 8-bit hardware#

It’s often hard to interface the world of 8-bit computing with modern digital devices. These machines don’t have USB, Wifi, Ethernet, or anything resembling a modern interface.

It’s interesting to think about ways older machines can communicate with modern devices using only hardware of the era – even if it might be kind of convoluted. One of these methods might be via QR code.

What’s a QR code?#

A QR code is a two-dimensional pattern that encodes a short string of bytes or text – often a URL. These patterns can be printed on paper, or displayed on a screen. If you scan the pattern with your phone’s camera, it decodes the pattern, and displays the encoded text or URL.

How do you make QR codes?#

There are many ways, but we’re going to use the my-qr.art website to generate QR codes (the qrpicture.com site also looks interesting.)

This site has a couple of neat features. Firstly, it can make QR codes as small as 25x25 pixels, which is great for 8-bit systems.

It also masks redundant regions of the QR code, allowing you to paint your own stuff in the masked area – the details are explained in this blog post. For example, I painted “8bitworkshop.com” into this 37x37 QR code:

Then the site generated this QR code:

How do you put them on 8-bit machines?#

I used Dithertron to convert the QR code a 40x192 bitmap for the Atari 2600. I had to turn the Diffusion slider to 0 to avoid any dithering, and it was a little tricky to line up the crop rectangle. Then I just exported to 8bitworkshop, and the result looked like this:

The QR code just contains a shortened link to the my-qr.art website; the actual URL is stored on its server. Thus, you can encode pretty long URLs. I encoded the VCS ROM into an URL (using the “Share Playable Link” menu option) and created another QR code:

However, that QR code is different from the one displayed on the emulated VCS embedded within. I wonder if you could make them the same? This sounds almost like a hashquine, so let’s move on…

Can 8-bit machines generate QR codes on their own?#

There is at least one 8-bit QR code generator already developed; here it is running on the C-64 VICE emulator:

What could we do if the 8-bit machine could make its own codes? We could broadcast data to any device watching with a camera. We could also stream data in successive packets by animating the QR code.

How much data? Let’s see – a 101 x 101 QR code holds 406 bytes, and a CRT displays 60 frames per second, so in theory about 24 KB per second.

In reality, it would be hard to generate QR codes that quickly on an 8-bit machine. The C program I linked above takes about 30 seconds to generate a single tiny (21x21) QR code, which only can contain 19 bytes.

I quickly adapted the qrtiny library so it could compile with CC65, and it ran in under 2 seconds. I would bet an optimized version would be at least twice as fast. So I estimate the plausible bandwidth of QR code video on a 1 MHz 6502 is at least 19 bytes/sec. Not great!

If you want to see the demo, it’s available on GitHub targeted for the Apple ][ using lo-res graphics.

In any case, let’s add the QR code to the list of methods by which 1970s-era devices can one-way communicate with the modern era!