in reply to Assembly language

What is assembly language useful for?

I'd say:

If your goal is to just get a deeper understanding of how compilations and processors work, I actually wouldn't recommend trying to learn modern x86 - the list of instructions has grown ludicrously long. So unless you have some specific reason for needing to know x86 assembly, like you're trying to debug something at that level, you're looking at very specific optimizations, etc., I'd suggest looking at a much simpler microcontroller, such as a Microchip 8-bit PIC, or for example the Atmel ATmega328 (now owned by Microchip as well). The latter is the basis of the Arduino Uno, it's got an instruction setPDF that's not too huge.

Modern hardware has grown pretty complex, which is why learning the concepts on a simpler embedded system is IMHO helpful: How a processor stores its instructions, fetches them, executes them, reading and writing from/to RAM to do so, interrupts, various buses, low-level "peripherals" (like UART controllers), and so on. All of these concepts translate (more or less) to modern machines, except that they are much more complex there. But the basic building blocks of how a CPU communicates with the rest of the hardware in the system are the same.

* Note: Many people use the term "assembly" interchangeably with "machine instructions", and in many cases this is true, assembly is often just a textual 1-to-1 representation of the actual binary instructions the processor will directly execute. But to translate that textual representation into a binary format requires a translator program, and often these add a few features that actually mean that the "assembly" is not exactly the same as the machine instructions. But they're close enough that this distinction often doesn't matter.

How could it relate to Perl?

Perl is several steps away from assembly. The perl interpreter, which parses your Perl code into an intermediate representation and executes that, is itself written in C, which of course is compiled to machine instructions. So it's not like Perl code is directly translated to machine code - perl is an interpreter.

From your node here:

If assembly is fundamental, and machine code is the most fundamental, why would I have to download a program to run it? I do not want to download a program to be able to run it. There should be a way to access the processor directly (possibly through terminal) where I could write "000 101 100 ..." and have it output "101 001" (these numbers do not mean anything real)

The reason it's not that simple is that on a modern machine there are tons of of intermediate steps and layers. Take the "Hello, World" examples from this Introduction to UNIX assembly programming or this NASM Tutorial:

It's all these layers that make your question pretty broad and hard to answer better without knowing more about why you're asking - I could suggest you could get a degree in Computer Engineering, then you'd learn about all of the above topics, but perhaps you're looking for something more specific?

Replies are listed 'Best First'.
Re^2: Assembly language
by haukex (Archbishop) on Dec 15, 2019 at 12:17 UTC

    I just remembered: The game "Human Resource Machine" (Windows/Linux/Android/iOS) is something I recently tried out and liked; unlike some of the other "intro to programming" games that let you move someone around the screen and that have control structures like loops and if/else, its "programs" are actually quite like assembly.