# BEFLIX

BEFLIX is the name of the first embedded domain-specific language for computer animation, invented by Ken Knowlton at Bell Labs in 1963. The name derives from a combination of Bell Flicks. Ken Knowlton used BEFLIX to create animated films for educational and engineering purposes. He also collaborated with the artist Stan Vanderbeek at Bell Labs to create a series of computer-animated films called Poemfields between 1966 and 1969.
BEFLIX was developed on the IBM 7090 mainframe computer using a Stromberg-Carlson SC4020 microfilm recorder for output. The programming environment targeted by BEFLIX consisted of a FORTRAN II implementation with FORTRAN II Assembly Program (FAP) macros. The first version of BEFLIX was implemented through the FAP macro facility. A later version targeting FORTRAN IV resembled a more traditional subroutine library and lost some of the unique flavor to the language.
Pixels are produced by writing characters to the screen of the microfilm recorder with a defocused electron beam. The SC4020 used a charactron tube to expose microfilm. In BEFLIX, the electron beam is defocused to draw pixels as blurred character shapes. Characters are selected to create a range of grayscale values for pixels. The microfilm recorder is not connected directly to the 7090, but communicates through magnetic tape. BEFLIX writes the magnetic tape output on the 7090 and the film recorder reads the tape to create the film output. BEFLIX also supports a preview mode where selected frames of the output are written to the line printer.

## Programming Model

The memory of the 7090 is organized into rectangular surfaces of pixels. The surfaces are designated by a two-letter code that identifies a particular surface geometry. BEFLIX supports two resolutions for output frames: fine (252x184) and coarse (126x92). The 7090 has enough memory to support two fine resolution frames. The surface organization in BEFLIX allows for different geometric combinations of smaller surfaces within available memory. BEFLIX pixels store values 0-7, allowing them to be packed 12 to a 36-bit word of the 7090.
BEFLIX provides low-level operations and high-level operations. For low-level operations, BEFLIX provides 26 scanners named A through Z. A scanner has a value and a coordinate position on a surface. Low-level statements in BEFLIX apply operations to a scanner based on a set of conditions being met. An example low-level operation is:
IFANY (B,R,10)(B,A,C)(A,E,7)T(A,T,B)(A,U,2)(A,W,3)LOC5
Which says that if any of the following conditions are true:
* scanner B is to the right of x=10
* scanner B is above scanner C
* the surface value at scanner A is equal to 7
then the following operations are performed:
* scanner A moves to the surface and position as scanner B
* scanner A moves up 2 rows
* scanner A writes the number 3 into the surface
and then control is passed to the statement with the label LOC5.
In this way, complicated patterns can be programmed into the behavior of the scanners as the film output proceeds. All scanner operations are immediate operations and update the surfaces without any frame output in between operations.
High-level operations in BEFLIX fall roughly into four categories:
* control the output of pictures to the magnetic tape, storing and retrieving pictures on the disk drive
* rendering drawing primitives (line, arc, curve plot, and text)
* performing instantaneous operations on rectangular areas
* performing dynamic operations on rectangular areas
Drawing primitives and dynamic rectangle operations can be performed incrementally over a series of output frames as a quick way to encode animations.