* MRAB:
Steven D'Aprano wrote:
On Fri, 26 Feb 2010 09:09:36 -0600, Tim Daneliuk wrote:

Reminiscent of:

mov  AX,BX               ; Move the contents of BX into AX


That's a *good* comment, because without it most English-speaking people would assume you were moving the contents of AX into BX.

[snip]
If you're reading and/or writing at assembly language level then you
should know what it does anyway!

The assembly languages of virtually all the processors that I've come
across put the destination first, eg. x86:

    SUB AX,BX
    MOV AX,BX

which does:

    AX := AX - BX
    AX := BX


A bit off-topic, but there are /two/ main syntaxes for x86 assembly, namely Intel syntax (the above syntax, used by MASM, old TASM etc.) and AT&T syntax.


<example>
C:\test> echo int main(){ int x = 42; } >blah.cpp

C:\test> g++ blah.cpp -S -masm=intel

C:\test> type blah.s | find "42"
        mov     DWORD PTR [ebp-4], 42

C:\test> g++ blah.cpp -S -masm=att

C:\test> type blah.s | find "42"
        movl    $42, -4(%ebp)

C:\test> _
</example>


Personally I find the AT&T syntax very hard to read.

All those percent signs hurt my eyes...




and ARM:

    SUB R0,R1,R2
    MOV R0,R1

which does:

    R0 := R1 - R2
    R0 := R1

The only assembly language I know of which does it the other way round
is 68x00:

    SUB D0,D1
    MOVE D0,D1

which does:

    D1 := D1 - D0
    D1 := D0

I know which I prefer! :-)

Cheers,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to