..

Week of the 24/05/2021 - #21

Contents

tech

  • Kaitai Struct: A new way to develop parsers for binary structures.
  • Gameboy: serial connections and music resources

art

  • Richard Paul Lohse on the Apple II
  • Haddon Sundblom

Kaitai Struct: A new way to develop parsers for binary structures

This weekend I re-discovered Kaitai Struct which is a project I saw a long time ago but never needed to use it. Its a great way to deal with binary format files. Even though I love JSON as a format it is very inefficient when you need to store a lot of data. In those cases the best you can do is use a binary format. Even though there are binary versions of JSON which are more efficient (i.e. MessagePack) its still way to inefficient if you compare it to binary data.

Even though using binary data is more efficient it is much more complicated to read and process it. That’s where Kaitai comes in. It is basically a very simple way to describe the binary data format using a YML file and then the program will generate a file in the supported languages.

Here are links to some resources:

Kaitai WEB IDE screenshot

Gameboy: serial connections and music resources

Lately I’ve been thinking about hooking my Gameboy to my Apple IIc to use it for audio output for a demo. I would like to sync the audio with the computer so I’ve been looking at the serial port to communicate them. This weekend I did some research to see whats available to connect the Gameboy to the Apple IIc and how to have a player running on the Gameboy.

The Gameboy doesn’t support the RS-232 standard out of the box so I need to see how we can make them talk. One alternative is to use this circuit and code (I’ve cloned it in this gist just in case the link breaks since its pretty old) to implement RS-232 in the Gameboy. This uses a simple circuit based on the MAX-232 (se in this article for an Introduction to MAX232. If you don’t want to make the circuit there are adapters which basically implement the circuit described in the code (Adaptador Rs232 Max232 A Ttl Db9 Arduino Pic Ptec).

While investigating how the serial interface operates I found this very helpful article. In it you can see how the clock an sout/sin work to send/receive data. (see photo)

Clock and Sout signals while sending data

It occurred to me that it would be useful to be able to have an oscilloscope to look at the signals comming / going from the GB. I though it should be easy to use the ADC ping of a microcontroller to make a simple (low frequency) oscilloscope. I found a couple of interesting projects:

Arduino Oscilloscope circuit

  • Logic Analyzer - If you don’t need to work with TTL logic and at relative low frequencies (as is the case of serial communication) this might be a simler approach. In it the author uses an Arduino / STM32 or ESP8266 to create a simple logic analyzer that reads the digital inputs of 4 pins and sends them through the serial interface to a computer where they can be viewed.

Simple logic analyzer output screenshot

I also spent some time looking at ways to play music during the demo. One alternative is to simply use LSDJ and trigger tracks using the serial interface. For this I found this article which has a simple circuit that uses a 555 timer to create a clock signal (which you can vary the speed via potentiometers) and a switch to activate/deactivate the LSDJ. Perhaps this can be interfaced with the Apple IIc to start/stop the sequences. Another alternative is to create a circuit based off the Arduinoboy to talk via RS-232 or the serial with the GB.

Arduinoboy v1.1.0 circuit

Another way to create the music is to do it programatically. I researched a lot of audio/player resources for the Gameboy. This are the ones I find more promising:

  • hUGETracler - This is the repository for hUGETracker, the music editing suite for the Gameboy.
  • hUGEDriver - This is the repository for hUGEDriver, the music driver for the Game Boy which plays music created in hUGETracker.
  • XPMCK - XPMCK is a cross platform music (expressed in MML) compiler kit targeted towards various video game systems.
  • DevSound - “DevSound is a sound driver for the Game Boy which supports pulse width manipulation, arpeggios, and multiple waveforms. DevSound was designed with homebrew games in mind, so you can easily include it in your project.”
  • GBT PLAYER - Music player library and converter kit for Game Boy that can be used with RGBDS (and, with limitations, with GBDK).
  • OpenMPT - Tracker recommended to be used with GBT Player. “OpenMPT is a popular tracker software for Windows. OpenMPT (short hand for Open ModPlug Tracker) is completely free and allows you to create and play back some great music on your computer. Based on the original ModPlug Tracker written by Olivier Lapicque, OpenMPT is free software, can import a wide variety of module f ormats and offers an intuitive, native GUI as well as advanced features such as VST plugins and ASIO output.”
  • mGB - mGB is a Gameboy cartridge program (You need a Flash Cart and Transfer hardware) That enables the Gameboy to act as a full MIDI supported sound module. It works with the old DMG Gameboy as well as GBC/GBA.
  • Arduinoboy - Official ArduinoBoy Repository for serial MIDI communication to the Nintendo Gameboy.
  • GB303 - GB303 wavetable-based TB-303 style synthesizer for the Nintendo Gameboy.

Richard Paul Lohse on the Apple II

The Graphic Design History twitter account published this beautiful piece by Swiss painter Richard Paul Lohse:

Richard Paul Lohse Kunsthalle Bern Year: 1977

Tweet

I loved the image and thought maybe the colors were not too far off from the Apple II low-resolution palette. This inspired me to try and reproduce it on the Apple II with some simple low res graphics. Here are the results with different display settings on the emulator and with different bacgkground colors.

Apple II version 1 Apple II version 2 Apple II version 3

Tweet art

Horacio Altuna tweeted several very inspiring images by American artist Haddom Sundblom. His style is similar to another author I love: Robert E. McGinnis. Here are the ones I liked most:

Tweet

Haddom Sundblom 01

Tweet

Haddom Sundblom 02

Tweet

Haddom Sundblom 03

Tweet

Haddom Sundblom 01

And here is a Pinterest board with other images from him.