0
votes

I have a decent understanding of C/C++ but I want to expand my arsenal, hence I decided to learn Assembly... Its just that I love low level languages which can be compiled (I dont like python and stuff... no offence). Anyways, I have some questions related to Assembly. I searched for quite some time but apparently, all resources are very outdated. So, here goes:-

  1. Which is the preferred OS for learning Assembly? Windows or Linux?
  2. I decided to use NASM since I like it's syntax compared to others. I am not a really a fan of macros and I wanna learn the bare-metal basics. What I dont understand is: In windows, I have to use push and pop, etc. while in Linux I can use mov and access registers? I really prefer the latter method so that's an important consideration on OS choice. Plus, there isn't decent amount of learning material for Assembly in Windows so it's quite confusing. Especially since I was hoping to start 64 bit architecture.
  3. I dont intend to go with MASM or FASM because both are macro based, and I feel comfortable with NASM syntax.
  4. Finally, could someone suggest me some free E-books or guides to learn Assembly? It doesn't really matter if Linux or Windows since I can use virtual box for linux as well.

Thanks for the help :)

Best Regards,

Electrux

2
"In windows, I have to use push and pop, etc. while in Linux I can use mov and access registers?" Huh? Where did you get this idea?Michael
For an excellent web reference for Assembly see The Art of Assembly Language Programming. While it is primarily written for 8086, all principles are 100% applicable to current assembly programming. The only differences are register sizes, calling conventions and syscall numbers for x86_64. It will cover all the basics. If you are proficient in C, then you know you don't skim anything and pick up the language, spend the time required with this reference and you will serve yourself well.David C. Rankin
extremely sorry on my poor knowledge... I thought (assumed)it worked like that assuming from here stackoverflow.com/questions/12574924/… sorry for my bad assumption :)Electrux
thanks @David C. RankinElectrux
The push vs register thing: I think you are confused by the calling convention, i.e. if you are either providing your asm functions to be externally called (from C for example), or when you call external API. As long as you are just learning ASM, not calling anything, or providing your calls, you can use whatever you wish (between my internal functions I always use registers for parameters). For learning basics you may also consider dosbox with DOS and .com files, which are flat relatively-addressed 64k pieces of code. And there's probably tons of old tutorials from DOS era (from demo scene).Ped7g

2 Answers

0
votes

Which is the preferred OS for learning Assembly? Windows or Linux?

I've only ever used Linux when working with Assembly. You can do it with Windows also, but Linux is the less painful route.

In windows, I have to use push and pop, etc. while in Linux I can use mov and access registers? I really prefer the latter method so that's an important consideration on OS choice.

push and pop deal with things on the stack, mov mostly deals with registers. both are used regardless of the OS. The type of assembly has to do with processor architecture (the instructions it uses), and not the operating system itself.

Finally, could someone suggest me some free E-books or guides to learn Assembly? It doesn't really matter if Linux or Windows since I can use virtual box for linux as well.

Here's a link to the book I used throughout my University course.

Good luck!

0
votes
  1. The assembly instructions are typically chip architecture based and not platform specific. That being said, platforms may define the function calling interface standard (register based, stacked based, hypbrid). So Linux would be different than Mac OSX (which is just a passthrough on the Sys V convention).
  2. NASM is good but macros are your friend. I too learned the basics first and now I am very happy to use macros to save me effort when producing repeatable constructs.
  3. As part of #2, push, pop and mov varients are Intel and AMD based instructions that each have their purpose and are not mutually exclusive. And there are similar on other chip architectures (eg. ARM, etc.).
  4. If you are Dosboxing this, find any x86 or x86_64 reference in google and you will find a bevy of informative and instructive resources.