Zed Rainbow

by Alex Gotsis

Answer:
SOLID YELLOW

We are presented with an audio file, a WAV file to be precise.

Noting the flavor mentioning a “colourful” 8-bit home computer, we research 8-bit computers, home computers, and cassette tapes. We can also notice the use of the British “Zed” in the title, and British spelling of “colourful”, and that “Rainbows” are also associated with colors. We can conclude that the computer in question is the ZX Spectrum - which has a history of distributing and copying software on standard audio cassette tapes. Additionally, there are a few noted examples of transmitting this software over mediums like radio by playing them aloud.

Doing some additional research on the ZX Spectrum and trying to find a way to “interpret” the sound, we get out our computer, an emulator. Some emulators will accept a wav file directly, but many more will want you to convert it. We search the internet and find a utility, for example tzxtools, and use it to converting the file to tzx or tap.

Alternatively, if we (perhaps not making the ZX Spectrum connection) instead try to reverse engineer the WAV file after looking at the shape of the waveform in software like Audacity, we can notice that it appears to be relatively simple. There appear to be 2 periods of square wave that are used at different times - that is 2 tones and that we can assign a 1 or a 0 to long and short rising and falling edge pair. Parsing the result of this process we find the program name to be ‘tzxtools’, a hint that this software package (or one like it) will be helpful. We make the same conversion as above.

Here is an example with txzwav, a component of tzxtools.

tzxwav zed-rainbow.wav -o zed-rainbow.tzx -v
 0:00.001        54 -    222541: Program: tzxtools   (7039 bytes)
 0:06.047    266694 -   1880265: 7039 bytes of data

We open the “tape” in the emulator, and after some loading we get a screen like this, with some of the circles animating.

What do I do with the red letters not in Keywords? What's basic but not run? 11 => (5 6)

The first sentence renders first, and we can interpret “Keywords” to be the keywords of ZX Spectrum Basic.

We complete this as a wordsearch, and do indeed find 11 red letters, matching what appears to be some kind of extraction line at the bottom of the screen.

The 11 letters are KDPKWZHWKXB but they are nonsense. It appears that we need to apply some kind of blue transformation to these letters, as hinted by the extraction line.

We recall that the second line of the instructions was drawn later and is in fact blue. From our research, we know that ZX Spectrum programs can be written in BASIC and interpreted, and the ZX Spectrum is known for being a great way to learn to program and experiment with BASIC.

In order to find out what is not run, we need to look at the source. We can do that with a utility, with manual decoding, or by listing the contents of the program in some emulators.

Here is an example with txzcat, a component of tzxtools.

$ tzxcat -B zed-rainbow.tzx > zed-rainbow.bas

We conclude that we need to determine which of the instructions aren’t actually executed, as hinted by the instructions onscreen and in the comment on line 120. We perform the tracing carefully, occasionally needing to look up the definitions of the routines for BASIC keywords, and then conclude that the lines not run are as follows. We consider a comment, REM, to be run when the control flow of the program runs over it. The DATA instructions have their data used.

170  CLSV
280  INPUT OI
400  GO TO 2030G
450  REM Half of the CIRCLEs are doneE
480  NEXT ON
520  REM Half of the DRAW are done, maybeE
2090 RUN 400R
2100 REM This is really confusingE
2580 COPYZ
2600 CLEARX
4242 REM "________ (8)"SPECTRUM

After creating this list, it looks like it ends in an 8 length blank. Based on the comment at line 130, “How did I type those in???” we consider how this program would have been written on a ZX Spectrum. They would have been written on the keyboard of the computer. It looks like this:

Using this mapping we extract a cluephrase, VIGENERE ZX ________ (8), and solve the blank to SPECTRUM. We decode the red letters KDPKWZHWKXB, with Vigenère cipher key SPECTRUM (blue arrow), and yield the cluephrase SOLID INK SIX, with enumeration (5 6). Since INK is a Spectrum BASIC keyword, and INK 6 is the color yellow, the answer is SOLID YELLOW.

Authors' Notes

This puzzle was heavily inspired by the episode of the podcast Radiolab, Mixtape: Cassetternet. I’d thought about a wide variety of games that I could implement, but programming a game in BASIC is much harder than using great libraries like the z88dk that compile down to Z80 assembly. An arbitrary amount of time could be put into the puzzle, but in the end I decided to keep it simpler given time and resources.

References

ZX Spectrum Manual
SAVE Routine (how the WAV file is encoded)
BASIC Encoding / Assembly
TAP Format
TZX Format
Emulators List (I recommend FUSE for UNIX/Mac and ZX Spectrum 4 .net for Windows)
Utilities List