Close

First thoughts

A project log for Brainf*cktor

Standalone brainf*ck computer in less than 1kB of code

jaromir.sukubajaromir.sukuba 11/21/2016 at 21:170 Comments

This isn't my first "unusable computer" I ever built. My project section has a few of them, I can say along with device programmers it is my main development line. So, let's add another one.

Brainfuck (or Brainf*ck, or just BF) is wonderful programming language. It is hard to code, hard to read, but easy to execute in computer. In fact, it was one of reasons (the another one is personal amusement) it was born. It has 8 commands and all of them are single-characers. You can omit all formatting, so code can look like this:

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++
..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Awesome, isn't it?

On the other hand, having 256 Byte virtual machine isn't much of fun when running under 1GB of your OS. Let's design barebones system capable of running BF - built around microcontroller and spartan user interface, based on a few buttons and character LCD. Few hours after official rules of 1kB challenge I built this hardware:

Nothing but PIC18F26K22, two LEDs and few passives and connectors. The PIC has 64kB of FLASH, though 63kB is going to left unused.

Bottom side, rhapsody in purple.

16x4 alphanumeric LCD, nothing special.

And keyboard, consisting of 10 pieces of small PCB buttons and series resistors. There is a reason why series resistors, I'll explain in another log.

And when connected, it looks still a bit boring

Well, it's nothing but LCD and a few keys, the main part of development is going to happen in firmware. Stay tuned.

Discussions