3 Bits, 1.5 Bytes
Jump to navigation
Jump to search
3 Bits, 1.5 Bytes is an assembly language for a 3-bit CPU, made by User:MihaiEso. With 1.5 bytes of memory, this machine could store at least 2 instructions.
Operations
The following are instructions of 3 Bits, 1.5 Bytes:
Code | Name | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
000 | NOT | do NOThing. | ||||||||||||||||||
001 | ACT | ACTion. Given value in memory, change the value according to the following table:
| ||||||||||||||||||
010 | JMP | JuMP. Jump (unconditionally) to address specified. | ||||||||||||||||||
011 | CJM | Conditional JuMp. Given two addresses, if the value in the first address is nonzero, jump to the second address. | ||||||||||||||||||
100 | OR | OR. ORs the given 2 values in memory. | ||||||||||||||||||
101 | XOR | XOR. eXclusive ORs the given 2 values in memory. | ||||||||||||||||||
110 | NAND | NAND. Not ANDs the given 2 values in memory. | ||||||||||||||||||
111 | END | END. Print the entire memory as character and end the program. |
The instruction pointer can wrap around, thus allowing more "complicated" programs.
Programs
The memory is 12 bits, so you can store with ~2 characters.
For example:
0�
becomes:
001100001011
which, when disassembled, becomes:
ACT 100b ACT 011b
Example codes
XOR 4 and 6 and print the result
ASCII:
³�
Binary:
101100110111
Disassembled:
XOR 100b,110b END
NAND 7 and 3 and print the result
ASCII:
�
Binary:
110111011111
Disassembled:
NAND 111b,011b END
Interpreters
TODO...