Glitchy CPU

Here’s a bit of fun – a virtual CPU that’s so bad that it’s memory keeps getting corrupted. What’s the point of that? Well.. it’s perfect for glitch art!

Image

So there’s a fictional computer that’s based around a fictional 8 bit CPU that has:
– 256 bytes of memory (used to store the program code and also doubles as registers)
– 29 different instructions (including drawing primitives like squares and circles)
– 2 addressing modes (immediate and indirect)
– 2 hardware (ie: not stored in main memory) registers (PC and SP)

The aim was to make a virtual computer that was amenable to glitching caused by purposefully corrupting its memory.

There’s a primitive, single pass assembler in there (well, more like a 1.5 pass as it resolves addresses after the first pass without needing to do a whole second pass) and I used that to write a few simple generative art programs. Once a program is loaded you get to see the “in memory” representation of it – that’s the actual bits of the compiled program code. From there you can manually toggle the memory bits and watch the results unfold.

Or there’s an auto-glitch mode where it randomly flips a number of bits every few frames:

Image

It’s written in Processing.js and the whole code is available to play with online at https://www.openprocessing.org/sketch/734979/

And while we’re on the subject of glitches.. I also wrote a Processing.js implementation of a class demoscene effect. It works by rendering a cube in horizontal slices, with each one set at a different time offset. The result is that the cube appears to warp. Take a look here:
https://www.openprocessing.org/sketch/734894/

This entry was posted in Computers, Demoscene, Development. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *