19

The TECO editor, (originally Tape Editor and COrrector, later Text Editor...) found in some form on just about every computer and operating system DEC ever made, provides variables in which you can store numbers and/or text.

These variables are called "Q-registers".

Anyone know why that name was used? Is this related to anything on PDP-1 (which had the original TECO implementation)?

10
  • Upvoted, my deleted answer made no sense. However, I found this: books.google.nl/… and it seems A, Q and M registers are typically used for ALU (Arithmetic Logic Unit) description; and high likely it's related. But it doesn't show obviously why it is called Q. See page 290. Aug 17, 2019 at 15:11
  • 1
    Possibly because you need an intellect equal to Q's in order to use TECO properly. :-P
    – ErikF
    Aug 17, 2019 at 17:58
  • 1
    Already in early TECO, the letter q ("quantity") was used to retrieve the value of a register. That might have been the reason to call them Q-registers, but that's a conjecture. Trying to trace reasons for why things are named a certain way is difficult; they way this usually goes is that someone comes up with a name, and the name then sticks.
    – dirkt
    Aug 17, 2019 at 20:26
  • 1
    Oh, I see. The q-regs were named after the command to read the value in one, not the other way around. Plausible enough... Aug 18, 2019 at 0:11
  • 1
    @MichelKeijzers - if by "why it is called Q" you meant the Q register in a standard ALU arrangement, it's the Quotient register. Sometime combined with the Multiplier register to be the MQ register. Aug 20, 2019 at 0:20

2 Answers 2

11

It's really more of a conjecture, but if it is considered suitable as an answer:

Already in early TECO, the letter q ("quantity") was used to retrieve the value of a register. That might have been the reason to call them Q-registers.

Trying to trace reasons for why things are named a certain way is always difficult; they way this usually goes is that someone comes up with a name, other people start using it, and the name then sticks. This process doesn't leave a lot of written records, and even if you ask people involved, they are probably not aware of how this happened.

3
  • 1
    This has the smell of plausibility to me -- the command was 'q', possibly because of 'quantity' or possibly because this was one of the few available letters! -- and the registers were named after the command. I'd been looking at it the other way round. Unless Dan Murphy drops by, we likely won't know for sure. Maybe I asked an unknowable question. Aug 20, 2019 at 2:23
  • 8
    Supporting your answer. I was a developer of TECO at the MIT AI Lab. I added a set of command-line macro features which were under the <cntl>-] key. As you might suspect, they were referred to as the "control close bracket" commands. I also added LOTS of extra Q-registers by prefixing the name with one or more periods. These were the "dot", "dotdot", and "three-dot" Q registers. I should look in an old listing and see if there are any comments about the "Q" name.
    – cmm
    Aug 22, 2019 at 3:02
  • 1
    @cmm, thanks for a good suggestion. I found these: ;QI HAS THE VALUE OF THE LATEST QUANTITY PUT INTO Q-REGISTER I. and ;%I ADDS 1 TO THE QUANTITY IN Q-REGISTER I Sep 30, 2021 at 5:17
10

TLDR: TECO uses single-character commands. When extending TECO to add registers to store numeric values, there was a limited set of unused characters left for the commands associated with this functionality. q was chosen as one of these command characters because it could serve as a mnemonic for "quantity." This led to the numeric registers being called "Q-registers" and, though an unfortunate misunderstanding, eventually this was applied to the completely separate set (albeit sharing the same names) of text-valued registers as well.


dirkt's answer gives us the paper describing the timeline of how registers storing text and numeric values came about: "The Beginnings of TECO" by the original author of TECO, Dan Murphy.

On page 113 (PDF page 4), in the section "TECO becomes a programming language," Murphy describes the appearance of storage registers:

By late 1962, TECO had about the level of capabilities that simple editors would have for years to come, but TECO’s development didn’t stop there....

I added the concept of text variables—that is, a variable that would hold an arbitrary section of text. The command to move a range of text into a text variable was x. (I was running low on unused letters by then.) [emph. added] ...g (get) was used to copy the contents of a text variable into the main buffer at the editing point.... Despite the lack of a mnemonic association for x, it quickly came to seem natural, almost intuitive. To x something became as easily spoken and understood by TECO users as "store" would have been.

He goes on to discuss a separate set of registers for numeric values, sharing the same names:

Integer variables were also added around this time, again from the single-letter set a–z, 0–9. u (use) would store its argument into the variable, and q (quantity) would stand as the stored value in an expression. The same variable name could have both a text and numeric value; the command determined which was being referenced.

"Q-register" was a natural name for the registers retrieved by the q command. The name "Q-register" had been codified by October 1964: Daniel J. Edwards, in PDP-6 Memo No.2 / Memorandum MAC-M-191 ("TECO 6") describes them and the five commands that operate on them (p.4):

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....

MIT was using what appears to be a separate line of TECO development (probably starting with the PDP-1) that merged the Q and G registers together, as you can see above. (Peter Samson's July 1965 AIM-81 "PDP-6 TECO" also describes merged registers, though mysteriously it seems to have separate commands again for moving numeric and textual values out of the registers; using the wrong one "does not make sense" (p.5), presumably resulting in rubbish output.)

The original version with separate "Q" and "G" registers either continued to be developed or the split was restored, but MIT's usage seems to have stuck even for these versions. The Standard TECO User's Guide and Language Reference Manual (May, 1985, describing TECO-11 version 40, TECO-10 version 3 and TECO-8 version 7) uses "Q-register" to refer to both the text and integer registers though these are clearly two separate sets of storage:

3.3.2 Q-registers

TECO provides data storage registers, called Q-registers, which may be used to store single integers and/or ASCII character strings. Each Q-register is divided into two storage areas. In its numeric storage area, each Q-register can store one signed integer. In its text storage area, each Q-register can store an ASCII character string (which can be any text, including the important case of a TECO command string).

So, to summarize, the numeric registers were reasonably referred to as "Q-registers" because they were retrieved with the q command, the merge of "Q" and "G" registers caused MIT writers naturally to use just one name for the merged registers, and the split-register versions of TECO picked up this usage probably because it's simpler to say, and the two sets could also be conceived as a single set due to the shared names.

2
  • @LarsBrinkhoff Reading Samson's document in more detail, yes, it's clear to me now that there's no confusion there and that version did merge the storage of the registers. I've no idea of the provenance of the "Standard TECO" whose documentation I referenced, so I've posted a question asking for clarification on the versions and I'll rewrite this answer once that question gets an answer or two. Thanks for chasing this down as far as you did.
    – cjs
    Oct 5, 2021 at 0:30
  • @LarsBrinkhoff Great! Many of my comments are now obsolete (not to mention wrong) so I've deleted most of them, leaving just the answer history if anybody needs to go back and check what the errors were.
    – cjs
    Oct 12, 2021 at 7:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .