Brainfck

After introducing BASIC and Forth as interpreted languages on the Steckschwein, it’s time to add another unique and productive language—Brainf*ck.

For those unfamiliar, Brainf*ck (or Brainf**k) is an “esoteric” programming language created in 1993 by Urban Müller, the founder of Aminet. You can read more about it on Wikipedia.

A compact Brainfck interpreter can be found here, originally developed for the Apple ][. This version served as the foundation for the Steckschwein adaptation. The Apple ][ ROM calls were replaced with custom code, and the interpreter loop was optimized using 65C02-specific instructions, making it smaller and faster. Although performance gains in Brainf*ck aren’t critical, the improvements are noteworthy.

Additionally, there was an odd issue in the original code concerning the CMP instruction:

CMP ']'

This should have been:

CMP #']'

It’s likely a quirk of the assembler used to build the original version.

The Steckschwein interpreter has also been enhanced to allow Brainf*ck code input from both files and the keyboard.

The complete source code can be found in our GitHub repository.

Screenshot of Brainf*ck interpreter