[TUHS] Design of the AT&T assembly syntax

Warner Losh imp at bsdimp.com
Tue Oct 29 08:08:53 AEST 2019

On Mon, Oct 28, 2019 at 2:16 PM Robert Clausecker <fuz at 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:

| VENIX/86 start off (bootstrap starts execution at location 0 `start').
| Relocate complete kernel down to low memory.
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

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.


> Robert Clausecker
> [1]: https://stackoverflow.com/a/42250270/417501
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20191028/f494cc25/attachment.html>

More information about the TUHS mailing list