/brainm68k

Utilities for working with the original Amiga 1993 bfc release. In bf.

Primary LanguageBrainfuck

brainm68k

bf tests

In 1993 Urban Müller invented a Turing tarpit programming language for which he created a tiny 240 byte compiler for the Amiga.

This repo collects some basic utilities, written in bf, for working with the original bfc compiler and its compiled output.

  • m68kd.bf decompiler: Takes an AmigaOS 2.0 executable generated by Urban Müller's original 240 byte bf compiler bfc and decompiles it back into bf source.
  • gengen.bf generator: Takes a text (NULL terminated binary) or AmigaOS 2.0 executable file as input and outputs bf code to reproduce those bytes as output.
  • gen_bfc.bf bfc generator: Generated by gengen.bf. Outputs the bfc compiler AmigaOS executable. It compiles to 41,120 bytes using bfc, which is greater than its 32K CODSIZE limit and therefore overlaps the memory tape. The gengen.bf algorithm aligns it so the single utilised memory cell falls on an already NULL byte, which doesn't cause the program to crash despite the instruction pointer having to cross the tape and adjacent cells to read the full program.

Assumes 8-bit wrapping cells. Tested using Urban Müller's 240 byte bf compiler bfc running under vamos (virtual AmigaOS runtime) on Linux.

Testing

Another feature of this repo is its AmiNet and bf CI github workflow.

To test functionality, the workflow downloads bfc from AmiNet (it's still there!), and uses that in conjunction with the vamos Amiga emulator to compile and run bf code and check the results are as expected.

External resources