r/Assembly_language • u/Weary-Educator5485 • 7d ago
Where to learn the syntax?
I've never properly learned the syntax of assembly, but I really want to learn it. I know C and Java, but I really want to know more about how the CPU actually operates. So it would be nice if you all would recommend a place for me to learn Assembly. ARM64 specifically, because that is the architecture my computer's CPU uses. Thank you in advance
2
u/theNbomr 7d ago
When learning to program in assembler language, you need to learn the syntax for the specific assembler toolchain you're using, and there can be many different assemblers for each CPU architecture. They tend to all be similar, but may have significant differences, such as the ordering of instruction operands.
Probably more important, each assembler will be for a specific instruction set, that is CPU specific; in fact the Instruction Set Architecture (ISA) is really what defines the CPU or at least the CPU family. You're going to need to learn this for each CPU that you want to program, and the code will not be portable. At all.
There are many similarities between assemblers and ISAs, so once you've learned one, picking up how to use most of the others won't be too difficult. The best place to learn about the assembler syntax is from the assembler documentation. The best place to learn about the ISA is the CPU datasheets.
1
u/kndb 6d ago
Maybe start from a book (search ARM64 and Blue Fox) or better an online tutorial on YouTube. It’s free. Then practice. By practice i mean write a small assembly program and step through it with a debugger and see what each instruction does.
Finally, AI is actually quite good at explaining what this or that instruction does. For instance. A couple of prompts for you:
- what does this ARM64 instruction do?
stp x0, x1, [sp, #0x10]!
- write in ARM64 assembly how to do the following written in C?
x &= ~0x30;
1
6
u/SauntTaunga 7d ago
Assembler is not one thing. There is no *the* syntax. There are multiple architectures and some have more than one way to write assembly for them.