Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 10, NO. 5 / MAY 1984 / PAGE 198

Notebook-portable computing. Luft Pfeiff.

Notebook/Portable Computing

Wouldn't it be nice if the Text word-processing program in the Model 100 and 8201A had provided more of the goodies we have come to love in the more advanced word processors running on our bigger computers? Italics, emphasized print, double-width print, underlining and the like have become second nature to many of us. We are also used to setting header or footer lines to be printed on each page along with automatically incremented page numbers. We have been typing in commands that adjust page length, column width, and many other parameters. About all Text provides are the editing functions of insert, delete, cut, copy, and paste. At the main menu we have a LIST or PRINT function that asks first what column width we want and then dumps our purple prose to the printer, otherwise unformatted.

Fancy word processors with all their control functions use a combination of operating system, print firmware, and internal subroutines to perform their mighty tricks. You may have had to perform some configuration procedures to teach your "big' computer word processor about the special features of your operating system and the printer you use. You can also do this on the 8201 and Model 100, but you must embed the printer control characters within your text files.

The procedure described here illustrates how to send control characters from an 8201 or Model 100 to an Epson MX-100 with Graftrax Plus. Now don't despair if that is not the system you have. Other printers work similarly, but you will have to look up the control codes. If you have a different printer, you shouldn't find it too difficult to translate these procedures into ones that will do the same thing for you.

These procedures will work with the built-in 8201 or Model 100 Print routine as well as with some of the third-party text editing programs. Some of these programs trap the escape codes, so you will have to experiment a bit. These embedded codes work especially well with David Ahl's FORMAT program (distributed by NEC).

If you have your printer manula handy, this would be a good time to open it to the table of Control Codes. Appendix B in my Epson manual has two full pages of these. I will limit my discussion to the codes obviously useful in our more and less serious writing efforts.

Italics

Let's start with italics as an example. In contrast to the standard ASCII set of character and other codes from 0 to 127, the upper half of the range to 255 has codes assigned at the whim of system designers and usually includes many nonstandard characters. Epson has chosen to use ASCII 160 and up to print symbole and alphanumeric italic characters. We need to tell the printer somehow that we want italics even though we have typed the keys that usually result in non-italic printing. The way to do this is to throw a toggle switch that says "everything until further notice will be printed italic.' There is a DIP switch that does this right inside the machine, but we want to use a software switch as it is easier to get at. This switch is given in the Control Code listing as shown in Figure 1.

This tells us that, in the course of getting characters from our computer to print, the printer receives an ESCape message which it is not to print but which tells it to look for the symbol of something to "ESCape to' indicated right after it. In this case, the symbol 4 has the significance "turn the italics switch on.' The decinal and hexadecimal numbers given are the ASCII codes for the character 4. You might use these code numbers in Basic or other language programming but we are going to use the "4' neat.

There, I just did. To make "neat' print as "neat' I typed two control codes in my text, one to turn the italic switch on and another to turn it off, in particular:

ESC4neatESC5

(ESC takes up one character in a text file, but it does not print on the screen.)

You must have guessed by now that ESC5 is the off switch for italics in the gospel according to Epson. Well then, how do I go about telling my MX-100 "ESCape by route 4'?

It turns out that there are two ESCapes recognized by the Epson--one is ACII 27, and the other is ASCII 155. The NEC and Model 100 know about the first one and think that its ECSape messages are for them. As a result, you can't use the key marked ESC. However, code 155 also means ESCape, and it is not intercepted by the computer.

ASCII 155 can be keyed in on the NEC by pressing and holding the GRPH key down and then pressing

the   (backlash) key (GRPH-K on the Model 100).  On the Model 100, this shows on the screen as a

left arrow character; the NEC shows a space on the screen (not handy). It takes some sleuthing to uncover such facts and, of course, to do that you need to know that there is something there worth looking for. There is no telling what may show up on your dispaly when you do this. It may be nothing, a Japanese Katakana character, or a graphic symbol left over from the last game you were playing, depending upon what programs you have been running. If you have an 8201, you should determine which codes you will be using and, with the CHRDEF program, but appropriate symbols in the ASCII character table. I used two carets (up and down) to indicate ESC. By the way, if you have not received NEC's update to CHRDEF.BA, you should ask them for it.

Subscripts

Take a look at Figure 2, which shows the various ESCape inputs and their results. They are all achieved in the same way as the italics. Not everything in the table in the manual can be done. Some of the codes simply do not respond; others go only halfway. The latter are ostly those that expect an additional signal such as a 0 or 1 following a letter. ESCS-S is one. ESC-S-O should place the printer in the superscript mode and ESC-S-1 should put it in the subscript mode. As it turns out, both evoke subscript because neither the 0 nor the 1 takes effect. ESC-S alone productes subscript. One character after the S is read, however--so unless you put the number in or leave a space, the first character of your subscript will be gobbled up. A similar thing happens with other codes that use a number to select or toggle a condition. In addition, those codes that require additional numbers as parameters will not respond as you would like.

Underlining

An example is the combination ESC-1 /ESC-0 for underline on/off. (In all my examples I use 1 where Epson specifies > 0.) Either of these codes plus just ESC turns the underline on, but then the problem is to turn it off. There is no good way, but there is a way. That is to reset all the printer defaults by sending ESC-@.

The problem with using this sequence to turn off the underling is that ESC-@ cancels all input before it in a given line. That means that you can't underline a single word or a few words in the middle of a line. However, an entire line is easily underlined as are words that fall at the end of a line. The underline mode is turned off by entering ESC-@ just after a carriage return at the end of the underlined material.

ESC-@ is a valuable code. It is equivalent to turning the printer power switch off and on to set the default conditions as selected by the DIP switches. And, just as your big league word processing program probably "initializes' the printer, if you follow ESC-@ with other codes such as ESC-E for emphasized print, ESC-4 for italics, ESC-9 to enable the paper-out sensor and ESC-U for unidirectional printing, you can do a great deal of initialization from within Text.

Other Codes

If it sounds as though there are many things you can't do, just browse through Figure 2. You will see, in the latter half of the table some controls that do not use ESC.

  These controls are labeled "GRPH-something' just as GRPH-  was for ESC, but they call other

functions directly. ASCII codes 128, 135-143, 146, and 148 are in the same class as 155, which we used for ESC. In general they duplicate the 0-31 ASCII control code subset at those codes plus 128 (ASCII 27 + ESC + ASCII 27 + 128 = 155). These codes have special uses in the Epson schme of things as indicated in Figure 3.

Starting the Document

As a wrap-up let's take a look at how all these goodies are used with a LIST or PRINT to fomat the output and control the printer. I must indicate first, however, that I certainly don't see these procedures as substituting completely for a full featured word processor.

The procedure, using control codes, is as follows. The text is typed using ESC and GRPH codes as necessary. When it comes time to print, there must be some codes up front such as ESC-E for emphasized print. Also up front is ESC-9 to enable the paper-out sensor of the printer. That control will be used several times, but the first time is to eliminate the filename of this text.

On the NEC, LIST prints a filename no matter what I do, so I let it print on a piece of scrap paper or a 3 X 5 card. With no paper loaded into the printer and ESC-9 as the first after-filename output to the printer the filename prints, and the printer waits for paper to be loaded. I will be printing on cut sheets of paper, but I want to print closer to the bottom of the paper than the sensor will allow. Early on I even give some thought to relocating the sensor, but it is easier to disable it again with ESC-8 at the beginning of a page and then insert ESC-9 at the spot I want to force a page-break. Most of the things I print this way are only a couple pages long.

This page-break paper-out sensor business can be avoided if continuous or fan-fold paper is used in conjunction with a Form Feed to force the page breaks at selected places or to allow the skip-over-perforation feature to do it for you. The latter will not provide for footers and headers as I will describe shortly.

First the matter of margins: My printer allows me to position any type of paper enough to the left of the left-most print head position to provide all the left margin I could want. The right margin is then controlled by the column width selected when LIST is invoked.

Line spacing is another consideration. My solution was to do some minor surgery on the printer. I now have windows and access holes in the top of my Epson case that allow me to reset the DIP switches at will. For continuous double-spacing, I just turn on SW2-3 for an additional linefeed with carriage return.

A couple more notes to NEC owners before we go: NEC has also neglected to let us in on the secret that GRPH-SHIFT-key will input ASCII 160-191 in the same key order as with GRPH. Above that, it is CHRS all the way. You may find that these will be useful with your printer, or you may want to use them for screen graphics. If you have the capability of defining printer characters, you can have a ball with all of this.

Note also that you may have an Epson manual control code table with incorrect decimal codes for ESC codes Q through W and incorrect hexadecimal numbers for the high end controls VT through SI.

If you figure out how to make more of these codes do more things, let us know so we can pass them along in this column.

Table: Figure 1.

Photo: Figure 2. Epson MX-100 Graftrax Plus Control Codes.

Photo: Figure 3. NEC 8201 GRPH Interface with Epson MX-100 Graftrax Plus Printer.