Experiments with POKE

Experiments with POKE

While noodling about with PICO-8, I thought I’d have a go at POKEing random and semi-random values into the screen memory. As you do.

A long time ago, I used to do this sort of thing with the Spectrum, writing very simple assembly routines (and compiling by hand!) that made fancy screen wipes and transferred images from memory to the screen and stuff. So fancy were they, that I lost the comp.sys.sinclair Crap Games Competition one year for being too clever.

In case you’re wondering, POKE is a command that lets you store a value directly into memory without using variables or pointers or other things. On the Spectrum, it was pretty much the quickest way of outputting pixels to the screen outside of actual machine code, and was also used for modifying code. In fact, POKEing became the way of cheating. POKE a bigger number into the Lives counter, or POKE zero into the part of RAM that holds “how much should I decrease energy by?”. Devices like the Romantic Robot Multiface existed mainly for the purpose of enabling this functionality with ease – press a button, POKE, done. You filthy, filthy cheat.

No cheating here though, just a load of sort of pleasing GIFs of the output I’ve been producing. There’s something ethereal about them, if you can get past the pointlessness and eyebleed they suggest.

There’s also the command PEEK, which lets you see the contents of a memory location – useful to check if something is there already.

For these silly experiments, I was POKEing values into the memory range 0x6000 to 0x7FFF – 8K of RAM that make up the PICO-8 screen. Each 8 bit value is two adjacent pixels, reversed. The left 4 bits are the pixel on the right, and the 4 bits on the right are the pixel on the left. It’s a little confusing, but if you saw how the Spectrum arranged its screen you’d cry.

This means each pixel can have a value from 0 to 15, or 0000 to 1111 in binary. 16 colours to match the 16 colours of the PICO-8 palette. All very interesting, but all I was going to do was bung random stuff in there.

And this is what I made:

poke

pokes-2 pokes-3 pokes-4 pokes-9 pokes-8 pokes-7 pokes-6 pokes-5

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.