Live data from Hacker News

Learning to Read X86 Assembly Language

patshaughnessy.net

51–60 of 238 posts

Re: Learning to Read X86 Assembly Language

#51
post #49

To understand assembly it really helps to know at least something about how computers work on a low level. When I first tried learning it (long time ago, in a high school) I had no idea how computers really work on such a low level, how CPU's addressing registers and that kind of stuff, and while I managed to learn the syntax, even write some asm code, it was all really confusing to me. And only few years later on Un…

It's helpful to realize x86 assembly is not what's executed by the machine; machine code is. One assembly instruction, e.g. ADDL, is translated to several different machine code instructions depending on the destination, source, and addressing mode.

Re: Learning to Read X86 Assembly Language

#52
post #49

To understand assembly it really helps to know at least something about how computers work on a low level. When I first tried learning it (long time ago, in a high school) I had no idea how computers really work on such a low level, how CPU's addressing registers and that kind of stuff, and while I managed to learn the syntax, even write some asm code, it was all really confusing to me. And only few years later on Un…

Yeah stuff like dma isn't getting enough attention in a lot of treatments of the subjects. Also in/out instructions (did you ever consider how a CPU talks to a HDD)?

Re: Learning to Read X86 Assembly Language

#53
post #45

Earlier quoted context omitted.

I never felt more like stabbing myself than when trying to cipher out exactly which immediate values are possible on ARM, and which are not. X86 I happen to enjoy. It is not "the worst ISA" by any means. It has wonderful code density, which turns out the be very important. There's a reason that x86 won and continues to win.

> There's a reason that x86 won and continues to win. It is definitely, definitely not the ISA.

Ok.

It is though.

Re: Learning to Read X86 Assembly Language

#54

x86 is the worst ISA. If you want to play with assembler without feeling a desire to stab yourself and end it all, I recommend ARM. Or go learn Z80, x86's weird, 8-bit cousin (it had a 16-bit version, but it sold poorly), which had a greater emphasis on backwards compatability (you can run code from the original 8080 on a Z80, unchanged), and is nicer to work with (because it wasn't extended in unticipated directions…

I agree that the x86 ISA is pretty warty (though I have a strange fondness for it), but I'd recommend 6502 rather than Z80. There are a lot of fun retro-computer platforms that are 6502-based. Thinking of the zero-page functioning as a register-bank is really fun, too.

Re: Learning to Read X86 Assembly Language

#55
post #5

Excellent article that has context around the how and why, which I appreciated. Pat has a great "explorer" writing style. I was going to post this last night but figured it must have been posted already. I was wrong! Nice to see it ok the front page.

Thank you! Knowing that people enjoy reading this sort of thing makes it worthwhile.

Re: Learning to Read X86 Assembly Language

#56

This is the first time I actually read all the way through an article on assembly. It was nice and concise. Granted, I'll probably forget this until the next article (due to focusing on other studies), but thank you none the less.

Thanks! Glad to hear you made it to the bottom :) I always worry that I tend to write on and on for too long.

Re: Learning to Read X86 Assembly Language

#57

Nice article! It take a subject that is scary for many and does a great explaining a little bit very clearly using good visual aids. I look forward to the next articles!

Thanks a lot. I'm looking forward to writing it, I think it will be interesting.

Re: Learning to Read X86 Assembly Language

#58
post #49

To understand assembly it really helps to know at least something about how computers work on a low level. When I first tried learning it (long time ago, in a high school) I had no idea how computers really work on such a low level, how CPU's addressing registers and that kind of stuff, and while I managed to learn the syntax, even write some asm code, it was all really confusing to me. And only few years later on Un…

It's helpful to realize x86 assembly is not what's executed by the machine; machine code is. One assembly instruction, e.g. ADDL, is translated to several different machine code instructions depending on the destination, source, and addressing mode.

Can you point to a source for this? All x86 assemblers that I know of map one assembly instruction to one machine instruction.

Re: Learning to Read X86 Assembly Language

#59
post #13

Earlier quoted context omitted.

I'm not sure everyone has to learn even that much. I've managed to avoid it until very recently and I'm more willing to dive into underlying code than most people I know (I've contributed to a FreeBSD kernel patch in TCP and an OpenSSL key exchange interoperability fix)

I haven't jumped into the kernel yet. But I'm only 15. I still have time.

This is not a piss contest.

Re: Learning to Read X86 Assembly Language

#60

Earlier quoted context omitted.

I'd recommend learning 68k instead. Or MIPS. But definitely Z80 over x86. x86 is pain.

I wish 68k, but it's out of production (as is the 6809, its equally awsome 8-bit cousin). MIPS and ARM are fun, though, AFAICT. As is 6502.

(author here) ...FYI I actually learned assembly language for the first time back in the 1970s and 80s using a 6809 inside a Radio Shack "Color Computer." I was super-fun at the time. I don't remember much of it now but I'm sure x86 isn't as clean or fun as 6809 assembly was.
Post reply on HN