News for hackers. Stuff that matters.
Re:What was the original reason for the design of AT&T assem... by codetrotter on Saturday February 13, 2021 @07:08PM (#26128346)
> While Intel always used a dst, src operand ordering for its assembler, there was no particularly compelling reason to adapt this convention and the UNIX assembler was written to use the src, dst operand ordering known from the PDP11.

Tangential but I like to see this as sort of two ways of thinking where the operands are in both cases ordered so that what you “have” is closer to “you”.

So in Intel syntax it’s like you are thinking from the CPU perspective and what you “have” are places that you want to put data into. So dst, src.

In AT&T syntax it’s like you are thinking from the perspective of a program, and what you “have” is data that you want to put into places. So src, dst.

I’m not suggesting that this is the reason mind you. Just saying how I like to think about it.

Re:What was the original reason for the design of AT&T assem... by Someone on Saturday February 13, 2021 @07:38PM (#26128524)
If that’s true, most programming languages work from the CPU perspective. I think that suggests the syntax may have come from consistency with “A = B” in programming languages (similar to the initially weird looking argument order of strcpy and friends in C), or, maybe, programming languages followed what assemblers did, or the two are similar because of some other common reason.

What I don’t like about Intel’s syntax is that the normal phrase is ‘move A to B’, but ‘mov A, B’ moves what’s in B to A.

(The reason I don’t like it may be because the first CPU I programmed was a 6502, which had separate load and store instructions. Unfortunately, that doesn’t work well with memory-to-memory (which the 6502 doesn’t have) or register to-register (for which the 6502 used a T for ‘transfer’, as in TXA for ‘copy X register into Accumulator) instructions)

Re:What was the original reason for the design of AT&T assem... by eru on Sunday February 14, 2021 @02:25AM (#26130373)
Mathematical formulas, especially definitions, are often written like E = m * c^2 or pV = n k * T or F = m * a. Ie the simpler stuff often goes to the left.

So that tradition might have been where most programming languages picked the convention up from?

Re:What was the original reason for the design of AT&T assem... by mhh__ on Sunday February 14, 2021 @05:08AM (#26131026)
lowercase n should be nRT under modern conventions, to be pedantic (else you're off by a factor of N_a)
Re:What was the original reason for the design of AT&T assem... by eru on Tuesday February 16, 2021 @09:03AM (#26153923)
Yes. Though ideally, we would redefine temperature units so we could get rid of R and Avogadro's constant in that formula.

Ie so that it becomes T := N / (p * V) where N is measured in number of molecules, not in number of moles.

So we'd measure temperature in Joule (or electron-volt) per degree of freedom.

Re:What was the original reason for the design of AT&T assem... by JJMcJ on Saturday February 13, 2021 @07:16PM (#26128401)
Unix on DEC hardware originally predates even the Intel 4004, so of course they used the DEC standard.

Also, GNU as assembler has switches to allow Intel syntax if that's what is desired.

Re:What was the original reason for the design of AT&T assem... by pjmlp on Sunday February 14, 2021 @05:33AM (#26131127)
It wasn't always like that, and I am sure it isn't at the same level as nasm/yasm/masm/tasm.
Re:What was the original reason for the design of AT&T assem... by ksaj on Sunday February 14, 2021 @03:28AM (#26130599)
We're similar that way. I think of Intel as saying if you want to retrieve something, you need an accessible place to put it first.

So MOV is literally "move into this register I can access, this value that I can't access until it in a register."

For example, a wordy version of how I think through MOV AX,5 could be: "move into AX, the value 5" where AX is an accessible container for the value 5.

I did assembler coding for more than a decade, so I'm pretty nostalgic about it. Nothing I do really calls for it anymore these days.

Re:What was the original reason for the design of AT&T assem... by exmadscientist on Saturday February 13, 2021 @08:29PM (#26128848)
I've always understood it as coming from mathematics: if you're used to writing "let X = <complex expression>" in papers, then the high-level syntax "var X = complex_expression();" or low-level syntax "mov dstX, src" are all directly relatable.
Re:What was the original reason for the design of AT&T assem... by Someone on Sunday February 14, 2021 @06:02AM (#26131292)
But then, why call it ‘mov’, and not ‘let’, ‘set’, or ‘copy’ (“copy what is in A to B” translates nicely to “copy A,B”)
Re:What was the original reason for the design of AT&T assem... by ac42 on Sunday February 14, 2021 @06:27AM (#26131432)
If it's so close to Unix, why do all the C functions have it the other way around? e.g. memcpy(dst,src,n)

I've always thought AT&T syntax is made for machines & debugging compiler output while Intel syntax is made for people and large scale coding...

Re:What was the original reason for the design of AT&T assem... by cbm-vic-20 on Saturday February 13, 2021 @07:53PM (#26128617)
Also, DEC's MACRO-11 looks a lot different than the Bell Labs' Unix "as" assembly, for the same hardware.