# BrainFuckConsole74 - Information

< Back to the console

### NEWS | IDEA | USAGE | COMMANDS | IMPLEMENTATION | IMPLEMENTATIONS/COMPILERS | HOW TO CODE? | CONTACT |

## Idea

2022-11-26 0.7491 New incode modes & code sonification
2022-11-25 0.749x Added compilers (pseudocode & processing)

## Idea

BrainFuckConsole is first a fantasy console. It is fully programmable with only 13 commmands (8 original in brainfuck and 2 specific for video (render) & sound (play note), 2 macros and one optional debug command.
Secondly, it is a brainfuck console, because it is the horror to code for this. It is even harder than coding for Atari 2600. The reason: you have to be really creative to do the simplest things.
Thirdly, it is a meta artgame. It asks: Is it possible to code a real game with such a reduced coding language? And how complex could this game be? BrainfuckConsole is a real brainfuck-dev-game: Try it out and create a game with the extremely minimalistic console.

## Fantasy History

The BrainFuckConsole was designed in the early 1970's. There was still a lot of punchard computing out there: first expensive mainframes (plato systems - the elearning system etc), analogue arcades, homebrew predecessors of the very first commercial computers. BrainFuckConsole74 was built by the millionaire Isabella Colgate interested in analogue and digital consoles and games. She wanted to empower people, so that they can create their own content but also their own software and their own games. And so, in her sparetime she developed the BrainFuckConsole. She took a very simple coding language of the future. The approach for BrainfuckConsole was to develop something similar and create the smallest arcade console ever - and of course it needed to be digital. And she succeeded. With only 13 commands you can create a videogame with sound and interaction. Even a mouse was implemented! All in all, 122 BrainFuckConsoles were produced, only 100 were distributed and sold. They were too expensive, the biggest problem was the cost for the memory. All consoles got lost. But some data and some content later was found on other computers. All this has been integrated in this online version of BrainFuckConsole74. You also find some newer software/content that was made in this emulator. We didn't include 'problematic pieces of code' like porn (known from Atari 2600) or fascist stuff. If you want to look into this, write an mail. It is only available for artists and researchers. An obvious future task will be to rebuild the original hardware that featured the console. At the moment we are doing experimental archeology: we work on creating new software with the old console.

## Console Design

The idea was to create a comprehensible and minimalistic computer/console, interactive and with screen as well as sound. So you can watch in the moment how the code is processed. The console should work performance independent (old console dont - solved with the ! render-to-screen-command) and yet not undermine the radicality of brainfuck (destruction of the values when copying, analyzing). In this respect we discarded the first prototype with separate videoram (copy without destroying the values would have been possible). Also the arbitrary setting of the videoram to a memory location, which allowed 'hardware' scrolling, was discarded. The second one might come in brainconsole 76 ;-)

## Origin

Brainfuck was developed in 1993 by Urban Müller from Switzerland after looking into the programming language FALSE in a compiler golf. [read more]

## Usage

Start code with [>]. StandardInput you can put in the textfield.
The print button stores puts the videomemory as brainfuck-code to the printer-device. You can import the picture again with the [Input]. This is very usefull if you work with the painting tool.
Output of the programm (Commands here: . ?)
Trash-Button: Delete output
Edit your code.
Sharing: You can share the code up to 1024b. The button generates a link down in the next frame. Included in the link is the code and the StdInput
You can also set the speed, a processing cursor (show where the parsing is) and you can sonificate the code .-)
Explenations and help about the commands.
Store and load icons: You can store the code in a cookie or load it. The cookie will stay a year active.
Collection of software and snipets.
If you coded something interesting, just send us the code and we will check it and hopefully add it to the collection.
What is there: BPaint - PaintingTool, BText - Simple TextTool, Some demoz
Missing: Music Tracker .-)

## Commands for the Console

BrainFuckConsole74 should be 100% compatible with brainfuck. So you can use + - < > [ ], .
The videogame / computer console has the following commands added:
Render: ! Renders the cells to the screen
Play note: # Plays a note
Read: ;: Read actual devices
Screen forward/backward: ( ) Goes 256 cells back or for
Optional:
Debug: ? Shows actual cell index (pointer) and value
Inofficial you can also control speed (BFC1-7), cursor (BFCC/BFCZ) or sonification (BFCS/BFCE) but only on brainfuckconsole74.

## Implementation

#### Cells

A cell can have the value from 0-2048

#### Visuals and rendering !

The first 256 cells can be rendered to the screen with the new command ! (render).
The colors are 0-16 and the rest are ASCII values.

|  | Pixel color
0 |  | transparent
1 |  | black
2 |  | white
3 |  | gray
4 |  | dimgrey
5 |  | blue
6 |  | lightskyblue
7 |  | firebrick
8 |  | red
9 |  | chocolate
10 |  | gold
11 |  | yellow
12 |  | yellowgreen
13 |  | green
14 |  | purple
15 |  | pink

There are rendering slots every 1/25 secs. If your code is executed under 1/25. ! waits for next slot. If you are over 1/25 than it will be rendered directly. This allows running the software on every maschine (speed) and it is more or less functional.

#### Play note # (actual cell value)

You can play the following notes

| Note
0 | C
1 | D
2 | E
3 | F |
4 | G
5 | A
6 | H
7 | c
8 | d
9 | e
10 | f |
11 | g
12 | a
13 | h

#### Read ; (actual cell value)

You can read several data from interfaces:

| Result
0 | KeyCode of the key down last. After reading will be set to 0.
1 | Action key down (Space)
2 | Cursor down mouse down
3 | Cursor up mouse down
4 | Cursor left mouse down
5 | Cursor right mouse down
6 | Mouse cell (index 0-256)
7 | Mouse button pressed
8 | Mouse button mouse down
9 | Random number (0|1)
10+ | Joystick 2 (WASDE) Mousedown than Joystick 1/2 Pressed

#### Fast Forward/backward ()

Go 256 back or forward. This is just a macro and helps using screens and offscreens.

#### Debug ?

Is an optional debug-command. It puts out on stdouput the actual cell index and value.

#### Optimizations

Optimized are the following codes:
Optimizings are only for this one string.
[-] set to zero<
[>[->+<]<-[->+<]>] go x cells forward and shit value before (init: [x][valueToShit]
[>[->+<]<-[->+<]{+}>] go x cells forward, shift value and generate a black (1) trace for going back (init: [x][valueToShit]
Optimizations seems only to be need for slower platforms like web.

## Implementation on brainfuckconsole74.org

BrainFuckConsole74 is here implemented as an interpreter in Javascript. There are two threads. One is a visual thread, firing 25/sec. If there is a render-command (!) in the pipline the screen will be rendered immediatly otherwise it waits for next regular moment.

## Other implementations/compilers

BrainfuckConsole74 embed a compiler for pseudocode and Processing > Exe-Icon
Processing compiler product in action.
The biggest problem was here: Java only executes max 65k code. And brainfuck of course needs a lot of code.
If you know others or coded one, send us the link and we add it here.

## Project

This is a project of and-or.ch, an art-group from switzerland. More about the project >

## Contact & social media

If you have some ideas, coded something or just wanna say hello
twitter: @bfconsole
#bfc

## How to code?

Common
Tools: A very helpful tool, to see what is really happening in the background: minond.xyz/brainfuck/
1. BrainFuck is a risc language - nearly no instructions and therefore a lot of code for stupid things.
2. BrainFuck has no store and read a variable. So you have always to destruct (-) a value to build it up again and do the same thing back again.
> Therefore you have often to use copying mechanicsm: {A}{B}{C} Dec in A, Inc in B,C and than copy back C to A. A horror.
Example:
a >[-]>[-]<< {clear}
b [->+>+<<] {copy}
c >>[-<<+>>]<< {copy back}
Copy now in B
Therefore if you have to test several things than make a copy like A to B,C,D,E,F and than use backwards E,D,C to calculate or test.
3. Destruction
Because everything is based on destruction. Really set in the beginning, where you store your positions etc. And than copy it from here to the free memory and make there everything you have to do and than go back.
4. There is no known way to do it without deconstruction.
5. Therefore do everything in the memory higher than your
6. Like this you can simulate something like a processor.
7. Use the ? statement to look, where the cursor is a the moment. Nobody is perfect. And in Brainfuck we are nobody.
8. With the dirty trick ((( you can back to the beginning of the memory and than start again. like this you could work from time to time like in a classic processor.
9. There are no good solutions in brainfuck.
10. Often it is simpler to start again than to search the bug.
11. Working in BrainfuckConsole74 you can often put a !!!!!! in the code to slow down the code and look whats happening.
12. The online tool helps very much, understanding what is happening.
13. After one month it gets better
14. And yeah the whole is real a brainfuck and it is addictive. But this makes it also interesting: How can i solve this? How normally coding ist working in difference and so on .... Regex is just a funny joke compared to brainfuck. And of course this is not really true.
Working with Screen/Video
At the moment there are two concepts to work with (what we found out):
- Directly work in the videomemory and only show with ! when data is ready
- Work offscreen (+256 cells)
- Your concept ....
Variable positions of objects (or included arrays and co)
One of the biggest problems is to work with variable positions of the player/enemies. One solution is to count down in offscreen, set the cell in the video memory and then go back to a known position and so on.
The painting tool is made with this concept.
Another solution is more brutal. Count forward to the position and than use (( to go back to first cell and than go forward to your memory.
Of course it is a brainfuck solution. but it is one. With brainfuck you have really to be creative.