Two-instruction madness!

From Esolang
Jump to navigation Jump to search


Welcome to Two-instruction madness! Unlike what it name says, Two-instruction madness! has three instructions. (If you want the true Two-instruction madness! experience hop over to Two-instruction madness! (fr this time)) Note that I am going to claim that this as the esolang with the least instructions. You might say, Subleq only has 1 instruction! But, the subleq instruction has parameters. Also, you also might say, I/D machine! But the turing completeness proof DOES.NOT.MAKE.SENSE, because they need to subtract to refrence older values and because you can't subtract,you will eventually not be able to refrence older values. So I/D machine is not allowed, because it is not turing complete. All of the instructions in Two-instruction madness don't have parameters. So, what are the 3 instructions? e, a and j. e stands for "evaluate" and it has two modes; mode 0 and mode 1. So, before we talk about the instructions, we need to data pointer. Of course, the data pointer is simply a pointer in the memory. Now we can talk about the instructions! Back to the modes of e. Just kidding! The data pointer always moves in a direction specified by a value we will call the data direction. Now we can talk about the modes of e. Mode 0 will jump back two instructions in the code and flip it's mode. However, the e instruction will only execute 1 time, unless the e gets jumped back to from another e. Mode 1 is like mode 0, except instead of jumping back, you flip the direction of the data direction. The a instruction is much simpler, it simply stops the data pointer from moving and add's the data direction to the current cell. (right=1, left=-1) Also, to make this turing complete, there is j. It first checks if the value at the data pointer then if it's 0 then jumps back 3 instructions. It also activates the e like the edge case.


You might be wondering how to display and input, input is simpler: The first 256 bits of memory, where each bit corresponds to an ascii value. Now, display uses a clock, a character, and a colour. There is also a mode to switch between the two methods. Method 0: Ascii. When the clock changes, output the Ascii value of the character value. Method 1: Pixel. This method uses the clock and maps each value in left to right, then from top to bottom. The colour in RGB of the colour value is used to display the pixel. There is also a bit to enable and disable the input. It is the value at the start of the data pointer. When that byte is even, the input is disabled. When it's odd, input will be enabled.


This esolang is turing complete. Proof: My proof is going to be a reduction to brainfuck.

  • aeeee will add the direction of the pointer without changing the state. And by doing eeeae you can flip the "direction of addition" to say. Like + and -!*
*It will only work if it is >0, but you could probably name a solution 
  • And eaee will add the direction of the pointer to the value in the direction of the pointer afterwards. Like > and <!*
  • j...j nesting j's like this will effectively make the inverse of [ and ]! (It's pretty easy to convert between the inverse and the true) (also, the . is code you put inside)

So, Two-instruction madness! Is Turing complete!


Hello, world!

This is the Hello world program, but it isn't optimized. Also may not work.


Infinite loop



x86 interpreter (not complete):

.db ... ;code length

.db 00 00 00

.db ... ;code text in ASCII split by 3 extra bytes


lea eax, [rax]

lea ebx, $00000061

cmp eax, ebx

je a_handler

inc ebx

inc ebx

inc ebx

inc ebx

cmp eax, ebx

je e_handler

inc ebx

inc ebx

inc ebx

inc ebx

inc ebx

cmp eax, ebx

je j_handler

inc rax

cmp rbx $00000000

jmp first

jmp second


inc rcx

jmp end


dec rcx


jmp read_loop


cmp []