Sandbox Visualization Module Emulator The Zachtronics game TIS-100 contains a graphics display called the visualization module. I could try and explain the specs of this module, but the game's manual will do a better job:

(As you may have guessed, the motivation of this problem is to create a code golf challenge in which TIS-100 is the optimal language.)
Your job is to, in as few characters as possible, implement a program which will output the correct image for any valid input sequence. There are no requirements on what happens for an invalid input sequence. This can be a graphical window or console output. This includes strings of more than 1 command! If it has multiple -1s, multiple lines should be drawn.
Test Cases:
Input:

    3, 4, 4, 3, 2, 1, 0, 1, 2, 3, 4, -1

Output:



Input:

    1, 1, 4, 4, -1, 8, 8, 4, 4, -1

Output:



Input:

    5, 5, 4, -1, 5, 5, 0, -1

Output:



The simple TIS implementation is:
TIS-100, 64 55 Bytes
-9 thanks to feersum
@1
MOV UP ANY
@5
MOV UP ANY
@9
MOV UP ANY
@10
MOV ANY ANY

An additional byte is added as a single character in the filename is relevant.
Ruby, 114 bytes



-&gt;h,g=[0]*792{h.chunk{|x|x&lt;0&amp;&amp;p}.map{|z,(x,y,*r)|g[36*y+x,r.size]=r}
puts'P3 36 22 5',g.map{|i|i&gt;3?'5 0 0':[i]*3}}


This function takes its input as an array of ints, and writes the resulting image to STDOUT in the human readable version of PPM format. For those unfamiliar, the PPM image format is an uncompressed image format that's, essentially, a whitespace separated list of RGB values. 

About PPM

More particularly, it begins with a short header of the format P3 W H M, where P3 is a magic number, W is the width of the image, H is the height of the image, and M is an int from 1 to 65536 representing the maximum possible value a color channel can have. For instance, if M = 255, then the RGB triplet (255, 255, 255) represents white. If M = 10, then (10, 10, 10) is white.

After the header, each pixel is described, row by row, by providing an RGB triplet for its color, with each value separated by spaces. It has the neat property that you can use it to represent an image as human readable text. For instance, a 3x1 pixel image containing a red pixel, a green pixel, and a blue pixel would be:

3 1 255
255 0 0   0 255 0   0 0 255


The precise whitespace used doesn't matter, so the above image is equivalent to, among many others:

3 1 255
255 
 0    0          0       255        0  
        0     0       255


Explanation of Code

The reason all that was necessary was to explain why, when you run the program, you'll see output that looks like this:

P3 36 22 5
0
0
0
3
0 # And so on...


It's a PPM! And it's generated like this:

# Create an array g, full of 0s, of size (36*22) to hold the image
g = [0] * 792 
# Break the input array into chunks, splitting on values &lt; 0
h.chunk{|x|x &lt; 0 &amp;&amp; p} 
# Use each chunk to fill the subarray of g beginning at its x and y coordinates
 .map{|z,(x,y,*r)|g[36*y+x,r.size]=r} 
# Print the header ...
puts'P3 36 22 5',
# ... and the colors, replacing each color id with itself repeated 3 times
# (for the various shades of gray) or '5 0 0', in the case of red, and
# separating each item with a newline.
g.map{|i|i&gt;3?'5 0 0':[i]*3}


If you take this output and paste it into a text file, you'll be able to view it in any image viewer capable of opening PPMs.

Try it online!