2 Bits, 1 Byte
Jump to navigation
Jump to search
2 Bits, 1 Byte is an assembly language for a 2-bit CPU, made by User:Gilbert189. With 1 byte of memory, this machine could store at least 2 instructions.
Operations
The following are instructions of 2 Bits, 1 Byte:
Code | Name | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | DON | DO Nothing. | ||||||||||
01 | ACT | ACTion. Given value in memory, change the value according to the following table:
| ||||||||||
10 | JMP | JuMP. Jump (unconditionally) to address specified. | ||||||||||
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
Since the memory is one byte, you can represent the entire program with just one character.
For example:
I
becomes:
01001001
which, when disassembled, becomes:
ACT 00b JMP 01b
Example codes
Endless loop
'
Disassembled:
DON JMP 01b END ; lol
Output 'm'
a
Disassembled:
ACT 10b DON ; becomes END
Quine
Any digit outputs itself. For example:
7
Each ASCII digit starts with 0011
in binary, so the first two instructions are DON END
.
Another Quine
?
Output "|"
~