A simple graphics program

This first program is just a simple example to show you how the graphics command, column reservation numbers, and data can be used in a BASIC program.

Type and run the following program. Be especially careful to include both semicolons. The program produces the printout you see below it.

18 WIDTH "LPT::", 255

2@ LPRINT CHR$(27)"*"CHR$(32)CHR$(+I)CHR$(@); 3@ FOR X=1 TO 12p

49 LPRINT CHR$(17@);50 NEXT X

Line 20 selects single-density 24-pin graphics mode (mode 32) and also reserves 40 columns for graphics. Since the 24-pin graphics mode requires three bytes of data for each column, line 30 begins a loop to supply 120 bytes of data. Line 40 contains the number 170, which produces the first pin pattern shown in the section on pin labels, and line 50 finishes the loop.

Using hand-calculated data to print graphics

With what you know now, you can use the simplest application of graphics-using hand-calculated data to print graphic images. While this method is tedious, it helps you understand dot graphics. Also, it is useful for small graphic elements that are used many times.

The following illustration shows how you can use a grid to plan where you want dots to be printed. This grid is for a single line of graphics 42 columns long. Since each line of 24-pin graphics is approximately l/8th of an inch high and since triple-density graphics prints 180 dots per inch horizontally, a design planned on this grid will be about l/8th of an inch high and less than l/4th of an inch wide.

4-18

Using Software and Graphics