r/AskProgramming • u/thisisausername5432 • Sep 27 '26
Career/Edu Best way to learn Assembly (ARM)
I'm an electrical engineering major, and I'm currently taking a computer architecture class. The problem is that I'm struggling to comprehend the code in assembly. I'm fine with higher level coding languages like c++ or Java, but I just can't wrap my head around this topic, and I don't want to fail this class. Any recommendations to self teach me Assembly?
9
Upvotes
1
u/marrsd Sep 27 '26
Does it have to be ARM? Older CPUs are easy to emulate and have simpler instruction sets. I learnt on M68K. 6502 is another good option.
3
u/Used_Lobster4172 Sep 27 '26
Well, hard to know how to help, but on the bright side, ASM already only have a limited number of operations, and ARM or RISC, so it's even fewer.
Might be helpful to find some videos on how the ARM works internally with the different registers and such. I never learned ARM ASM, but I don't imagine it is all that different in how it works.
ASM is literally controlling exactly what the CPU is doing.
3
u/gm310509 Sep 27 '26
I've been following this tutorial:
https://www.mikrocontroller.net/articles/ARM-ASM-Tutorial
2
u/trutheality Sep 27 '26 •
Play Human Resource Machine.
2
u/somewhereAtC Sep 27 '26
Pick a manufacturer, then pick a toolset. My preferences is Microchip PIC or AVR and the MPLabX IDE and compilers. Begin by looking at the datasheet for whatever part you select; assembly language is detailed in PIC datasheets, but AVR datasheets refer to a different PDF file (readily available).
When you have a grip on what the datasheet says, get some hardware going and run a debug session with an easy code. You'll catch on right away.
Don't fall into the trap thinking that the "old" PICs and AVRs are somehow easier. The assembly code for either hasn't change in 30yr and the newer devices have many new, good features. The new ones are also available as Curiosity boards with programmers and debuggers built in. Some have ARM cores as well.
https://www.microchip.com/en-us/tools-resources/evaluation-boards/curiosity-nano
2
u/Standard_Guava3672 Sep 27 '26
Assembly is really minimalist, start with the hardware you want to code in. And think of assembly not like a language, but of understanding a specific hardware. Also coding is mostly just placing data into the memory, and if you place it at the certain adress you can control I/O stuff or the RAM, etc... If you think of coding like placing data into adress, that's mostly it. Assembly is a really simple language, and that's why it's really hard. Look at instruction set too.
2
u/D3c3pt1_n Sep 27 '26
https://azeria-labs.com/writing-arm-assembly-part-1/
2
u/Recycled5000 Sep 27 '26
One tip is to use a compiler. Put in simple functions in C and using an optimizing compiler view the assembly. Also can run some code, single step in assembly debug mode.
1
u/Recent-Day3062 Sep 27 '26
That’s the whole point in taking the course. To understand the hardware, not high level abstraction
1
u/Sufficient_Stand1763 Sep 27 '26
For me personally, when I do a bit of assembly, I found that it was easier to start learning from the 6502 assembly programming language. It felt easier than modern assembly languages although I don’t know if that’s just me or if that’s actual fact but it did teach me the basics.
1
u/JGhostThing Sep 28 '26
I hate to say this, but Assembly language is the absolutely simplest that programming can be. Every command in assembly is (usually) one simple action. Unlike a higher level language, which can have multiple actions on a line, assembly is simple. Also, there is very little syntax. You merely have to memorize the hundred or so commands in this language.
Of course, each processor family has it's own language.
To learn the concepts of assembly, I recommend learning the PDP-11 assembler or the 68000 family assembler. I know that there are open source simulators for the PDP-11.
1
u/sswam Oct 01 '26
I learned ARM back in the day on the Acorn Archimedes, largely from this book. That's for the original 32-bit ARM, it's changed a lot since then. I'm not suggesting you learn from this book, but it was a very good book. You could read it to see how clean and simple it used to be!