Article View: comp.lang.postscript
Article #86Re: Sending special characters to serial connected LaserWriter
From: Scott Winders
Date: Sat, 31 Oct 1992 00:51
Date: Sat, 31 Oct 1992 00:51
145 lines
8025 bytes
8025 bytes
In article <4366@vidiot.UUCP>, brown@vidiot.UUCP (Vidiot) wrote: > > In article <28OCT199212320113@comb1.comb.umd.edu> jeffc@comb1.comb.umd.edu (Jeff Clowser; IRG) writes: > < > <uh, I happen to have a Personal Laserwriter NT, configured as a serial printer, > <9600bd,8,N,1, XON/XOFF, binary postscript, so I know it works. In fact, that > <is one of the default settings for this printer. It shows how to set it up > <(more or less) in the appendices of the printer manual. > > As someone else points out, this mode makes you lose the ^T and ^D functions > of the printer. The ^D function is a must for telling the printer end-of-job. > It comes is very handy when killing a job. > > I therefore prefer hex encoded data, not real binary. Too dangerous. > > <BTW - There is no such thing as a parallel port on a PLW NT... > > The LaserWriter II NT doesn't have one either. :-( > -- > harvard\ spool.cs.wisc.edu!astroatc!vidiot!brown > Vidiot ucbvax!uwvax..........!astroatc!vidiot!brown > rutgers/ INTERNET:vidiot!brown%astroatc.UUCP@spool.cs.wisc.edu > brown@wi.extrel.com I tried posting this before.... Here are the definitions: Raw: Lets all data pass through unfiltered. Control characters such as End-of-file (CTRL-D) and status queries (CTRL-T) or passed through and not acted upon. Normal: Data passing through is filtered. Control characters perform their intended function. Status queries (CTRL-T) will have a status returned; End-of-file (CTRL-D) characters will end print job. Binary: We took the following from pages 15 to 17 of the "LaserWriter IIf and LaserWriter IIg Printers Developer Note" (APDA R0230LL/A): Binary serial protocol LaserWriter printers support an alternate protocol for the serial communication channels. While this protocol allows all character codes to be transmitted as data, it also allows certain characters to be used for specifying control functions, which may be handled asynchronously by the communications driver. Those control functions include requesting status, aborting a job, marking ends of jobs, and controlling flow for the serial channels. Because this protocol can transmit any character code, it can be used for sending PostScript language jobs that contain binary images or for sending commands with any sequence of control characters to emulators. Because this protocol can be used for sending both PostScript language programs and emulation jobs, it provides a way of switching between the PostScript interpreter and the emulators without flushing the input buffers. The manner of switching between PostScript language programs and emulations is described in Chapter 3 of the "LaserWriter Reference". To select the binary serial protocol, set the operating mode switch to position 6, or use the LaserWriter Utility to set one of the changeable parameter sets to use binary protocol. The binary serial protocol requires the host computer to insert a quoting character at certain places in the data stream and to modify the character codes for certain characters. (This procedure is described later in this section.) That means that the host computer must filter the data before sending it to the printer. The filtering may be done by an application program or within the operating system of the host computer. When the binary serial protocol is enabled, it operates on communications in both directions. Therefore, the host computer must also filter any data it receives from the printer. There are eight control characters that are treated as control functions rather than as data when they are received by the communications driver. The control characters are defined in Table 2-1. Table 2-1 Control characters in the binary serial protocol Hex value ASCII name ASCII function Control function 01 SOH CTL-A Quote data byte 03 ETX CTL-C Abort job and flush to end of file 04 EOT CTL-D End-of-job marker 05 ENQ CTL-E None 11 DC1 CTL-Q XON in XON/XOFF flow control 13 DC3 CTL-S XOFF in XON/XOFF flow control 14 DC4 CTL-T Request printer status 1C FS CTL-\ None To transmit these characters as data, they must be quoted, as follows. To quote a character, the program replaces the character with the two-character sequence consisting of CTL-A followed by the result of the exclusive-OR (XOR) of the character to be transmitted with $40 (the dollar sign indicates hexadecimal). For example, to send a byte with the value $14, a program must send the 2-byte sequence $01$54. This method of quoting guarantees that whenever any of the eight special characters is received, the control function is intended, regardless of whether the preceding character is a CTL-A. Because of that character independence, the generation and processing of asynchronous control characters can take place at a lower level than the generation and consumption of the data stream. In particular, on the host computer, the CTL-A quoting convention can be implemented by a user program while XON/XOFF processing is performed independently by the operating system. All byte values other than those of the eight special characters are transmitted by simply sending the value. After a CTL-A is received, the next character received that is not one of the eight special characters must be the result of XORing one of the special characters with S40. The reception of any other character constitutes an error in the input data. Between the CTL-A and the XORed character, any number of special characters may appear, except for the special characters that are handled synchronouslyQCTL-A and CTL-D. Reception of CTL-A or CTL-D between a CTL-A and the XORed character constitutes an error. When one of the special characters arrives unquoted and it specifies no control function for the channel, the character is discarded. For example, if XON or XOFF is received and XON/XOFF flow control is not in use, the XON or XOFF character is discarded. The characters CTL-E and CTL-\ currently do not specify any control functions. They are included among the characters that must be quoted future. The binary serial protocol is different from the simple serial protocol in that there is no mapping between end-of-line conventions with the binary protocol. Whatever end-of-line character (<CR>, <LF>, or <CR><LF>) is sent by the host is received by the interpreter or emulator in the printer. The PostScript interpreter handles different end-of-line characters in a uniform way, but a program that reads data (by means of a read or readstring operator) receives whatever characters were sent by the host. Likewise, whatever output is generated by a PostScript program (by means of a print or = operator) is sent unchanged. Note: The standard end-of-line character in the PostScript language, corresponding to '\n' in a PostScript language string, is <LF>. Scott Winders winders@aux.support.apple.com "My opinions are my own, not my employer's"
Technical Details
Message-ID:
<winders-301092165146@macwinders.support.apple.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!data.nas.nasa.gov!taligent!apple!macwinders.support.apple.com!userReferences:
<1992Oct26.202733.5318@island.COM> <4353@vidiot.UUCP> <28OCT199212320113@comb1.comb.umd.edu> <4366@vidiot.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!data.nas.nasa.gov!taligent!apple!macwinders.support.apple.com!user From: winders@aux.support.apple.com (Scott Winders) Newsgroups: comp.lang.postscript Subject: Re: Sending special characters to serial connected LaserWriter Message-ID: <winders-301092165146@macwinders.support.apple.com> Date: 31 Oct 92 00:51:44 GMT References: <1992Oct26.202733.5318@island.COM> <4353@vidiot.UUCP> <28OCT199212320113@comb1.comb.umd.edu> <4366@vidiot.UUCP> Sender: daemon@Apple.COM Followup-To: comp.lang.postscript,comp.periphs.printers,comp.protocols.appletalk Organization: Apple Computer, Inc. Lines: 145