REGULAR FEATURE
Step 1
TEST DRIVE
Taking your printer out for a spin!
by Maurice Molyneaux
If you use a word processor, at one time or another you've probably experienced the frustration of trying to print something and not having it come out right. Let's say you tried to print bold, italic type and, instead, got Near Letter Quality (NLQ) out of your dot-matrix printer. You can blame the printer, you can blame the word processor, you can blame both—or you can blame the most likely source of the problem: the printer driver.
A "driver" is a special file which tells your word processor how to communicate with a printer. If you don't have a driver—or have the wrong one—you can end up with odd results when printing time rolls around. In this month's Step 1, I'll attempt to show you the basics of creating or customizing a printer driver.
Table of Babel.
You might wonder why all this fuss is necessary. After all, your computer knows how to get your printer to spew out regular text with no problem. Why should there be difficulty with text effects, layout and special characters?
Your ST and printer both understand regular text; the letters of the English alphabet and the most common punctuation symbols are represented by the same values on both. This is because both use ASCII (American Symbolic Code for Information Interchange) to define characters. With ASCII, the letters of the alphabet and most punctuation symbols are always represented by the same values, in computers ranging from Apples to Ataris, and printers from Epsons to Brothers. By standardizing values for such characters, ASCII permits various devices to share information. Unfortunately, the symbols beyond the normal alphabet (including punctuation marks) are not as standardized, so two printers using ASCII might well have completely different values for foreign-language and other unusual characters, if they feature special characters at all. This can present problems. For example, the ST's ASCII character set includes a copyright character, an infinity symbol, and the Hebrew alphabet! Chances are, your printer won't normally interpret these to be the same things the ST does.
Due to these ASCII inconsistencies, it's often necessary to fiddle with a printer driver, in order to get special characters to print... if your printer is capable of producing them.
To make a bad situation worse, there's really no standard for enabling certain effects with printers. The code for enabling boldface is almost surely different in a Star printer than it would be in a Panasonic. And, again, since various printers have differing abilities, some functions of your word processor just may not work. For example, a Star SG-10 can be toggled to print zeros slashed, while a Star Gemini 10X doesn't have a mode to do this. . . and they're both from the same company!
The specific examples I'm going to give refer to configuring drivers for 1st Word and ST Writer only, but most of what I cover here can be applied to almost any word processor's printer configuration. Before we begin, you'll need a few items: your printer's manual, your ST's ST BASIC Source-book (trust me), some blank paper, and the word processor of your choice (if you're using 1st Word and have the manual for it, dig that out and flip to Chapter 5).
HEXing decimals.
To configure both the 1st Word and ST Writer drivers, you'll have to understand a bit about the difference between decimal and hexadecimal math. Decimal math is the old base-10 math we've been using since we began counting our fingers and toes. Hexadecimal is a form of counting which you might assume evolved on another planet, because it's base-16 math! In base 10, we count from 0 to 9 and, on passing nine, return to 0, adding a 1 to the left of the 0, steadily incrementing into tens, hundreds, thousands, etc. Believe it or not, hexadecimal ("hex," from here on) works the same way... but with more numbers. To count from a one-digit number to a two-digit number in base 10 is as simple as: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. To do the same in hex, we would count: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10! Not really any different from counting in base 10, except that we have sixteen numbers to deal with, instead of ten, before advancing to the tens, hundreds, etc. And, since hex is base 16, converting numbers can be confusing. For example, the decimal number 253 is represented in hex by FD. Decimal 12 is hex C, and decimal 20 is hex 14.
Fortunately, you probably won't need to do any converting. If, by chance, you do (say your printer manual lists hex only, and you need decimal), there are several calculator-type accessories for the ST which feature decimal to hex conversion. Also, most printer manuals feature a table for such conversions. But, in the event you don't have either, that's where your ST BASIC Sourcebook comes in. In its Appendix E are two tables showing the complete ST character set. One table shows the usual 8×8-pixel characters used in low and medium resolution, and the second table shows the 8×l6-pixel characters usually used in high resolution. The characters' values are the same on both tables, so it doesn't matter which you use. You can find the character corresponding to the hex value on the table, then merely check the decimal value (or vice versa). Even if you have an accessory or reference to convert values, keep the Sourcebook on hand, because we will be using it.
Now let's get to work. Most ST word processors have special text files with them, containing data for the printer configuration. The user loads this file into the word processor, edits the data (changing it to the codes for his/her printer), saves it, then runs a special program which reads the data from that file and writes the appropriate printer driver.
With 1st Word, you load one of the .HEX files (as in FX80.HEX) from the PRINTER folder (you can load ASCII.HEX if you want to start from scratch). Make sure WP (Word Processor) mode stays OFF when working with this file. For ST Writer, you'll load the file CONFIG.TXT and edit it. Other word processors may have a special program which prompts you for data. Refer to the manual for your program if you're unsure about this.
So, what are you waiting for? Boot up your word processor, get that configuration data on-screen, and let's get cracking!
Special effects.
The first thing we want to do is check all the major text and character effects, and make sure they're installed properly. With both the ST Writer and 1st Word configuration files, the codes for each function are separate and documented. What you need to do is open up your printer manual and find the table which lists all of the printer commands. Now, look at the file on your screen. Move down past all the header information until you see the following: (Note, the boldface copy is used in the following examples only to differentiate between 1st Word and ST Writer files, and will not actually appear in the files.)
1st Word: *0 * Character width ST Writer: *Turn underline mode on: <Esc>"-" 1 27 45 1 255 255 255 255
These represent the beginning of the main configuration data. In the case of 1st Word, you probably can ignore fields like "Character Width," "Linefeed WITH return" and "Horizontal," and "Vertical Initialisation" [sic], as they're probably correct. Let's try setting up "Draft bold" as a start. You should find a line like the following in your file (please note that these are generic examples, and the exact wording and codes in your file might be different—just read the comments to make sure you have the correct function):
1st Word: * 6 *Draft bold on ST Writer: * bold on:
In your printer manual, find the command sequence for turning boldface type on. If you can't find a boldface command, try looking under "double-strike," etc. If your printer doesn't feature anything like this function, choose another (say, underlining). I'll quote from my Star SG-10 manual; using IBM mode, the control code I want is:
<ESC> "G" Double-strike print
Now, just what does <ESC> "G" stand for? Simple. To start double-strike/bold printing, my SG-10 must receive the ASCII values for Escape and uppercase G (in that order). What we need to do now is find out what these values are. Look at the character set table in your ST BASIC Sourcebook and find the character for Escape on the chart (represented by the symbol ). Now, you have to calculate the value for the character.
If you're using ST Writer, you need the number in decimal, so go straight up from the Escape character to the top row of the chart ("decimal value"). The value should be 16. Now, go to the left from Escape and find the number in the "decimal value" column along the side. It's 11, right? Now, 16 + 11 = 27, so the value for Escape is 27. Do the same for G: 64 + 7 = 71. So, for an SG-10 printer in IBM mode, the command sequence for double-strike/bold type would be decimal 27, 71.
Now, enter these values into the data fields below the description, replacing the top number with 27 and the second number with 71 (and so on, if you have more than two numbers). There are eight values in the ST Writer configuration fields. If your command sequence is shorter than this, don't delete the extra numbers, just make sure they are 255, the "null" character (for most printers). The "comment" line is begun with an asterisk (*), and you can type anything you wish on it, as it's ignored by the program which writes the printer driver (note that I've added the control codes here for future reference). The edited command sequence should look like this:
* bold on: <Esc> "G" 27 77255 255 255 255 255 255
If you're using 1st Word, do the same as above, finding the Escape character on the chart. However, instead of reading the decimal values, we need the hexadecimal values. We find 1 in the hex column above Escape, and B in the column to the left. Now, we add these two up. If unfamiliar with hex, you're probably groaning at the idea of adding base-16 numbers. But in this case, it's easy.
Since the character table in the ST BASIC Sourcebook is a 16×16 grid, it is laid out perfectly for hex. The values across the tops are hex "tens," so 1 + B = 1B. For G, the values are 4 + 7 = 47. Easy, huh? Just as D + 9 = D9 or F + C = FC. Simply put the value from the horizontal column in front of the one from the vertical column, and that's it. Now you have to enter the codes into your file. The data is entered sequentially, on a single line, each value followed by a comma and a blank space before the next value. To put the codes IB, 47 into the file, we have to edit the line like so:
before: * 6 * Draft bold on after: 6, 1B, 47 * Draft bold on
The asterisk at the beginning of a data line indicates that it is not in use. The number which follows the asterisk is the function number. You must delete the asterisk to make a given field functional, and put the function number (6 in this example) in the first column, followed by a comma, a space, and then your printer codes. The above 6, IB, 47 is read by 1st Word as "Function 6 - codes: Escape G." If you delete the function number, the first value in your codes will be seen as the function number, which can lead to real problems! The second asterisk in the first example, and the only asterisk in the second, tells the configuration program that what follows is a comment it should ignore. Don't delete the asterisk before the comment unless you enjoy problems.
The example we've just gone over is used throughout the configuration file. Do the same for functions like italic type, underlined text, etc. Look up the codes in your manual, use the chart in the Sourcebook to find the appropriate values, write them down (commented!) on a piece of paper, then punch them into the configuration file.
Be forewarned, however, that not every function your word processor has may be supported by your printer—and vice versa. Make sure you find any codes needed to turn functions off as well as on (if the configuration file requests such data). If you don't, your printer may not stop using a given mode until you turn the power off! Some printers do not have specific commands for shutting off things like italic or bold type. If yours is one of these, try using the command for normal print (or try "Pica," etc. if you don't have a "normal/draft print" command) in place of any missing "off" codes.
Parlez-vous ASCII?
Yes, but with an accent. As stated earlier, ASCII is used by both our computers and printers, but not all ASCII is interpreted the same way. You could say it's like a language. The language is common, but there are regional dialects which are somewhat different. In the case of our systems, the main alphabet is the common part of the "ASCII language," but the rest of it is usually a local dialect.
It's simple to see why printers don't have the same codes for various print functions, as those codes usually involve multiple values. However, you'd think that there would be some standardization with regard to things like carriage returns and accented (international) characters. Nope. Why, even Atari's 8-bit computers use a peculiar dialect of ASCII called ATASCII (ATari-ASCII), which doesn't even use the same character for a carriage return that the ST does. It gets no better with printers. Both 1st Word and ST Writer can print special characters not normally used on the (American) keyboard. You can put these on-screen, but getting them on paper is somewhat trickier. What you need in such trying situations is an ST-Printer ASCII Dictionary, better known as a "Character Translation Table."
Both 1st Word and ST Writer have facilities for character translation, but putting them to use isn't easy. If you feel you have your printer driver set up as you need, and don't have a use for accented and other special characters, you may wish to skip to "Test drive." If you're a daring soul, stay right here.
As always, some characters on your ST may not appear in your printer's character sets, and vice versa. Those which are common between the two machines are likely to have different ASCII values. What you need to do to use these is tell your word processor what value to send the printer to make it output a given special character. Keep the character set table of your ST BASIC Sourcebook on hand, and find the ASCII code conversion chart in your printer's manual.
This chart should list the decimal, hex (perhaps binary, too) and control character values for each and every character the printer can type. If your printer supports multiple character sets, make sure you keep your eye on the column for the characters of the mode you use. Scan down the list of printed characters until you find something unusual, say something like the character © (copyright). Now, the next question is: does your ST's character set feature this particular letter? Look at the table in your Sourcebook. Ah, there it is! Decimal 181, a.k.a. hex BD. What is your printer's value for it? My SG-10, in Star mode, uses decimal 203, or hex CB. Hmmm. Not the same.
1st Word users must search the Translation Table section of their configuration file for the description which matches that character (it's the same as the hex value in the ST character set, function number BD). Now, all we have to do is add the value for the character, just as we entered printer control codes earlier. Before edit, the line might look like this:
BD * No copyright symbol
After edit, we might have...
BD, CB * Copyright symbol
This tells 1st Word what value to send the printer in place of its own value for the character.
ST Writer users must take a slightly different approach. Go to the translation table of your CONFIG.TXT file (if you're using an ST Writer older than 1.50–1.05 or 1.07, etc.—you will not be able to do this). This table consists of a series of hex numbers. The 0x at the beginning of all the numbers tells CONFIG.TOS the value is in hex. The numbers proper are the second part. So 0x0C is hex C.
These numbers might seem senseless, but they're not. To put the printer's value for the copyright symbol in place of the ST's, we simply have to find the hex number for the character in the translation table. The ST uses hex BD, so we find 0xbd in the table. The value my printer uses is hex CB, so I replace the 0xbd with 0xcb. Now, ST Writer knows to send my printer that code instead of its usual one.
Do this as much as you like. Scan your printer's character set, find a character you'd like to print, then check your Sourcebook to see if it's available. If so, compare the hex values. If they're the same, go on to the next character. If not, make appropriate changes (as above) until you get all that you want.
Finally, your printer may have characters your ST doesn't. If this is the case, find a character in the ST character set that you don't use and replace its value with the one for the character you want to use. What you see on the screen won't be the character you want, but it should print out a-okay. Further, if your printer doesn't have certain characters available, like è, you may be able to get the equivalent of this character by giving multiple codes for the character. To print the è, you would enter the value for the letter e, the value for your printer's backspace command, and then the code for the accent mark. You can do this in 1st Word, but I'm not sure exactly how it's done with ST Writer (if it's even possible using its translation table).
Test drive.
Almost time to get this baby out of the hangar, but a few notes before you save your file. If you're using 1st Word, near the beginning of the configuration file is a parameter which is used to tell the program if your printer is a dot matrix or a daisy wheel.
Look under "Miscellaneous configurable variables." There are six parameters; of them, the first is the printer type. Below the descriptions are six zeros (0, 0, 0, 0, 0, 0), which hold the values specified by the six descriptions. You enter a 1 in place of the first 0 if your printer is a daisy wheel, otherwise you leave it 0. Of the remaining five values, the second through fifth are used only if you set the first number to 1. The sixth number is set to 1 or 0, respectively, depending on whether or not you wish the program to pause between pages. Also, enter the name of your printer at the top of the file where asked, so when the 1st Print program is run by 1st Word, it will display the name of the printer, and you'll know it's using the correct configuration data.
If using ST Writer, check to make sure all the main print codes contain eight numbers (as described earlier). If any are short, add 255s to fill the field to eight numbers.
Save your file when you're done, then exit your program. Now you have to create the actual printer driver. If using 1st Word, go to the PRINTER folder and run INSTALL.PRG. Select your configuration data file from the item selector and let the program do its work, creating a file called 1ST. DOT or 1ST.DSY (depending on your printer type). If using ST Writer, make sure your configuration file is named CONFIG.TXT, and make sure it's in the same directory (main or folder) as the CONFIG.TOS program. Run CONFIG.TOS, and it will create a file called XYZZX.DAT. When the configuration program finishes, copy the resulting driver to the directory containing your word processor.
The moment of truth. Run your word processor. Create a document and start typing, liberally turning on and off various effects and inserting special characters you set up in the translation table. When you've finished, save the file and turn loose your printer. If the gods have smiled on you, all will go well—but don't count on it. Most likely, one or more effects you tried simply will not work correctly yet. Carefully note which functions or characters didn't print correctly, reload your configuration data file, recheck the figures, then resave the file and try again. Sometimes it takes three or four passes to get everything kosher, so remember, he who perseveres shall reap greater rewards.
A few final notes. If you have something that consistently fails to work, carefully check the data and text corresponding to it. Is the asterisk which tells the configuration program to ignore a comment missing? Are necessary commas present between numbers? Are all fields properly filled? Watch for things like a capital O in place of a 0.
Also, one common boo-boo concerns activating expanded print. Many people accidentally put in the codes for one line of expanded type, which is automatically shut off when the printer starts the next line. If you have this problem, make sure you have the code for expanded, not one-line expanded type.
Well, that wraps up Step 1 for this time. I pray this hasn't been too confusing, and I certainly hope I've helped many of you with this small but important stumbling block in setting up a computer system. As always, if you have any questions or comments on this, or other Step Is, please drop a line to ST-Log. Until next time, au revoir!
Addenda.
—In "Customizing the GEM Desktop" (ST-Log issue 14), when discussing how to install applications so that they'll run from a specific drive, I didn't make it absolutely clear that you must type a backslash (\) after the drive identifier, even if you're not using a folder name. If you don't, GEM gets confused and looks at drive A. Therefore, a DESK-TOP.INF file would contain the following line, if you wanted to install Neo-Chrome to run from drive E:
#G 03 04 E:\NEO.PRG@ *.NEO@
Refer to Step 1 in the May 1987 issue for more on this.
—I've previously stated that the ST cannot boot from any drive but drive A. Not true. I have a Supra 20-megabyte hard disk drive, and it has software with which the user can set the hard disk to auto-boot. To test the drive A boot claim I've heard so often, I set the hard disk to auto-boot, then turned off my two floppy drives (I have a 1-meg 520ST) and booted my system. After a few seconds, my system booted from the hard disk with no trouble. Everything went fine without the floppies. So scratch the contention that the ST can't boot from a hard disk. Clearly, it can.