How the program works

This program begins by assigning a number of printer commands to BASIC string variables (lines 1000 to 1070). You can find most of these commands near the beginning of chapter 4.

The WIDTH “LPTl:” 255 statement in line 1090 means infinite line width. It prevents the IBM-PC from inserting unwanted carriage returns and line feeds in graphics data.

Actual printing begins in line 1100. Using the preassigned commands, the program prints samples of its different fonts, followed by samples of the print pitches, then some double and quadruple-sized printing.

Next comes the central attraction of the program: a line of text printed fourteen times in expanding and contracting loops to give a barrel effect. The work is done by four printer commands: a command setting the right margin (line 1370); a centering command (line 1390); a command to vary the line spacing (lines 1410 and 1460); and a command to micro-adjust the space between characters (lines 1420 and 1470).

Next the program returns to normal spacing and gives a demonstration of the printer’s word-processing abilities: italic printing, bold printing, underlin- ing, subscripts, etc.

The row of automobiles in the next printed line is created by downloading two new character patterns, which are printed in place of the character “<“ (character 60). Details can be found in Chapter 5.

The final part of the program uses dot graphics to print some “SW” logos with various densities. The dot pattern of the logo was originally laid out on graph paper, then converted to the data in lines 2370 to 2630 with the help of a calculator. Each number represents eight vertical dots. (See “Graphics commands” in Chapter 4 for details.)

The pattern is printed in four rows, each eight dots high and 65 dots wide. Lines 1800 to 1870 read the dot data into a string array variable named LOGO$. Line 1880 sets the line spacing to 8/72 inch so that the rows will connect vertically. The loop in lines 1890 to 1990 does the printing in four passes of the print head.

104

Page 112
Image 112
Star Micronics NX-1020 user manual How the program works