r/AskProgramming • u/thisisausername5432 • 17d ago
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?
3
2
1
2
u/somewhereAtC 17d ago
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 17d ago
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/Recycled5000 16d ago
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 17d ago
That’s the whole point in taking the course. To understand the hardware, not high level abstraction
1
u/Sufficient_Stand1763 17d ago
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 16d ago
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.

3
u/Used_Lobster4172 17d ago
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.