Double

From Esolang
Jump to navigation Jump to search
Double
Designed by Lim95
Appeared in 2022
Memory system Cell-based
Dimensions One-dimensional
Computational class Turing complete
Major implementations Original (Python), IDE (Created by Vivax)
File extension(s) .txt, .dbl
Double's logo
Double's logo

Double is an esolang created by Lim95 on July 5th, 2022. It was programmed over the course of two hours on a livestream. Double's main feature is that each instruction must be two characters long. All numbers are written in Hexadecimal and cannot go above 255 (or FF). Comments must be placed on their own line and are marked with a single forward slash (/)

Double Commands
Command Token What it does Version introduced Arguments
PV 0 Prints the value of the current cell. 1.0 None
PC 1 Prints the character of the current cell. 1.0 None
SX 2 Sets the X coordinate of the current cell. 1.0 Value
SY 3 Sets the Y coordinate of the current cell. 1.0 Value
IX 4 Increments the X coordinate of the current cell. 1.0 None
IY 5 Increments the Y coordinate of the current cell. 1.0 None
DX 6 Decrements the X coordinate of the current cell. 1.0 None
DY 7 Decrements the Y coordinate of the current cell. 1.0 None
SV 8 Sets the value of the current cell. 1.0 Value
IV 9 Increments the value of the current cell. 1.0 None
DV 10 Decrements the value of the current cell. 1.0 None
RS 11 Restarts the program (sets the pointer to 0) 1.0 None
CR 12 Restarts the program if the value provided is not equal to the value of the current cell. (BNE) 1.0 Condition
GC 13 Get the character ID of a character the user types in. If there's an error, return 255. 1.0 None
GV 14 Get the value of a hexadecimal number the user types in. 1.0 None
XV 15 Set the value of the current cell to the X coordinate. 1.0 None
YV 16 Set the value of the current cell to the Y coordinate. 1.0 None
JM 17 Jump to a specified location. 1.0 Address
CJ 18 Jump to a specified location if the first value is not equal to the value of the current cell. 1.0 Condition, Address
** 19 Replaces any value with the value of the current cell. 1.0 None
JF 20 Jumps forward the specified amount of instructions. 1.1 Address
JB 21 Jumps backward the specified amount of instructions. 1.1 Address
CF 22 Jumps forward if the condition is not the current cell's value. 1.1 Condition, Address
CB 23 Same as CF, but with backwards. 1.1 Address
GS 24 Get a string and store it across the Y axis. 1.2 None
JR 25 Jumps to a subroutine and pushes the pointer on to the stack. 1.3 Address
RR 26 Returns from a subroutine. 1.3 None
RC 27 Jumps to a subroutine conditionally. 1.3 Condition, Address
BC 28 Returns from a subroutine conditionally. 1.3 Condition
RN 29 Generates a random 8-bit integer (0 - 255) and stores it into the current cell. 1.4 (Changed 1.5) None
US 30 Updates the screen. 1.5 / DGR-3 None

Example Programs

Note: All programs are written for the JavaScript interpreter. Compatibility may vary based on the interpreter.

Hello, World!

."Hello, world!"

Hello Interpreter

GC CR #H ."Hello, World!"

Adder (created by vivax3794)

DV IX IV DX CR FF IX DV PV GV DX GV RS

Cat Program

GS PC IX CJ FF 01

99 Bottles of Beer

SV 03 SONG: PV SX 01 ."bottles of beer on the wall," SV 0A PC SX 00 PV SX 01 ."bottles of beer! Take one down, pass it around," SV 0A PC SX 00 DV PV SX 01 ."bottles of beer on the wall!" SV 0A PC SX 00 CJ 00 SONG SX 01 ."No more bottles of beer on the wall!"

Brainfuck interpreter (created by vivax3794)

IX SV FF IY GS IY SV FF SY 00 SX 00 IX CB FF 01 SV 00 IX SV FF DX IY CF FF 05 JM XX

CF 3E 12 SY 02 SX 00 IX CB FF 01 SV 00 IX SV FF JM 08 CF 3C 12 SY 02 SX 00 IX CB FF 01 SV 00 DX SV FF JM 08 CF 2B 0F SY 02 SX 00 IX CB FF 01 IY IV JM 08 CF 2D 0F SY 02 SX 00 IX CB FF 01 IY DV JM 08 CF 2C 0F SY 02 SX 00 IX CB FF 01 IY GC JM 08 CF 2E 0F SY 02 SX 00 IX CB FF 01 IY PC JM 08

CF 5B 3B SY 02 SX 00 IX CB FF 01 IY CJ 00 08 SY 00 SX 00 IX CB FF 01 SV 00 DX SV 01 IY DY DV IX IV DX CB 00 04 IX IY CF 5B 07 DY IV JB 0E CB 5D 11 DY DV CB 00 15 IX SV FF JM 08

CF 5D 3B SY 02 SX 00 IX CB FF 01 IY CF 00 05 JM 08 SY 00 SX 00 IX CB FF 01 SV 00 DX SV 01 IY DY DV DX IV IX CB 00 04 DX IY CF 5D 07 DY IV JB 0E CB 5B 11 DY DV CB 00 15 IX SV FF JM 08

Assembler

The Assembler is an external piece of software designed to make programming in Double slightly easier. You can use labels like in Assembly.

You can define a label with the following syntax: LABEL_NAME:

You can jump to a label with the following syntax: JM LABEL_NAME

Labels must be no spaces.

You can quickly define text with .". An example would be ."HELLO~WORLD". ~ replaces space.

By typing #(CHAR) you can get the hex ASCII code of a character.

Screen

In the 1.5 update of Double, a visual add-on was released. To use it, download DoubleVisual.py from the Double's GitHub page. It has a 4-bit palate, 64x64 resolution, and 10x pixel scaling.

A simple program to test it is:

IX XV CR 40 IY SX 00 YV CR 40 XV US RS