Documentation on the Spinwriter 5510/20 print driver: Written by Steve and Joe Maguire Yokohama, Japan: July, 1979 This driver is a bi-directional and logic-seeking. It has two modes of operation: word processing and standard. In the WP mode, the driver will space-average. In the standard mode it can act as a normal device driver for general purpose printing. This document will explain how the driver works and how to use it with WordWizard, BASIC or other software. TWO MODES OF OPERATION: ********* Word-processing: ********* 1) The driver is fully compatible with WordWizard. It allows all features of WordWizard to be utilized. However, there are two restrictions. You may not set a ".pitch" of more than 15 or a ".vertical spacing" of more than 16. This is due to a limitation of the Spinwriter. If you send an illegal value, a NON RESPONDING DRIVER error will occur. 2) In the word processing mode, the driver reacts to a formfeed (0CH) by printing linefeeds. It keeps track of the number of lines it has printed and prints linefeeds until it is at the top of the next page. If it detects that it is already at the top of the form, the formfeed is ignored. 3) The driver returns to the calling program in 1/10 of a second or less regardless of whether or not it has finished a complete print operation. This feature is available so that you can print one document and edit another simultaneously. This is accomplished by using a software interrupt. This interrupt is explained in the source code: TASK and YIELD (This process is sometimes called Spooling) 4) Vertical and horizontal spacing can be changed through the driver for special effects. You do this by calling the PTDOS Control/Status routine with the registers containing the correct values. This is explained the the driver source code. 5) A carriage return prints an automatic linefeed, and linefeeds are ignored. If a 0FFH is sent to the driver, the next carriage return does not issue a linefeed. This facility is available so that underlining and over-striking are possible. 6) Space-averaging is performed on all lines except those ending in a 01H (that is, and inverted "L"). This improves the appearance of justified text by making each "gap" in the line of equal space. For example: This is a test. Will print: This is a test. The gaps will not necessarily be an integer number of blanks. Each gap could be 1 and 1/3 "blanks" wide. It does not change the size of the line, it fits the new line in EXACTLY the same amount of space. The driver does this in a very simple manner as explained below: A) First, it counts the number of spaces between the first non-blank character and the last non-blank charcter. It also counts the number of gaps in the same area. For example: This is a test line. This has six spaces, but only four gaps. NOTE: When the driver counts the spaces and gaps, it squeezes the gaps. That is, if the following line is to be printed: This is a test. ~This too. | it will be squeezed to: +--- (see #7 below) This is a test. This too. in memory. This is done to simplify the printing overhead. B) Next, it takes the number of spaces (6) and multiplies this by the current horizontal pitch (if the pitch were 10 we would get 60) This is the total number of 1/120" increments that the blanks take up. Now we re-distribute those 60 increments equally into the four gaps. A little math tells us that 15 increments (1 and 1/2 spaces) will perfectly "space-average" this line. Then we print the first word - "This" - followed by 1 1/2 spaces, print the next word, and so on. To print the total space, we print a normal one then change the horizontal motion of the print head to print the odd sized remaining part. Afterward, we change the horizontal motion back to its original value. (in this case 10) C) Look at this line: That is false. In this line, there are five spaces and two gaps. The average space would be 2 1/2 wide. If the horizontal pitch is 7, then the total number of increments in the line is 35 (i.e., 5 x 7). Thirty-five increments have to fit into two gaps. That means that the gaps won't be exactly equal. One must be 18 and the other 17. Behind the line buffer, the driver dimensions an array containing the length of each gap. Each element holds the number of increments for the given gap. That is, the third element has the number of increments for the third gap etc. The method of filling the array is quite simple. In the example above, there are two gaps. Therefore, the first step is to zero all the array elements. Once we clear the array, we add add one to each array element until the total number of increments (35) is used. If we hit the end of the array, we start at the beginning again. In this way, the first element will contain 18 and the second element 17. When printing, the driver picks these values out of the array and prints them. This method is the easiest and fastest way in which to space- average. It does not require the use of a floating point math routine such as is contained in some other drivers. 7) A tilde is printed as a blank. Suppose you wanted to print the two blanks after the period in the following line. This is a line. This too. Normally, the driver would average the gaps and the two spaces would be reduced to one. By inserting the tilde character (~) into the text after the period, the driver is alerted that you want a double space in this position. The tilde is counted as a blank as well as a gap. The following lines would print a double space after the first period. This is a line. ~This too. This is a line.~~This too. This is a line.~ This too. This~is~a~line.~~This~too. Further information is contained in the WordWizard manual but is summarized here for those who do not have a copy available. 8) The driver prints all non-recognized controls characters as questions marks ("?"). 9) The driver prints bi-directionally and seeks the fastest direction with which to print each line. ********* Non-word processing mode: ********* 1) In this mode, the driver retains control until all printing is done before returning to the calling program. 2) The driver prints a tilde as a tilde -- not as a blank. 3) Space-averaging is not performed. 4) Carriage returns do not issue automatic linefeeds. Linefeeds are not absorbed. However, sending an FF hex character will cause the next linefeed to be ignored. (required for underlining) 5) A formfeed performs a hardware formfeed. That is, it prints the formfeed and scrolls to the top of the next page set by the Top Of Form button on the printer. The user should set this value before issuing any formfeeds. Note that unlike the word processing mode, a formfeed is issued regardless of whether or not the paper is at the top of a form. Bi-Directional Printing: This driver prints bi-directionally whenever possible. In addition to bi-direction printing, it does "logic-seeking" to determine the fastest method in which to print. For example, take these two lines: This is a test. This is a test line to explain the point in greater detail. If the driver were to print the first line forward, it is more efficient to print the next line forward as well -- not backward. The print head is positioned to the correct column for starting by sending out blanks. Because of a bug in the Spinwriter's internal software, we cannot use tabbing to position the print head properly. The effect of this restriction shows up only if low (below 1200) baud rates are used to communicate with the Spinwriter. The bug is that the Spinwriter reads the pitch value from it's front panel setting when tabbing - not the value currently stored in it's memory. (Software version G9CUR) This prevents the tabbing function from being used with a variable pitch driver. Printing with BASIC: The various control codes accepted by the driver can be sent via a Basic PRINT statement following the instructions given in the Basic manual. Printing with Electric Pencil Other word processing software does not support the function codes which are used by WordWizard. It should be possible to "fake" it by a scheme such as given below. Most word processors are unable to send control characters to the printer. In order to signal the driver that some special code is coming up, a normal ASCII character sequence can be used. A double dollar sign ($$) followed by a control letter can be inserted into the text on a seperate line. The driver "CONTROL" routine could be modified to process various letters sent to it after the "PROCESS" routine detects the $$ sequence. The required software patch to the driver is left to the user. Spinwriter connections to the Sol serial port: This driver waits for a "ready" status signal from the printer before sending any output. There are several status lines available at the Sol's serial port. The driver waits for the CLEAR TO SEND signal at pin 5 to become high. (Reverse channel line used on Spinwriter) This is bit 5 of the status word from port F8. (20 hex) Connections: Spinwriter pin Sol serial port pin TX DATA 2 3 RX DATA RX DATA 3 2 TX DATA GND 7 7 GND CTS 5| DSR 6| 20 DTR | denotes common connection CD 8| |6 DSR DTR 20 |8 CD REV CHA 19 5 CTS