From Esolang
(Redirected from BCH)
Jump to navigation Jump to search

BitChanger is a version of Brainfuck that operates only on bits, and was created December 2, 2000 by Jeffry Johnston.

Conversion process

The conversion process from from Brainfuck to BitChanger follows:

Original instructions: + - > < . , [ ]

Combine "+" and "-" by restricting each memory location to a 1-bit value (0 and 1 only). A "+" or "-" is then really the same as an inverse. Call the new instruction "@":

Intermediate instruction set:   @ > < . , [ ]

Combine ">" with "@", and call it "}". Because the memory is restricted to 1-bit, the sequence "}<}" is the equivalent of a ">". The pointer moves forward and memory is inversed, then the pointer moves backward, then moves forward again and memory is inversed, but this second inverse operation changes the memory value back to the original, however the pointer is now one to the right from where it started off.

I/O was memory mapped, resulting with:

BitChanger instruction set:   < } [ ]

There was a second version of BitChanger, but it went a little overboard, trying to use memory mapping of "[" and "]" to result with only the two instructions "<" and "}". It was almost certainly not Turing-complete.

Gregor Richards determined the following way to do memory mapped I/O:

Cell  Description
----  -----------
5     set to 1 to perform input or output
6     set by input operation: 1=EOF, 0=otherwise
7     0=input, 1=output
8-15  I/O bits 
The pointer starts at cell 16.

External resources