# ReGIS

ReGIS, short for Remote Graphic Instruction Set, is a vector graphics markup language developed by Digital Equipment Corporation (DEC) for later models of their famous VT series of computer terminals. ReGIS supports rudimentary vector graphics consisting of lines, circular arcs, and similar shapes. Terminals supporting ReGIS generally allow graphics and text to be mixed on-screen, which makes the construction of graphs and charts relatively easy.

## History

ReGIS was first introduced on the VT125 in July 1981, followed shortly thereafter by the VK100 "GIGI" which combined the VT125 display system with composite video output and a BASIC interpreter. Later versions of the VT series included ReGIS, often with color support as well. This included the VT240 and 241 and the VT330 and 340. ReGIS is also supported by a small number of terminal emulator systems.
ReGIS replaced an earlier system known as waveform graphics that had been introduced on the VT55 and later used on the VT105. DEC normally provided backward compatibility with their terminals, but in this case, the waveform system was simply dropped when ReGIS was introduced.

## Description

ReGIS consists of five primary drawing commands and a selection of status and device control commands. ReGIS mode is entered by specifying the escape code sequence ESCP0p, and exited with ESC\. The sequence ESCP is the generic Device Control String (DCS) used in the VT series of terminals and is also used for a variety of other commands. The digit following the DCS is optional and specifies a mode, in this case, mode 0. Mode 0 is the default and picks up drawing where it left off, 1 resets the system to a blank slate, and 2 and 3 are the same as 0 and 1, but leave a single line of text at the bottom of the screen for entering commands.
All drawing is based on an active pen location. Any command that moves the pen leaves it there for the next operation, similar to the operation of a mechanical plotter. The coordinate system is 0 to 799 in the X axis, and 0 to 479 in Y, with 0,0 in the upper left. In early implementations such as the VK100 and VT125, the actual device resolution is 240 pixels, so the Y coordinates are "folded" so odd and even coordinates are the same location on the screen. Later models, starting with the VT240 and VT241, provide the full 480 pixel vertical resolution. The coordinate system can also be set by the user.
Coordinates can be pushed or pulled from a stack, and every command allows the stack to be used as a parameter, the B parameter pushes the current coordinates on the stack, and E pops it back off again. Coordinates can be specified in absolute or relative terms;
There are four main drawing commands and three control commands;
Each of these commands uses the various coordinate modes in different ways, and some have additional parameters that are enclosed in parentheses. Commands can be followed by one or more parameters, allowing continued drawing from a single command. The interpreter is not case sensitive.
Some ReGIS terminals support color, using a series of registers. These can be set with the S command using a variety of color input styles. s(m3(r100g0b0)) sets color register ("map") 3 to "r"ed using the RGB color system, while s(m3(h120l50s100)) does the same using the HLS system. The W command likewise sets a wide variety of different styles, mostly for masking, fills and brushes.
Finally, ReGIS allows commands to be stored into a macrograph and then recalled using the @ operator. Up to 10,000 characters of code can be stored in the macros, each named with a single letter. The advantage is that the series of operations in the macro can be invoked by sending only two characters over the serial port, as opposed to the entire sequence of commands.

## Sample

This code enters ReGIS mode and uses the S command to erase the screen with (E) and then turns on the visible cursor with (C1). P[100,440] moves the pen to 100,440 absolute. V(B),[+100,+0],[+0,-10],[-100,+0],(E) draws a series of lines, first pushing the current pen location onto the stack with (B), then drawing three lines using relative coordinates, and then using (E) to pop the previously saved location off the stack and draw to it. The result is a rectangle 100 by 10 pixels in size.
P[500,300],F(C[+100]) then moves to a new location, and uses the "F"ill command to wrap a "C"ircle. The fill command could wrap any number of commands within its parentheses, allowing it to fill complex shapes. It also allowed the inclusion of a "temporary write" that allowed the programmer to set the fill style within the fill, and abandon it as soon as it ended.