1 Bit, a quarter byte

From Esolang
Jump to navigation Jump to search

1 Bit, a quarter byte is an assembly language for a 1-bit CPU, made by User:None1. With 1/4 byte of memory, this machine could store 2 instructions.

Commands

Command Name Meaning
0 END END. Print the entire memory as bits and end the program.
1 INT INverT. Invert the other bit.

The instruction pointer can wrap around, thus allowing more "complicated" programs.

Examples

All possible programs

00 -> 00
01 -> 01
10 -> 01
11 -> 10

Quine

00

Another one:

01

Interpreter in Python

print({"00":"00","01":"01","10":"01","11":"10"}[input()])

Interpreter in HTML

<h1>1 Bit, a quarter byte Interpreter</h1><p>Output: <text id="output"></text></p><input id="code"><button onclick="document.getElementById('output').innerHTML=run(document.getElementById('code').value)">Submit</button><script>function run(x){const program={'00':'00','01':'01',10:'01',11:10};if(x in program){return program[x];}else return("Syntax Error!");}</script>

See also