esolang

BAM128

A 128 by 128 grid of 7-bit cells, where every number you write is a sum of powers of two.

Simone Russo, 2010 · Turing complete: no · ●●○ moderate · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: Hello World!

The idea

Simone Russo made BAM128 in 2010. Memory is a matrix of 128 rows and 128 columns. Two registers, P1 and P2, hold the row and the column of the current cell, and only one of them can change at a time. Every value wraps at 128, the registers and the cells alike.

Read the story

There are no constants but powers of two. *6*3 adds 64 and then 8 to the cell, which makes 72, an H. There is no subtraction either. To go back one row you add 127 and let it wrap.

The machine

CommandDoes
*dAdd 2 to the power d to the current cell, for a digit d
+dAdd 2 to the power d to the current register
/Switch to the other register; the row register comes first
!Swap the values of the two registers
>dAdd the current cell to the cell 2 to the power d places ahead
( ... )Loop while the current cell is not 0
n pPrint the cell as a number or as a character
iRead a character into the cell
.text.A comment

"Ahead" runs along the row and on into the next one. With 16,384 cells of 7 bits each the machine is finite.

Example

The >0 after the two l copies 108 into the next cell.

The >0 after the two l copies 108 into the next cell. At the end the program switches to the column register and walks right to print that l again.

The sum puts 64 in M(0,0) and 34 in M(0,1), adds 127 to the column to wrap back to M(0,0), and adds it to the cell one place ahead. 98 is a b.

Expected: b
Expected: b

The ASCII table, *5*0p(*0p), counts from 33 until the cell wraps to 0. Its body adds before it prints, so a NUL comes out after the 127.

Patterns it teaches

Further

Cell-based

Write your own in Run Convert a program from BAM128

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: bam128.

Command line

shib run bam128 -e '*5*0p(*0p)'
shib manual bam128

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/bam128.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org