http://qs321.pair.com?node_id=11110167


in reply to Re^3: Assembly language
in thread Assembly language

Assembly is not machine code. It doesn't help newcomers to this stuff to blur the distinction. Assembly is a symbolic language that has a very close to 1:1 mapping with machine instructions, though not exactly 1:1. But it provides named constants, named registers, named machine instructions, labels, memory addressing strategies, and a lot more that are not native to machine code. Assembly language is a human readable language, and cannot be run natively on the CPU any more than native machine instructions can be read by a human (without at very least first converting them to an unambiguous printable encoding such as hex -- but even then, good luck with that for anything that isn't super trivial.

Assembly is useful as a teaching aid, or for programming very small systems that don't have C compilers available. It might be useful for hand-optimizing tight sections of C code. But on modern computer hardware, the need for hand-optimizing code at the Assembly level is quickly vanishing.

I enjoyed learning 6502 Assembly. On the one hand it was a big pain. But on the other, it was fascinating. But even in the 80s, it was just about the slowest way to get anything done. I think that if someone wants to learn assembly, they should do it. They'll gain an appreciation for the fundamentals. But nobody's going to write a REST microservice in it. ;)

To the OP: The days of being able to just input raw machine instructions for the CPU to execute ended with computers with switchboard face panels like the Altair 8800. And even then, it was hard enough that people would mostly just key in a short bootloader, and use it to pull down the actual program, written in a less tedious way. Nowadays, when you're typing at the Linux command line you are typing within a piece of software (the shell), and it doesn't expose the CPU directly, at least not easily. The shell doesn't understand 011101011101000101001010100001010111110101010000000101010101011011010110101.


Dave

Replies are listed 'Best First'.
Re^5: Assembly language
by LanX (Saint) on Dec 16, 2019 at 17:30 UTC
    > Assembly is not machine code.

    Yes and apparently there are at least two dialects for 8086 assembly, one from AT&T and the other from Microsoft.

    Apparently they are mapping different mnemonics to same machine code and using different syntax for addressing modes.

    Furthermore is assembly programming only fun if there is a macro language included.

    Back in the time of my 68000 jobs this made a lot of meta stuff non portable between different assemblers.

    > any more than native machine instructions can be read by a human

    Friend of mine claims that he can still read Z80 machine code in hex format.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice