BinaryBefunge

From Esolang
Jump to navigation Jump to search

BinaryBefunge is an esoteric programming language written by Dominicentek. It's a clone of Befunge. It's like Befunge, but all the characters are represented as binary.

Instructions

This esolang has all the instructions as Befunge-93. Each binary digit is an ASCII value of the Befunge-93 command. When any character found that is not 0 or 1 will make the interpreter quit automatically without execution.

Instruction Description
00101011 Pops 2 values and adds them, then pushes the result
00101101 Pops 2 values and subtracts them, then pushes the result
00101010 Pops 2 values and multiplies them, then pushes the result
00101111 Pops 2 values and divides them, then pushes the result
00100101 Pops 2 values and modules them, then pushes the result
00100001 Pops 1 value and checks if its a 0, if yes, a 1 is pushed. Otherwise a 0 is pushed
01100000 Pops 2 values and compares them, If 2nd value is greater than 1st, it pushes a 1, otherwise it pushes a 0
00111110 Makes the pointer move right
00111100 Makes the pointer move left
01011110 Makes the pointer move up
01110110 Makes the pointer move down
00111111 Makes the pointer move in random direction
01011111 If statement, a value is popped and checks if its a 0, if yes, the pointer moves right, otherwise it moves left
01111100 If statement, a value is popped and checks if its a 0, if yes, the pointer moves down, otherwise it moves up
00100010 Toggles string mode. Pushes any ASCII code onto the stack until the next 00100010 is reached
00111010 Duplicates the top value on the stack
01011100 Swaps the top 2 values on the stack
00100100 Pops the top value on the stack and discards it
00101110 Pops the top value of the stack and outputs it as an integer to the console.
00101100 Pops the top value of the stack and outputs it as an ASCII character to the console.
00100011 Skips the next instruction
01100111 Pops 2 values of the stack and uses it as Y and X coordinates. Then, pushes the ASCII code of the character on the playfield on these coordinates.
01100111 Pops 3 values of the stack and uses it as Y and X coordinates and an ASCII code. Then, puts the ASCII character onto the playfield on the X and Y coordinates.
00100110 Gets an integer from the user and pushes it onto the stack
01111110 Gets ASCII character from the user and pushes it onto the stack
01000000 Ends this program
00110000 to 00111001 Pushes a number onto the stack

Any value that is not a valid instruction is ignored. As in Befunge-93, the playfield is 80x25 characters. Each row must have 80 8-bit binary digits, terminated with a new line. There also must be 25 rows.

Examples

Interpreter