3 ms·
I mainly use assembly for optimization myself, in general to double-check that the compiler did what I expected it to do. I also sometimes use it when I do bare
by simias 6y ago
I mainly use assembly for optimization myself, in general to double-check that
the compiler did what I expected it to do. I also sometimes use it when I do
bare-metal programming or other very low level code, but that's pretty niche
these days.
But even more generally I think you won't have any trouble picking up x86
idiosyncrasies if you've familiarized yourself with ARM/MIPS/Z80 assembly.
Although maybe MIPS would be a bad choice because it doesn't use flags which are
an important concept for many assembly languages.
IMO the key concepts for an assembler tutorial would be, out of the top of my
head:
- The stack,
- banking registers, the frame pointer,
- The various types of jumps/calls/branches and their differences,
- Conditionals,
- Calling conventions,
- Banking/context switching/IRQs (at least for low level programming, not so
important if you're only dealing with userland I suppose),
That stuff exists on basically any architecture. Then you have things like
immediate encoding and addressing modes which are also very important and
architecture-specific.
I suppose SIMD could be interesting as well, but these days it seems to be
mostly done with intrinsics instead of raw assembly, at least in my experience.
- roel_v 6y agoYes, when you study assembly as a general programming language, the same way you learn another language. But again, for people who are interested in reverse engineering, the focus is different, and you'll find that if you start looking for assembly tutorials online (and also the books on modern assembly, e.g. I have "Modern x64 assembly language programming" and "Windows 64 bit assembly language programming quick start" here next to me and those fit that description), a lot of those are for aspiring reverse engineers. The (numerical) optimization angle is a lot harder to find, agner.org probably being the exception. E.g., knowing what _main is and how to call an OS primitive is a lot more important when reverse engineering than knowing about context switching and simd. I was just trying to say, that's where the focus on a specific OS comes from, and a focus on things that people who do manual numerical optimization would consider irrelevant or at best tangential to what they consider 'important' in assembly.