2 Bits and Bytes

From Esolang
Jump to navigation Jump to search

2 Bits and Bytes (or 2 Bits, N Bytes) is the successor of 2 Bits, 1 Byte, an assembly language for a 2-bit CPU, made by User:Gilbert189. Unlike 2 Bits, 1 Byte, this language allows the memory size to be infinite by making all absolute operations relative.

It's still very useless though.

Operations

The following are instructions of 2 Bits and Bytes:

Code Name Description
00 DON DO Nothing.
01 ACT ACTion. Given the memory at a given offset relative to the argument, change the value according to the following table:
From To
00 11
01 10
10 00
11 01
10 JMP JuMP. Jump (unconditionally) forward by the specified argument, relative to the next instruction.
11 END END. Print the entire memory as character and end the program.

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

Programs

Programs can be represented by a string of characters (like most languages here).

For example:

Hi

becomes:

01001000 01101001

which, when disassembled, becomes:

ACT +00b
JMP +00b
ACT +10b
JMP +01b

Examples

Hello, world

This is found by computer search (since I don't feel like programming in this language).

jgîlo, world

(This will not work correctly when encoded in UTF-8!)

Interpreters