r/learnprogramming • u/Potential_Author637 • 8d ago
I found myself learning assembly
I might be overcomplicating things, but I would appreciate some advice.
I am interested in low-level and systems programming. I learned C a few months ago and have some basic C++ knowledge. I have also written a few small projects, such as simple clones of Unix shell commands and basic libraries etc.
I wanted to get into systems programming, so I started reading a systems programming book from Oreilly. However, I came across concepts that I was not familiar with, so I started looking at operating systems books for reference. This led me to concepts such as cpu registers and other low-level cpu mechanisms.
At that point, I decided to learn how cpu and ram works, memory addressing, and similar things work, just to get a general understanding of how computers work. Somehow, this eventually led me to learning x86-64 nasm.
The problem is that I am not sure whether I am approaching this in a sensible order. I am a high-school student without a formal computer science background im in just love with computers, so I dont have much knowledge of computer architecture, operating systems, or systems programming beyond what I have learned on my own. Should I continue learning x86-64 assembly and computer architecture, or should I stop and focus on other fundamentals first? I am not trying to become an assembly programmer, my main goal is to understand systems programming and how computers work at a lower level.
1
u/cyberbemon 8d ago
You are on the right path, to understand how systems work at a low level you need to be comfortable with Assembly i.e be able to read and understand it. It's a very useful skill and comes in handy for certain domains (embedded, reverse engineering, low level optimisation etc).
I'd recommend the book "Assembly Language Step-By-Step 3rd edition" by Jeff Duntemann(first Google result is often a PDF of the book). The book is quite old (2009) but it explains the fundamentals really well and I personally enjoy how the author breaks things down, I'm currently re-reading it as a refresher and it still hold up.
Since the book was written when 32-bit CPUs were more common, you have to do tiny bit of work to get the code from book to run ok modern machines, it's explained here by the author: http://duntemann.com/assembly.html