From Esolang
Jump to navigation Jump to search

PixelCode is a esoteric programming language that was created by Vladimir Dabić (SealedKiller). It was inspired by Brainfuck and other esoteric programming languages.


PixelCode operates on an array of memory cells, 2 stacks, a buffer, and a 25x19 screen to draw on. There is a pointer which initially points to the first memory cell and to the top left corner of the screen at (0, 0). The first stack is used as arguments for certain instructions. The second stack is not. Both stacks are visually inverted, with stacked items arriving at the bottom, but act the same as expected.

There are two modes: Drawing and Memory. Drawing mode will move the screen pointer up, down, left, and right. Memory mode will move the memory pointer left and right. The initial mode is drawing mode.


Some instructions act differently depending on what mode you're in and if - is before it, like -~. Instructions modified by - act regardless of the current mode. NOP means that the instruction does nothing.

Instruction Drawing Mode Memory Mode - Modified
> Move screen pointer right Move memory pointer right NOP
< Move screen pointer left Move memory pointer left NOP
_ Move pointer down Set to 0 NOP
^ Move pointer up NOP NOP
$ Wait for screen click, then push clicked pixel's coordinates to stack 1 NOP Set to positive integer input
. Place pixel Add 1 Place pixel in buffer
, Delete pixel Subtract 1 NOP, if we can find where the ASCII is printed
[, ] Run code inside if cell is above 0 ??? ???
{, } Run code inside while cell is above 0 ??? ???
% Display buffer ??? ???
\ Push numerical input to stack (broken) ??? ???
~ Clear stack Clear screen
Toggle Indicator (IO Panel, Set a number in the current memory cell from 0 to 9 then use this) ??? ???
: Push to bottom of selected stack Toggle stack selection
# See below Clear buffer ???
; Pop from bottom of selected stack (unreliable for stack 2) Pop from top of selected stack
@ Use top 2 numbers of stack 1 as X and Y then move pointer to (X, Y) NOP
/ See below ??? ???
! Toggle mode NOP
* Halt program NOP


Pop 3 #s F, N1, N2, then set memory cell to output
F Values:      True = 1
1 - N1 == N2   False = 0
2 - N1 != N2
3 - N1 > N2
4 - N1 < N2


Use top 3 #s F, N1, N2, then set memory cell to output
F Values: 1 => N1 + N2
          2 => N1 - N2
          3 => N1 * N2
          4 => N1 / N2
          5 => RNG from N1 to N2, inclusive

Example Programs

Draws a smiley face on the screen. It is recommended to start analyzing this example first.
A very simple "drawing" program.
You click on the screen and it places a dot.
Draws a smiley face using the screen buffer.
Draws 2 dots and, depending on which one you click, it will draw a dot in a specific place.
The same program as above, but clicking the S button in the IO panel clears the screen.
 A program that uses the inputs and the indicators to draw on the screen!
Press 1 = Move Pointer to X, Y (It asks you for two numbers)
Press 2 = Place Pixel
Press 3 = Clear Screen
Press 4 = End


PixelCode Interpreter