TwoFiftyFive

From Esolang
Jump to: navigation, search

TwoFiftyFive is an esoteric programming language by User:HereToAnnoy with only two instructions and limited memory.

Syntax

Instructions

  • Move instruction (xxyy): Sets RAM(xx) to 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.

Memory mapping

There are 256 bytes of RAM in TwoFiftyFive. In order to do computation, some indexes of RAM are memory mapped.

RAM Index Mapping
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)

Memory Extension

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.

Examples

Hello, World!

FA48 FA65 FA6C FA6C FA6F FA2C FA20 FA57 FA6F FA72 FA6C FA64 FA21 FF0D

Output:

48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 (Hex)
Hello, World!                          (UTF8)

Computational class

TwoFiftyFive is probably possibly turing complete using the memory extension.

External resources

None.