Live data from Hacker News

Ask HN: What's the best resource for learning modern x64 assembly?

news.ycombinator.com

51–60 of 112 posts

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#51
Assuming you are interested in learning not just Assembly but how to use it in conjunction with a high-level language (almost always C/C++);

Background:

--- Matt Pietrek's "Just Enough Assembly Language to Get By" - http://bytepointer.com/resources/pietrek_asm_pt1.htm

--- Hongjiu Lu "ELF: From The Programmer's Perspective" - http://beefchunk.com/documentation/sys-programming/binary_fo...

Books:

--- Computer Systems: A Programmer's Perspective (3rd Edition) by Bryant & O'Hallaron - https://www.amazon.com/Computer-Systems-Programmers-Perspect...

--- Modern X86 Assembly Language Programming by Daniel Kusswurm - https://www.amazon.com/Modern-X86-Assembly-Language-Programm...

--- Low-Level Programming by Igor Zhirkov - https://www.amazon.com/Low-Level-Programming-Assembly-Execut...

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#52
I wrote a Linux general purpose library for x64 assembler: https://2ton.com.au/HeavyThing/ and in recent months I decided to start doing video tutorials about the "how and why" of same. Learning I think is made easiest in Linux by learning how to navigate the syscall interface and how "man 2 write" becomes an important skill. Edit: Videos link as well: https://2ton.com.au/videos/

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#53

It really depends on your starting point. If you know how to write low-level C (i.e. with direct Win32/POSIX API calls), that's a good start. If you don't know what that means, you need to master this first. So much of assembly is built to support higher-level programming, things like segments, indirect references, system calls, etc., so it pays to know the WHY of all of it (e.g. do you know what a frame pointer is?…

How can I get started on learning the low level c stuff with direct system calls and such. I learned about assembly, pipelining, cache, and memory allocation during a systems architecture course, so I'm really interested in the low level of the machine. The problem is I don't really have an idea of a project that I could do to learn the level right above. Of course I learned a bit during the course, but I really want…

You might find my other posts in this thread a good starting point for your study.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#54
post #25

If you basically don't know how to code in assembly, learn 16-bit x86 with whichever method you find, it won't be wasted. You can extend most of the knowledge from 16 to 32 bit substituting register names ax,bx,cx,dx,si,di,bp,sp y eax,ebx,ecx,edx,esi,edi,ebp,esp. You can extend that to 64 bit with rax,rbx,rcx,rdx,rsi,rdi,rbp,rsp. Learning 16-bit x86 will have you learn about segment registers, but it isn't wasted eit…

I also learned Z80 first, and I can say categorically that learning 16-bit x86 is NOT a good idea. To do anything useful in 16-bit, register starvation is a constant. Segmentation issues are actually hard problems.

I submit that if x64 existed early-on, no one would have bothered with higher-level abstractions. x64 is actually -pleasant- to code in natively.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#55

There's no magic anywhere and 99.1% of it is documented. IA-32e/AMD64 is basically an extension of IA-32/x86. What you're looking for is to understand the difference between real mode, 386 protected mode, PAE, paging and long mode because the registers, instructions, addressing and sizes of structures differ. You can learn all of this by reading the Intel software manuals and digging into it yourself. Tools you need…

Flat Assembler is actually easier to get your head around early on than any of the *asm variants IMO: https://flatassembler.net/

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#57
post #25

If you basically don't know how to code in assembly, learn 16-bit x86 with whichever method you find, it won't be wasted. You can extend most of the knowledge from 16 to 32 bit substituting register names ax,bx,cx,dx,si,di,bp,sp y eax,ebx,ecx,edx,esi,edi,ebp,esp. You can extend that to 64 bit with rax,rbx,rcx,rdx,rsi,rdi,rbp,rsp. Learning 16-bit x86 will have you learn about segment registers, but it isn't wasted eit…

Great book, Jon! Pretty much the only material in Spanish at the time. I remember it from my years in Uni.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#58
Others already have given plenty of useful information, I just have a basic one.

Stay with Intel syntax, nevermind about AT&T syntax, beyond learning on how to read it.

PC world is all about Intel syntax, AT&T is lower level on how instructions get expressed and Assemblers macro capabilities just suck compared with what TASM and MASM were already capable of on the MS-DOS days.

Re: Ask HN: What's the best resource for learning modern x64 assembly?

#60
post #25

If you basically don't know how to code in assembly, learn 16-bit x86 with whichever method you find, it won't be wasted. You can extend most of the knowledge from 16 to 32 bit substituting register names ax,bx,cx,dx,si,di,bp,sp y eax,ebx,ecx,edx,esi,edi,ebp,esp. You can extend that to 64 bit with rax,rbx,rcx,rdx,rsi,rdi,rbp,rsp. Learning 16-bit x86 will have you learn about segment registers, but it isn't wasted eit…

I also started with the Z80, and then moved to Intel. Due to the history of the Zilog engineers there is a lot in common, and it definitely helped.

One thing I haven't seen people mention yet is actually using assembly language; just people pointing at documentation. To learn assembly, like anything else, you have to use it. I'd suggest writing a toy program to sum string-lengths, or do maths.

One of my own recent projects was to write a "compiler" to convert reverse-polish mathematical expressions to assembly language:

https://github.com/skx/math-compiler

It's been a few years since I touched assembly, and even when I did I largely ignored the floating-point stuff, so this was a handy refresher.

Post reply on HN