BitChip

From Esolang
Jump to: navigation, search

BitChip is a two-dimensional programming language. A program consists of "chips", which are square-shaped, with an odd number of commands on each side. The instruction pointer enters and exits chips in the center of each side. As in Befunge, the instruction pointer consists of both a position and a direction (horizontal or vertical).

Commands:

/\ Bounce off
<>^v Move in that direction if value is odd number
{} Left/right shift bits in the accumulator (wrap around)
_ Flip end bit of the accumulator (or "bit0"; it's not clear just what this is)
! Skip one command
` Turns into ~ and instruction pointer goes clockwise
~ Turns into ` and instruction pointer goes counter-clockwise
@ Enter sub-routine
$ End sub-routine (perform a jump to the command two spaces ahead of the corresponding @)
# Memory storage: If hit, sets address
) Store accumulator in memory storage orthogonally adjacent to this one (if more than one, do to all)
( Set accumulator value in memory storage orthogonally adjacent to this one (if more than one, return XOR value of all)
| One value memory storage: Swaps accumulator with value stored in here
. NOP
, Set accumulator to zero
; Forget top entry of sub-routine stack
: Duplicate top entry of sub-routine stack
+ Sub-chip: Connects directly to + sign in chip 2 spaces in direction of moving. Example: Move north into + sign, you go to the + sign in the chip north of north of this one. If more than one + sign in destination, choose one with same adjacent stuff (both orthogonally and diagonally).
Anything else is a NOP.

Chips can connect to each other in any way. The size of the accumulator is unspecified, and the exact functions of _ and # are unknown.