From: dpbsmith@world.std.com (Daniel P. B. Smith)
Subject: 1963 memo describing TJ-2 word processor (7 pp. total)
Organization: The World Public Access UNIX, Brookline, MA
Date: Sun, 24 Jan 1993 04:36:05 GMT

TJ-2: The First Word Processor?

Because I think TJ-2 has a reasonable claim to be the first
word processor, or, at any rate, a very early one, the memo
describing it may have some historic interest and is 
reproduced here in its entirety.

This is keyed in by hand but is intended to be an accurate
copy of the original.  I have tried to reproduce the original
format precisely, including the exact places where spaces
were inserted for justification.
   
Numbers in brackets in the right margin refer my own notes, which
follow.

--------------------------------------------------------------------
 



                     PDP-1 COMPUTER                             [1]
         MASSACHUSETTS INSTITUTE OF TECHNOLOGY
              CAMBRIDGE 39, MASSACHUSETTS                       [2]











                        PDP-9-1







                          TJ-2                                  



                TYPE JUSTIFYING PROGRAM                         [3]
                                         May 9, 1963





     TJ-2  accepts English  text from  typewriter or reader,    [4]
and reproduces it at any  line length via typewriter  and/or
punch.   So much as possible both left and right margins are    [5]
aligned in  the  output.   To accomplish  this  the  program
doubles  some  of the  spaces in  the  output line,  and may
hyphenate words, getting hyphenation data from its  diction-
ary or from the operator via the display.

     Normal Mode:  All hyphens in the input text are assumed    [6]
to mark  compound  words,  and will  be  reproduced  in  the
output.  Carriage return is treated as a space, except:  (a)    [7]
a string of carriage returns is ignored immediately  follow-
ing a hyphen; (b) non-ignored carriage returns are translat-
ed  into  the  same  number  of  carriage  returns  if  they
immediately precede a tab.  Any number of adjacent spaces is
treated as a single space.  Backspace and the unused Concise    [8]
codes are illegal.  The program simulates tabs by spacing to
the nearest imagined tab stop,  as determined from the  Test    [9]
Word.

     Quote  Mode:   The  justification process  may  be sup-
pressed for a portion of the input by the appearance of  "^q"   [10]
(overbar-q) which puts TJ-2 into the Quote Mode.  Subsequent
characters from the input are copied exactly into the output    [11]
until  the occurrence of  "^e".  It is  wise to have carriage   [12]
returns as  the  first and  last  characters in  the  quoted
material.   All  100 octal  Concise codes  are legal  in the
Quote Mode, but  overbar should be  used with great  caution
because  it  is  a signal  for  some special  action  by the
program.

     Centering Mode:  At the appearance  of "^c" the text  up
to  the next carriage return is  centered on a separate line
in the output.  Should quoted material appear in the text to
be  centered,  it is  reproduced in  the  output but  is not
counted for the centering process.

     Figure  Mode:   The  sequence  overbar,  f,  a  decimal
number,  overbar, is  taken  by TJ-2 as  a command  to leave
blank lines for a figure  in the output.  The number  given,
minus one, blank lines are inserted in the output immediate-
ly if there is  room on the  current output page,  otherwise
the space is left at the beginning of the next page.  If the
"f" is omitted, the space is always left immediately.

     Inverted Indenting Mode:  This  mode is entered by  the
occurrence of "^i".  A counter c is set to zero when the ^i is
encountered.  While in the Inverted Indenting Mode all input
lines  not  preceded  by  a  multiple  carriage  return  are
indented c tab stops in the output.  Each line in the  input
which  is preceded by a multiple carriage return is preceded
by that many  carriage returns  in the output.   Also it  is
indented in the output by as many tab stops as in the input,
and it sets c  equal to that number  of tabs plus one.   The
normal paragraphing mode is restored by "^n".

     Quoted  Overbar:  An overbar is  copied into the output
if ^/ (overbar-slash) appears in the input.

     The following describes usage of the Sense Switches.        [13]
Sense Switch 1: on -- input from typewriter                      [14]
               off -- input from reader

Sense Switch 2: on -- output to typewriter                       [15]
               off -- no typed output
Sense Switch 3: on -- output to punch
               off -- no punched output

Sense Switch 4: on -- prohibit hyphenation
               off -- allow hyphenation as per dictionary
                            or display.

Sense Switch 5    used by individual error halts

Sense Switch 6    turn on at end of run to indicate no
                                   further input



     The Test Word is divided into four fields, with use  as
follows:

Bits     Meaning
11-17    length of justified line
7-10     output tab spacing (equal, starting at left margin)
1-6      number of lines per page (0 means no pagination)
0        if on, stop after current output page.


     To  hyphenate a word that appears on the display, point    [16]
the light  pen at  the  + figure  between letters;  it  will    [17]
become  a small =.  If  an erroneous + was  hit, all = marks
can be restored to  + by penning the   "OOPS" dot.  When all    [18]
the  satisfactory hyphenation-points are  marked, pen "SAVE"
to preserve the word in the dictionary or "FORGET" to accept    [19]
the  hyphenation but  not to retain  it.  (There  will be no
SAVE dot if the dictionary is full.) The Console version  of    [20]
TJ-2 starts with a blank dictionary.

     Error  halt aspects, indications,  and recovery proced-
ures are tabulated below.
AC  IO     Meaning            SS5 down,         SS5 up,         [21]
                               Continue          Continue

-0   0     output line too    insert carriage   (likewise)      [22]
           long               return

+0  +0     run completed      start new run     (likewise)

 1  char   illegal Concise    ignore            accept
           code

 2  char   illegal parity     ignore            accept

 3   0     word too long      forget word       insert space

 4  ...    word to be hyphen- take it anyhow    don't hyphenate
           ated ends in non-
           spacing character

 6  page   end of output      continue          (likewise)
    no.    page

10  ...    dictionary full    clobber program    don't save     [23]

12  ...    too much stretch-  stretch as much    don't stretch
           ing needed         as possible

17  ...    TW calls for very  start over         accept
           short line


--------------------------------------------------------------------


NOTES:

Following notes are copyright 1993 by Daniel P. B. Smith.
All rights reserved.  Permission granted for Internet distribution
and nonprofit use.

Was TJ-2 a word processor?

TJ-2 does not resemble modern word processors with "on-screen
formatting" or "WYSIWYG editing."  It does resemble earlier
word processors like RUNOFF, TROFF or WordStar in which the
editor and formatter are separate. 

Compared to word processors as we know them, TJ-2 had what
I consider to be the essential features -- rudimentary
paragraph formatting, centering, word wrap, and justification.
On the other hand, it lacked page number, headers, footers,
any kind of text attributes or text emphasis (there was not
even an underscore feature).  The hyphenation feature was
surprisingly sophisticated.  Note that a sort of graphic
user interface was used, but only for the hyphenation feature.

Notice that none of the following terms are used anywhere in
the memo: application, document, editor, font, format, software,
text, word processor, word wrap.

The general writing style of the memo is similar to that, e.g.
of the Digital PDP-1 Handbook.  In particular, the capitalization
of terms such as Test Word, Indented Text Mode, etc. is similar
to that in the PDP-1 Handbook, which contains phrases such as "the
Light Pen status bit is set to one," "the contents of the extended
Program Counter in bits 2 through 17," etc.  

[1]  PDP-1: The memos in this series were attributed to
     the "PDP-1 COMPUTER", not to a facility or organization.

[2]  "Cambridge, 39:" Zip codes were not introduced by the 
     Post Office until about 1964.

[3]  "TJ-2:" Presumably there was a TJ-1, but I have no information
     on it.

     The title line, "TYPE JUSTIFYING PROGRAM," is underscored
     in the original.

     No name is credited as either author or programmer.  The
     program was demonstrated to me by Pete Samson.  It was
     my impression that he wrote it but others may have 
     contributed.

     Although this memo was obviously produced with TJ-2, most
     of the other memoes in the series were not.

[4]  I've tried to duplicate the actual locations of added 
     spaces and punctuation.  

     "Typewriter:" the PDP-1 console typewriter, an IBM electric
     typewriter (typebar mechanism, not Selectric), modified by a
     company named Soroban to include switches and solenoids
     capable of sensing and initiating keystrokes.

     "Reader:" high-speed 400 "line"/second photoelectric
     punched paper-tape reader.  

     "Punch:" 63 character/second paper tape punch manufactured
     by Teletype.

[5]  In the original, the period ending a sentence is always
     followed by either two spaces or three.

[6]  "Normal mode:" today we'd call this "word wrap" and take it 
     for granted.  At the time, not only was there no succinct name
     for the feature, but the concept itself was unfamiliar enough
     need a precise explanation.

[7]  "Carriage return:" both returned the carriage and advanced the
     line on the typewriter mechanisms used on the PDP-1.  There was
     no distinct "line feed" operation to be concerned with.

[8]  "Concise code:" the character set used internally on the PDP-1,
     a six-bit code formed by truncating the full "FIO-DEC" codes,
     which included a parity bit. 

[9]  "Test word:" bank of eighteen toggle switches on the PDP-1 console,
     often playing the same role that a command-line argument would
     play today.  There was no provision for varying margins within
     a document.

[10] Letters preceded by a caret here, e.g. ^q, appear in the original
     with an overbar above them.  A nonspacing (dead key) overbar was
     part of the PDP-1 character set and frequently used as a syntactic
     convention to identify commands.  

     On lines containing these characters I have chosen to transcribe
     the spaces inserted for justification precisely as they appear 
     in the original, so as a result of inserting the caret these
     lines are now longer than the others.  

[11] Note that the terms used are simply "input" and "output," not
     "input stream," "input file," "input text," etc.

[12] The period is outside the quotation marks.  The New Hacker's
     Dictionary, 1991, comments that "Hackers tend to use quotes as
     balanced delimiters like parentheses...  This is incorrect
     according to standard American usage (which would put the ...
     final period inside the string quotes); however, it is
     counter-intuitive to hackers to mutilate literal strings with
     characters that don't belong to them."

[13] "Sense Switch:" a bank of six toggle switches on the PDP-1
     console, often playing the same role that a command-line switch
     would play today.
     
[14] Since there was no text editor, "input from typewriter" was not
     much use except for testing, demonstrations, or tutorials.

[15] Irregular vertical spacing here is accurately transcribed from
     original.

[16] It's typical of the computer documentation style of the time
     that this is described verbally, with no picture of the screen.
     When hyphenating the word "justification," the display would
     initially show

                     J+U+S+T+I+F+I+C+A+T+I+O+N

     The user would point the pen at hyphenation points until the 
     displayed showed

                     J+U+S=T+I+F+I=C+A=T+I+O+N

[17] "Light pen:" a pointing device.  It could not sense position.
     All it could do was detect the illumination of a point of
     light directly under it.  Somewhat complicated strategies
     were needed to acquire and track the pen.  

[18] The word "all" is underscored in the original.

[19] The "dictionary" was a temporary dictionary, kept in core (RAM)
     only for the duration of the session.  This is not explained
     because it was taken for granted.  There was no online storage
     for user files. 

[20] "Console version:" near the console was a device like a set of
     very small cubbyholes, designed to store fanfolded paper tapes.
     Programs for general use were stored in these cubbyholes and
     were referred to as the "console copies."  There were about
     forty or fifty of them, including Expensive Typewriter, TECO,
     TJ-1, the MACRO and MIDAS assemblers, machine diagnostics,
     and SPACEWAR. 

[21] AC, IO -- the two main active registers of the PDP-1, whose 
     contents were displayed in a set of indicator lights on the
     front panel.

[22] -0 -- the PDP-1 was a one's complement machine.  -0 was distinct
     from +0 and would have displayed as all lights on.

[23] The slight misalignment in the last column -- i.e. the "d" in
     "don't save" aligns with the "l" in "likewise," rather than the
     left parenthesis -- is an accurate copy of the original.  

--Daniel P. B. Smith
dpbsmith@world.std.com
-- 
Daniel P. B. Smith
dpbsmith@world.std.com