The program explained here is an overly simplified plotting program. It is not efficient in its use of memory, nor is it very fast. In fact, the BASIC language itself is not very suitable for graphics programs of a very large scale. BASIC is just not fast enough to handle the massive amounts of data required for graphics. But despite its drawbacks, this program contains all the elements required, and BASIC does provide an almost universally understood format for communicating them.
First, this program allocates a section of memory to contain the graphic image that will be created. In line 140 the DIM statement defines the integer array BUFFER%( ). You will use each element of this array to store one byte of graphics data. Each element of an integer array can actually hold two bytes of graphics data, but doing so would complicate the program. Therefore, we just have to accept the inefficiency.
The figure that this program prints fits in an area two inches square, and the BUFFER%( ) array uses about 32K of memory. You can see that there is a lot of graphics data involved (even considering the inefficiency).
Line 150 creates a vector array of the powers of two. These are the values that are assigned to the nozzles in the print head. They are used in creating the image in memory.
Line 160 sets the coordinate scale of the graphics image. Setting both scale factors to 20 creates a grid 20 units on a side. Line 170 calculates the relationship between the coordinate grid and the actual dots to be printed. This program uses the
Line 180 assigns mnemonic variables for use in the printing routine.
Lines
81