Figure 6-2. Calculating numbers for pin patterns

With this numbering system, any combination of the eight pins adds up to a decimal number between 0 and 255, and no numbers are duplicated.

Now that you know the principles of Epson graphics, you’re ready for two simple exercises, more densities, and then something more complex as a basis for writing your own programs.

First Graphics Program

Your first graphics exercise could be a program that prints a single column of dots, but it is difficult to see the pattern in a single column of dots, so this program prints the same pattern 40 times.

The first line is the code for 40 columns of single-density graphics. As usual, the example is in BASIC, but you can adapt it to the programming language you prefer.

NEW

10 LPRINT CHR$(27)"K"CHR$(40)CHR$(0);

The second line is the data that is printed as pin patterns. Be sure that you type in the semicolons in both lines:

20 FOR X=1 TO 40: LPRINT CHR$(74);: NEXT X

That’s it. Run the program to see the result below. Although it is not as interesting as the examples at the beginning of this chapter, it does allow you to see exactly how the mode works.

6-5