AssemblerFuck

From Esolang
Jump to navigation Jump to search

AssemblerFuck is a language made by User:Sesshomariu and is a version of brainfuck that uses assembler-like words instead of symbols.

Specification and instructions

There are 5 instructions:

ADD <VALUE>               Adds a value to the current cell.
SUB <VALUE>               Subtracts a value from the current cell.
MOV <TARGET>, <OBJECT>    Moves the object to the target. This does only work with cells and not with values.
UNTIL 0                   Jumps to the matching END if the current byte is equal to 0. Else, it executes the code between UNTIL 0 and END.
END                       Jumps to the past matching UNTIL 0 if the current byte is equal to 0.

Valid targets and objects

Targets:

P         The pointer itself.
LEFT      The cell left of the pointer.
RIGHT     The cell right of the pointer.
OUT       The output.

Objects:

P         The pointer itself.
LEFT      The cell left of the pointer.
RIGHT     The cell right of the pointer.
IN        The input.

Examples

Hello World

 ADD 8
 UNTIL 0
   MOV RIGHT, P
   ADD 4
   UNTIL 0
     MOV RIGHT, P
     ADD 2
     MOV RIGHT, P
     ADD 3
     MOV RIGHT, P
     ADD 3
     MOV RIGHT, P
     ADD 1
     MOV LEFT, P
     MOV LEFT, P
     MOV LEFT, P
     MOV LEFT, P
     SUB 1
   END
   MOV RIGHT, P
   ADD 1
   MOV RIGHT, P
   ADD 1
   MOV RIGHT, P
   SUB 1
   MOV RIGHT, P
   MOV RIGHT, P
   ADD 1
   UNTIL 0
     MOV LEFT, P
   END
   MOV LEFT, P
   SUB 1
 END
 MOV RIGHT, P
 MOV RIGHT, P
 MOV OUT, P
 MOV RIGHT, P
 SUB 3
 MOV OUT, P
 ADD 7
 MOV OUT, P
 MOV OUT, P
 ADD 3
 MOV OUT, P
 MOV RIGHT, P
 MOV RIGHT, P
 MOV OUT, P
 MOV LEFT, P
 SUB 1
 MOV OUT, P
 MOV LEFT, P
 MOV OUT, P
 ADD 3
 MOV OUT, P
 SUB 6
 MOV OUT, P
 SUB 8
 MOV OUT, P
 MOV RIGHT, P
 MOV RIGHT, P
 ADD 1
 MOV OUT, P
 MOV RIGHT, P
 ADD 2
 MOV OUT, P

Cat Program

MOV P, IN
UNTIL 0
	MOV OUT, P
	MOV P, IN
END

Truth-machine

A truth-machine is implemented in the following:

MOV P, IN
MOV OUT, P
UNTIL 0
  SUB 2
  MOV RIGHT, P
  ADD 1
  UNTIL 0
    MOV RIGHT, P
    MOV RIGHT, P
  END
  MOV LEFT, P
  UNTIL 0
    MOV OUT, P
  END
  MOV LEFT, P
  MOV LEFT, P
END

See Also:

Interpreter

  • Common Lisp implementation of the AssemblerFuck programming language.