The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Robert Clausecker <fuz@fuz.su>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Design of the AT&T assembly syntax
Date: Mon, 28 Oct 2019 16:08:53 -0600	[thread overview]
Message-ID: <CANCZdfo-DnYM8_1mQZMcgKd7OP14iJ7ffF7PLJv-xMRBBTuaOw@mail.gmail.com> (raw)
In-Reply-To: <20191028200745.GA36348@fuz.su>

[-- Attachment #1: Type: text/plain, Size: 2871 bytes --]

On Mon, Oct 28, 2019 at 2:16 PM Robert Clausecker <fuz@fuz.su> wrote:

> Some time ago, I wrote a piece [1] about the design of the AT&T
> assembler syntax.  While I'm still not quite sure if everything in there
> is correct, this explanation seemed plausible to me; the PDP-11
> assembler being adapted for the 8086, then the 80386 and then ELF
> targets, giving us today's convoluted syntax.
>
> The one thing in this chain I have never found is an AT&T style
> assembler for x86 before ELF was introduced.  Supposedly, it would get
> away without % as a register prefix, thus being much less obnoxious to
> use.  Any idea if such an assembler ever existed and if yes where?
> I suppose Xenix might have shipped something like that.
>
> The only AT&T syntax assemblers I know today are those from Solaris,
> the GNU project, the LLVM project, and possibly whatever macOS ships.
> Are there (or where there) any other x86 AT&T assemblers?  Who was
> the first party to introduce this?
>

VENIX 2.0 had this. It was a Pure AT&T syntax w/o % signs:

eg
|
| VENIX/86 start off (bootstrap starts execution at location 0 `start').
|
| Relocate complete kernel down to low memory.
        .text
start:  cli
        mov     dx,#LOWMEM      | base of relocated kernel
        mov     cx,cs
        cmp     cx,dx           | are we there (put there by bootstrap) ?
        beq     L0002           | Yes.
        mov     ds,cx

which is clearly op dst, src.

VENIX's compiler was from the MIT compiler collection which was a port of
the portable C compiler to x86 that everybody used (it seems, I don't have
a reference for that, just speculation).  You can find a version of
this code in the TUHS archive in Applications/Portable_CC which has the
8086.zip.

There's follow on work from a university in Queens in 286.zip that adds
near/far stuff (the original one didn't, and the VENIX code assumes none of
the segment registers change in userland code for its context switching
code). I've not looked at this code.

All this code is dyed in the wool K&R code from a V7-level C compiler, so
it won't compile on newer systems. And it's a right-royal pain in the
backside to convert on the fly because it wasn't written to be portable to
ANSI compilers and modern C compilers no longer have a K&R mode...

Thanks again to Al Kossow for this being in the archive. It's possible to
find this on FTP sites if you look hard enough. I found them in the past,
but I can't find it now that I went looking, so I'm quite happy that it's
in the archive. VENIX 2.1 released a newer version of the compiler than was
in VENIX 2.0. I don't know if those pre-date or post-date this stuff.

Sadly, the modern PCC project no longer works with 16-bit code, but I
suppose that's par for the course these days.

Warner

Yours,
> Robert Clausecker
>
> [1]: https://stackoverflow.com/a/42250270/417501
>

[-- Attachment #2: Type: text/html, Size: 3881 bytes --]

  reply	other threads:[~2019-10-28 22:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 20:07 Robert Clausecker
2019-10-28 22:08 ` Warner Losh [this message]
2019-10-28 22:24   ` Robert Clausecker
2019-10-28 22:29     ` Warner Losh
2019-10-28 20:14 Robert Clausecker
2019-10-28 21:06 ` Seth Morabito
2019-10-29  0:31   ` Nemo Nusquam
2019-10-28 21:48 Alexander Voropay
2019-10-28 21:59 ` Robert Clausecker
2019-10-29 14:38 Alexander Voropay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfo-DnYM8_1mQZMcgKd7OP14iJ7ffF7PLJv-xMRBBTuaOw@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=fuz@fuz.su \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).