Where to learn x64 assembly from?

AlanKalane picture AlanKalane · Aug 27, 2015 · Viewed 38.2k times · Source

Okay so I know C++, C#, Java and some other languages and I decided to learn assembly next but I feel like I've hit a solid brick wall right from the start. I just need someone to point me in the right direction.

Here are the questions:

  1. I've been told that it's better to learn assembly from the internet than from books because assembly depends on your hardware and books are mostly outdated. Is that true?

  2. I've got a 64 bit CPU and I'm using (or at least trying to use) FASM. Where do I find the necessary documentation?

  3. I'm totaly confused because most of the tutorials I've seen don't even work for me. Is that because of the hardware differences? How do I find the right tutorials?

  4. Can I run x86 and x32 assembly on my 64 bit computer?

  5. Could you please be so kind and write me a simple program in assembly (that works on my PC) with a breakdown in the comments? I'm running 64 bit Windows 10 on my intel core i5 CPU. Please.

Answer

jforberg picture jforberg · Aug 27, 2015

I think this is a valid question. It can be a bit hard to find up to date information on assembler.

  1. Yes. A lot of resources printed and online describe i386 (x86) assembler and not the new amd64 (x86_64). Many things have changed, e.g. function arguments used to be passed on the stack but now they are passed in registers. This applies both to Unix and Windows.

    Basically, ensure you are reading about 64-bit assembly.

  2. Why not try the online manual. Note that assemblers are not that different when it comes to simple stuff.

  3. I don't have Windows but if you are having trouble with any specific program, you could ask about it here. You will need to post the actual failing program.

  4. Yes but you have to link it against 32-bit libraries and use the 32-bit version of the Win32 API. But if you're starting out, why program in the 1980's when you can work with the modern instruction set?

  5. Try this.

Also, if you are going to be programming in assembly, I strongly recommend you get a debugger. I use GDB which works well and is free, on Windows you get to use the Visual Studio debugger which is superb.