- Move instruction (
xxyy): Sets RAM(
yy. Whitespace is allowed after a move instruction.
- Pointer instruction (
*zz): Gets RAM(
zz). This is stackable and can be used as the input of a move instruction.
There are 256 bytes of RAM in TwoFiftyFive. In order to do computation, some indexes of RAM are memory mapped.
|FF||Instruction pointer. Incremented after every move instruction unless changed. (Only 256 instructions per program, wraps from 256-0)|
|FE||NAND Input A.|
|FD||NAND Input B.|
|FC||Hardwired to RAM(FE) NAND RAM(FD) (bitwise). Read only.|
|FB||Stack I/O (Pushes to stack on set, pops from stack on read)|
|FA||Program I/O (Outputs on set, inputs on read)|
|F9||Left shift (After every instruction, the value of the address gets shifted to the left 1 bit)|
|F8||Right shift (After every instruction, the value of the address gets shifted to the right 1 bit)|
In order to actually get anything done, TwoFiftyFive will probably need more memory. In order to achieve this, we can combine multiple programs into one, which can communicate using the stack. Here's an example that forever outputs the value 1:
<Generate>: //Header for a program called "Generate" FB01 <Output> FF00 //"<Output>" tells the interpreter to switch execution to program "Output". This is NOT an instruction, and can not be jumped to. <Output>: FA*FB <Generate> FF00
Each program in the above example has its own memory and instruction pointer. When a program is swapped to, it's instruction pointer will resume to the location it ended in the previous time executing the program (defaults to 0).
A program without any headers is just counted as a single program.
FA48 FA65 FA6C FA6C FA6F FA2C FA20 FA57 FA6F FA72 FA6C FA64 FA21 FF0D
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 (Hex) Hello, World! (UTF8)
probably possibly turing complete using the memory extension.