User:GreenThePear/Sandbox

From Esolang
Jump to navigation Jump to search

rgbl is an esoteric graphical programming language, it is written by drawing a bitmap image which is self-modifying. The head of the program travels along the pixels and each the level of each pixel's color corresponds to a different logic component:

- Red: instruction signature

- Green: value (v)

- Blue: step direction

Outside the bitmap data itself, rgbl stores a single value in memory (m).

Instructions

An instruction can draw a value into a pixel (modify G) or save a value to memory (it "mems"). Every instruction except cross is followed by moving the head in the direction defined by B.

R Name Draws Mems
255 cross m m
0 - 63: General
0 draw m m
1 mem v v
2 swap m v
64 - 127: IO
64* stdout v m
65** stdin stdin stdin
128 - 191: Arithmetic
128 add v m+v
129 sub v m-v
130 mult v m*v
131 div v m//v
132 mod v m%v
192 - 254: Boolean
192 eq v m==v
193 lt v m<v
194 le v m<=v
195 gt v m>v
196 ge v m>=v

* stdout prints the corresponding ASCII character to v

** stdin reads a character from stdin and draws and mems it

In the table v is always the value before any drawing, so drawing v just means leaving the pixel unchanged. R outside of the defined instructions will just be looped through for the rest of the category, so for example one can call add with 128 but also 133, 138, 143, 148 and so on until 188.

Cross

Cross will only move the tape to the direction defined by B if m equals 0. If it equals 1, then the direction flips 180° degrees and continues in the following pattern for any m%8, here assuming that B directs up:

4 0 6
2 3
7 1 5