"Fighting with Lasers" by Bryce Nesbitt * Copyright 1988 Commodore-Amiga, Inc. * * Executables based on this information may be used in software * for Commodore Amiga computers. All other rights reserved. * This information is provided "as is"; no warranties are made. All * use is at your own risk. No liability or responsibility is assumed. This article goes over some of the common problems you may encounter when hooking an Amiga computer up to a PostScript(R) compatible laser printer. As a bonus I'll show you how to significantly speed up printer communication. The article is based on laser printers made by Apple, NEC and A.S.T., but the instructions apply to most PostScript printers. We recommend the use of a serial (RS-232 compatible) interface for use with PostScript. PostScript is bi-directional; the printer can send error messages and other information back to the host. While the Amiga's parallel port is also bi-directional, the parallel port on a typical laser printer will not be. With the use of the techniques presented in this article, the serial interface can be set to speeds matching those of the parallel interface. The required cable is quite simple. Wire the two serial interface connectors as follows: computer printer 2 3 3 2 7 7 The preferences serial port parameters should be set to 8 data bits, 1 stop bit, Xon/Xoff handshake, no parity and either 1200 or 9600 baud (depending on the setup of your printer). On most printers the 1200 baud setting is non-adjustable, while the 9600 baud setting is fully programmable. Set the printer and Amiga to 1200 baud if you are having communication difficulties. One very common problem is the inability to print complex documents to the printer. When a simple document is printed, it works fine. When a complex document is printed, the printer produces no output. Chances are this is due to a handshaking problem and can be corrected by matching handshake between the Amiga and the printer. Talking to the printer Once you have the cable ready, it is time to check the handshaking. Using a text editor such as "ed" or "notepad", prepare the following PostScript program: /Helvetica findfont 20 scalefont setfont 40 200 moveto statusdict begin 25 sccbatch (The Options number is ) show 10 string cvs show (. The baud rate is ) show 10 string cvs show (.) show end showpage From the CLI, copy the resulting text file to the serial port with a command such as "copy textfile ser:". The printer should print a sheet of paper. If nothing seems to happen after 30 seconds, cycle the power to the printer, wait, and try again. The output should look like this: The Options number is 0. The baud rate is 9600. If your Options number is in the range of 0-3, you probably are ok. If it is in the range of 4-7, you definitely have a problem, and must make a change for reliable operation with the Amiga. The Options can be interpreted as follows: 0 or 4 Ignore parity 1 or 5 Check for Odd parity 2 or 6 Check for Even parity 3 or 7 No parity Codes 0-3 specify Xon/Xoff handshake. Codes from 4-7 indicate "DTR" handshake (DTR goes low when the printer's buffer is full). For use with the Amiga, you should specify mode = 0. Higher numbers may be used by some printers, but 0 should be the correct setting for the Amiga. Setting the numbers Some printers have switches or front panel controls for the options and baud rate, in this case consult the manual for the printer. Other printers require a PostScript program like the one given below. Replace BAUD and OPTIONS with the numbers you wish to set. serverdict begin 0000 exitserver statusdict begin 25 BAUD OPTIONS setsccbatch end WARNING: The EEPROM device that stores baud and options settings will wear out after about 10,000 settings. Do NOT change the settings more often than necessary! The settings made by this program are permanent, even if power to the printer is turned off. After sending the program, either send a CTRL-D to the printer, or wait 30 seconds for the changes to take effect. Approaching the speed of light The 9600 baud default of most laser printers is not very fast. Printers with PostScript 38.0 and above can be set to higher baud rates. See your printer manual for the exact list of baud rates supported. Typical legal values are: 1200, 9600, 10473, 11520, 12800, 14400, 16457, 19200, 23040, 38400 and 56700. 19,200 baud is the recommended speed for use with the Amiga. This speed can be set with the same PostScript program that sets the Options number. Going interactive Copying files to SER: is a limited and primitive way of talking to the printer. If you wish to experiment with PostScript, it is much better to use PostScript's interactive mode. Any terminal emulator or modem program should work for this application. Set the baud rate, parity and stop bit settings to match those of the printer, then follow the instructions: Type one CTRL-D to the printer (hold "CTRL" and press "D"). This will end any current job the printer is working on. If the printer is an Apple LaserWriter, the flashing activity light should stop. Next type the word "executive" followed by a return. If all works well you will be in PostScript's interactive mode, and should see an appropriate copyright message. To read out the current settings, type the following (What you type is rendered in boldface, what postscript types back is in courier): ^D executive PostScript(r) Version 47.0 Copyright (c) 1984, '85, '86, '87 Adobe Systems Inc. Copyright (c) 1981 Linotype All Rights Reserved. PS> PS>statusdict begin PS> PS>25 sccbatch PS>= 0 ;<- mode byte PS>= 9600 ;<- baud rate PS> PS>end PS>quit ^D This sequence prints out the Options and baud rate just like the previous program. Description of the code: The "statusdict begin" informs Postscript you wish to access functions from the special status dictionary. The "25 sccbatch" line first pushes the number 25 on the stack, then executes "sccbatch" (25 is a parameter to sccbatch, indicating you want information about the 25 pin RS-232 port). sccbatch will leave two numbers on the stack. The topmost will be the serial mode byte, the next will be the baud rate. The "=" command reads the top number from the stack and prints it to your terminal. In this case, the printer was configured for mode 0 and a baud rate of 9600. You can multitask "your favorite editor" with the terminal program. Prepare the PostScript file in the editor. To test, send the file to the printer with the "send ASCII" option of the terminal program. Typing CTRL-T at any time will produce a status report from the printer. CTRL-C will abort any currently executing job. Fun With Postscript No article about PostScript is complete without a gratuitous typesetting example. Here's mine: /showit %stack: (string) {0 0 moveto show} def /oshowit %stack: (string) {true charpath stroke} def /Helvetica findfont 100 scalefont setfont 150 150 translate .90 -.10 0 {setgray (Amiga) showit 10 rotate} for 1 setgray (Amiga) showit 0 setgray 0 0 moveto (Amiga!) oshowit References Adobe Systems, Inc. PostScript Language Reference Manual. Addison-Wesley, Reading, Mass., 1985. Adobe Systems, Inc. PostScript Language Tutorial and Cookbook. Addison-Wesley, Reading, Mass., 1985. PostScript is a registered trademark of Adobe Systems, Inc.