BSM

BSM is an esoteric programming language created by David Catt (user:David.werecat) which executes instructions based on an 8-bit state machine with a single bit modifier.

Language Basics
The source code is read as a series of bits. The state machine starts at state 0x00. Each cycle, the instruction represented by the current state is executed (or NOP if the current state has no instruction) and the state machine moves to the next state given the current bit of code. The current bit is then moved to the next bit (or previous bit if the execution direction is reversed). When the last bit in the code is reached, execution moves back to the first bit of source code and the EndProgram instruction (instruction 0x17) is re-enabled if disabled. Execution may also be turned on and off: when execution is off the only instructions that are executed are the instructions that can turn execution back on.

There are three stacks, each which is a stack of 8-bit unsigned integers. All stacks begin with 1024 elements of value 0x00. If a stack is attempted to be read when it has no elements, a generic error is thrown by the interpreter.

The interpreter can accept multiple source code files as arguments, in which case the files are run separately and sequentially.

It should be noted that since the instruction is executed as the first part of each cycle, the first instruction executed is always 0x00.

Instruction Codes
Due to the 0x03 instruction (duplication), the memory size can be expanded by any amount.

Examples
Coming soon...

External resources

 * Visual Basic .NET interpreter and sample programs