[COFF] ancient macros, machine code translation, as mental architecture models

Aron Insinga aki at insinga.com
Mon Jul 15 11:44:37 AEST 2024


On 7/14/24 14:02, John Levine wrote:
> According to Aron Insinga<aki at insinga.com>:
>> On 7/13/24 19:46, John Levine wrote:
>>> I looked at the manual and I think he's misreading it. The "words" in
>>> question are the tokens in the macro definition. ...
>> Possibly, but they use 'syllables' for tokens (symbols or integers), and
>> they say here that they advance the location counter after each word
>> copied.  If they were copying characters into the input stream, they
>> would not be incrementing the location counter ('.') after each word
>> transferred.
> If you really want to know what it did, here's the internals manual.
> The description of the macro facility starts on page 19 and it is
> quite clear that they're storing a tokenized version of the macros, so
> they're not copying characters, but they're not just copying assembled
> instructions either.
>
> https://bitsavers.org/pdf/dec/pdp1/F36P_PDP1_Macro_Internals.pdf

Thank you!!  I found the PDP-1 and TX-0 MACRO sources and was sadly 
unsurprised by the lack of comments, so they are difficult reading.

    http://www.bitsavers.org/bits/DEC/pdp1/papertapeImages/20040106/macro_6-63/_text/part2.txt

They are not storing tokens.  In fact, the list of 'codes' for items 
stored as the macro body on p 20 is:
     a storage word,
     a dummy symbol specification.
     a constant,
     a dummy symbol parameter assignment, or
     an end marker.
So it is not storing tokens for instructions, just storage words 
(instructions or data) as mentioned in the user manual.

In the discussion in the internals manual, after the paragraph 
mentioning the year this was designed (a nice touch), they say that they 
are storing the macro body as 'partially assembled' 'words' into which 
the dummy symbols are 'inserted'.  (And in a single-address architecture 
with a small memory address, addition is enough to do that insertion.)  
They explain why they did this instead of storing characters:

They do not look at the opcode as I suggested was possible, they have a 
more general solution that works for a word containing either code or data.

I think that this may be (at least as far as any of us know) a unique 
case from the early days of computing where, on the TX-0 and a port to 
the PDP-1, a macro body *is* stored as a list of 'machine words' instead 
of source text.  The macro  body is not manipulated as a 'higher-level 
construct', it is just used for quite limited macro expansion.

This has NO bearing on what DEC/HP/VSI did more than two decades later 
for the Alpha, Itanic, and x86_64 (where macros are expanded by the 
conventional insertion of characters from the macro body into the source 
text stream).

- Aron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/coff/attachments/20240714/f526a14d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1RaBLgOaK9W7nogv.png
Type: image/png
Size: 101224 bytes
Desc: not available
URL: <http://www.tuhs.org/pipermail/coff/attachments/20240714/f526a14d/attachment-0001.png>


More information about the COFF mailing list