Massachusetts Institute of Technology
                           Cambridge, Massachusetts
                                  Project MAC

PDP-6 Memo No. 2                                     Memorandum MAC-M-191
                                                     October 29, 1964

                                  TECO 6

                           by Daniel J. Edwards


     A character-based paper tape editor for the PDP-6 has appeared.
The program has a large character buffer in which text is stored and
operated on.  Among its features are a page display, macro and itera-
tion statements, and character by character text insertion and deletion.
The program was written by R. Greenblatt, J. Holloway, and S. Nelson
with most of the ideas stolen from the PDP-1 TECO program.

     The program is controlled from the console teletype, upon which
the user types a string of commands which are executed on request.


Y         Kill the buffer and Yank a page of text into the buffer.  A
          CTRL FORM character defines the end of a page.

A         Append a page from the tape reader to the buffer.

P         Punches the current page, kills the buffer and reads the
          next page.

PW        Punches the current page only.

nP        Performs the P operation n times.

b,cP      Punches the text between buffer pointers b and c.

nF        Feed n lines of blank tape in tape punch.

T         Types out from the current buffer pointer to the end of a line.

nT        Types out from the current character pointer through the next
          n lines.

b,cT      Types out lines between buffer pointers b and c.


Note:  On any type-out, hitting a teletype key will terminate the operation.


PDP-6 Memo No. 2 -2- Memorandum MAC-M-191 V Display from the buffer pointer to the end of the current line. nV Display n lines forward from the current buffer pointer. b,cV Display text between buffer pointers b and c. Note: If the display ever hits the edge of the screen, the display stops and starts over again. nCTRL D Sets the character display scale where n is either 0,1,2 or 3. Note: The display normally shows 6 lines either side of the current character pointer. The number of lines may be changed thus: nCTRL N Sets the number of lines normally displayed on either side of the current character pointer. Buffer Pointer Control B Beginning of buffer. Z End of buffer. bJ Move buffer pointer to value of expression b. nC Move buffer pointer forward (or backward if n is negative) n characters. nR Move buffer pointer backwards (or forward if n is negative) n characters. 0L Move buffer pointer to beginning of current line. nL Move buffer pointer forward (or backward if n is negative) n lines. Sxx...x ALT MODE Search moves buffer pointer forward from current loca- tion until the string xxx...x is matched. Buffer pointer is then left at the right end of the matched string. If no match is found a ? is typed out.
PDP-6 Memo No. 2 -3- Memorandum MAC-M-191 ^Syxx...xy Like S but the single character y instead of ALT MODE serves to delimit the match string xx...x. Nxx...x ALT MODE Search line S but if a match is not found on this page, punch the page out, kill the buffer and read in the next page. Continue until a match is found. _xx...x ALT MODE Same as N but do not punch. Character Insertion and Deletion nD Delete n characters forward (backward if n is negative) from current buffer pointer. Ixx..xxx ALT MODE Insert the string xx..x at the current buffer pointer, where the string xx...x is delimited by ALT MODE. ^Iyxx...xy Insert as in I but use the single character y as the string delimiter. 0K Kill (delete) from buffer character pointer to begin- ning of the current line. nK Kill all characters from current buffer pointer through the next n lines. b,cK Kill the characters between buffer pointers b and c. Iteration Statements < Start an iteration statement. > End an iteration statement. An iteration statement has two parts separated by , (comma). If the value of the first part is negative then the second part is executed as a TECO command and the first part is tested again. If the first part is positive, nothing happens. For use in iteration statements the command S has value -1 if a match is found and 0 otherwise. Example: A TECO command to replace every use of the instruction JRST on a page by JSR and display the result. BJ <SJRST$,-4DIJSR$> B,ZV
PDP-6 Memo No. 2 -4- Memorandum MAC-M-191 Q Registers Q registers are general storage registers for 1) numbers 2) buffer pointers 3) text 4) macro definitions There are 36 Q registers and they are referred to by Qn where n is a single letter or digit. The following commands pertain to Q registers. xUQn The value of the arithmetic expression x is placed in Qn. mXQn m lines of text starting at the current buffer pointer are copied into Qn. b,cXQn Text between buffer pointers b and c is copied into Qn. QnG Get text stored in Qn and insert at the current text buffer pointer. The contents of Qn are unchanged. QnM Macro: text stored in Qn is executed as a TECO com- mand string. These macro calls may be nested and a macro may redefine itself by Xing text into its Q register. If during the execution of a macro an ALT MODE is encountered, the execution of the current macro is suspended and control returns to the top level. General Commands and Comments ALT MODE Echoes line $ and is used to terminate a Search or Insert string. Two ALT MODE characters in a row mean execute the current command string. CAR RET Always puts in CAR RET followed by LINE FEED. any key During an iteration or type-out hitting a teletype key will terminate the operation. numbers All numbers are taken as decimal. + - * / Are the arithmetic operators. All arithmetic expres- sions are evaluated left to right with all operators having the same weight. Precedence may be established by using parentheses. Example: 2+3*4 is 20 2+(3*4) is 14
PDP-6 Memo No. 2 -5- Memorandum MAC-M-191 CTRL FORM The form feed key CTRL FORM is used as a page separator. CTRL TAB The tab key CTRL TAB goes in as a tab but echoes as 3 spaces because there is no tab mechanism on the con- sole teletype. RUB OUT Deletes characters one by one from the command string. The character just deleted will be echoed on the tele- type. ? After an error ? has been typed out the operator can type in ? which will cause the last 10 characters of the current command string to be typed out where the last character is the one that caused the error. H Many times people want to talk about the entire buffer by typing B,Z. H is equivalent to typing B,Z. . The current text buffer pointer location may be referred to by typing . (period).
PDP-6 Memo No. 2 -6- Memorandum MAC-M-191 Annotated Example YB,ZT$$ Clear the buffer, Yank in one page and type it out on the teletype. Note: ALT MODE echoes as $. TITLE ARM START: CONO ARM,ON CONSO ARM,ENDR JRST .-2 DATAO ARM,(TEXT) CONO ARM,WRITE JRST 4,. BJS.-2$-1DI1$$ Start at the beginning of the buffer and search for .-2, delete the 2 and insert a 1. 0LT$$ Type out the current line. JRST .-1 BJS,.$I+1$0LT Start at the beginning of the text buffer and search for ,. and insert +1 then type the resulting line. JRST 4,.+1 ZJ-4UQ1 <Q1,I TAB CONO 200000 $Q1+1UQ1> HT$$ Set current pointer to end of the text buffer, use iteration to insert 4 CONO 200000 instructions and type the whole page. TITLE ARM START: CONO ARM,ON CONSO ARM,ENDR JRST .-1 DATAO ARM,(TEXT) CONO ARM,WRITE JRST 4,.+1 CONO 200000 CONO 200000 CONO 200000 CONO 200000 ZJIEND START, Insert END START, at the end of the buffer, punch $PW$$ entire buffer and wait for more commands.

Differences from the original text

I've tried to keep the formatting as close as possible to the original, which, by the way, was typewritten, not printed from a computer file. But rather than duplicate obvious errors, I have fixed a few things:
This copy of TECO 6 was retyped and HTMLized May 6, 1999 by Eric Fischer from a paper copy provided by the Publications Office of the MIT Laboratory for Computer Science.