Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 6 / JUNE 1983 / PAGE 210

Mr. Epson, meet Mr. Pascal. Carlton P. Russell Jr..

Mr. Epson, Meet Mr. Pascal

The first topic for discussion between Mr. Pascal and Mr. Epson is the Pascal technique for routing the output to the printer. One way is illustrated in the program listing of PrintTest shown in Listing 1. This illustration is not intended to be an example of good programming practice, but is intended rather to be an "unretouched' record of an original Pascal program that prints examples of the various Epson operating modes.

This program was developed and executed on an Apple II+ (64K) with a language card, Videx Videoterm 80-column board, and Paymar chip. Apple UCSD Pascal 1.1 was the programming language. The printer is an Epson MX-80 F/T.

The technique used here is to declare a variable called OUTFILE to be of type TEXT and then associate that variable with the system file named PRINTER This is shown in the REWRITE statement at the beginning of the procedure FIRST. The WRITELN statements which are intended for the printer must have OUTFILE as the first parameter. Output statements intended for the screen do not use a special parameter in the WRITELN statement. The output statement at the end of the main program (near the end of the listing) illustrates this operation.

The program was written by first attempting an operating mode and then switching that mode off to be sure that the printer would come back to the normal mode each time. The program structure was intended to be a simple linear list of output statements; however, the size limitations of procedures caused the primary procedure to be broken into two procedures FIRST and REST.

Since OUTFILE was declared in the main program, it is a global variable which can be used in any of the procedures. The function CHR is used within the WRITELN statements to convert the integer codes to the ASCII form needed for transmission to the printer. A similar process involving the CHR$ function is used in the Epson manuals for illustrating the use of the printer command codes in the basic language.

The printed output resulting from the execution of this program is shown in Figure 1. The title is produced using the double width, double strike, enhanced combination. This combination is then explicitly turned off. Note in the listing that the title has six double width spaces before the title words to center the title.

A printout using the normal default operating mode is produced following each of the experiments. The regular double width technique is tried next. Then the normal size, enhanced print example is shown. Examples of the various sizes and print techniques are shown along with the codes which turn them on and off. While this demonstration output provides the codes necessary for using the various options of the Epson, it does seem to suffer from a lack of organization.

The second topic for Mr. Epson to share with Mr. Pascal, Mrs. Basic, and Miss Executive Secretary concerns a way to organize and keep track of the various printer control codes. While generating the program listing and the demonstration output from the PrintTest, a way to organize the operating modes into a table based on the character sizes and the printing techniques was developed. The results are shown in Figure 2.

The left side of the table shown in Figure 2 lists the four character sizes starting with the small compressed characters which allow 132 characters in an 8 line.

The normal size characters which are printed 80 per line are listed next. The third row lists the oversize characters which are printed 66 to the line. The last row lists the large double width characters which are printed 40 characters per 8 line.

The column headings across the top of the page show the four printing techniques starting with the normal single strike mode and generally increasing in print density (boldness) as one moves to the right in the table. The second column lists the double strike (two-pass) mode.

The third column lists the enhanced mode in which the printhead is moved slightly and the character is printed again as the printhead moves across the page. The last column lists the technique in which the enhanced mode is used twice (double strike) to produce an unusually bold image.

Note that four sizes time four styles sounds a great deal like 16 modes; however, literature says that the Epson has 12 variations. Sure enough, the manuals are clear that the compressed size options and the enhanced print style are not to be used together. The four sections in the table which are marked with dashes are the four modes which involve these excluded combinations. The normal size, single strike combination is marked DEFAULT to show that this is what you get if you do not turn on the other modes.

Most of the sections of the table have an IN and an OUT identification. The IN notation means that the codes shown are used to get into the mode identified by that row and column. The OUT notation means that the codes shown are used to get out of the special mode and back to the normal default mode.

Note that the double width row at the bottom is a special exception in which reaching the end of a line (EOF) turns off the double width part of all four of the double width options but may leave on any density modes. Some direct transitions from one special mode to another without going through "normal' have been successful; however, all 132 transitions have not been demonstrated here.

The numbers in the sections of the table are the ASCII codes representing the characters which are used to control the Epson printer. For example, 27 is the code for escape and 69 is the code for the letter E. The sequence of an escape followed by an E turns on the enhanced mode for normal size characters (second row, next to righthand column of Figure 2).

An example of the use of the codes in the table is shown in Listing 2. Suppose you wanted to initialize the printer for the normal size, enhanced, double strike mode prior to running a Pascal program. You decided not to modify the program itself. One way to do this is shown in the program ENHANDUB in Listing 2. This program executes to send the four codes, 27, 71, 27, and 69, to the printer and initialize it for later printing. As long as the power is applied to the printer and other control codes are not transmitted, it will print in the normal size, enhanced, double strike mode.

Note that the table shown in Figure 2 is a useful reference for Applesoft Basic and perhaps other Basics using the CHR$ function as well as for Pascal using the CHR function. The Executive Secretary word processing system (Sof/Sys. Inc., 4306 Upton Ave. S., Minneapolis, MN 55410) provides for a straightforward way to use these same codes to control the printer from within the text of a document.

All 12 of the modes in Figure 2 are demonstrated in the PrintTest listing and the sample output is shown in Listing 1 and Figure 1. After each mode is turned on, the codes which return the operations to normal are also exercised.

Mr. Epson and Mr. Pascal have met and they have talked in a variety of pleasing ways. They are expected to be cooperative coworkers for a long time to come.

Table: Figure 1. The output from the PrintTest program shows the codes and illustrates the various size and printing modes of the Epson MX-80 printer.

Table: Figure 2. The tabulation of Epson printer control codes provides an orderly organization for the codes by size and print style.

Table: Listing 1. The listing of the Pascal program PrintTest shows techniques for controlling and routing output to the Epson printer.

Table: Listing 2. The program ENHANDUB executes to initialize the Epson printer for normal size, enhanced, double strike printing.