Live data from Hacker News

An Introduction to x86_64 Assembly Language

hackeradam17.com

21–30 of 56 posts

Re: An Introduction to x86_64 Assembly Language

#22
post #16
post #13

This seems like a great start, but it's lacking something that every assembly programming resource that I've ever come across lacks too: How can I experiment? How do I go from instructions in a text file, to compiling, to getting input in some form? What programs do I use (on Linux)? What commands do I run? What are fun projects that are worthwhile doing with assembly? Beyond that, what are good applications of assem…

You might like the assembly tutorial I am writing: https://plus.google.com/111794994501300143213/posts/9gxSUZMJ... It's focused on actually doing rather than how stuff works. In order to succinctly be able to present this, I had to choose a target platform, which unfortunately seems not to be the one that you prefer. My tutorial targets OS X, and there is great similarity between coding assembly on OS X and Linux. Th…

It would be cool if someone made a VM for development only, on which you could run x86_64 assembly, and get sensible error messages.

Re: An Introduction to x86_64 Assembly Language

#26
After learning 6502 assembly when I was a teenager, I was floored by the beauty and straightforward cleanliness of the 68000 used by Macs and then the similar assembly of the VAX.

x86_64 is just plain ugly. While I admire the backward compatibility, it's sad that this nasty-looking architecture won out. I'm really glad that the compiler handles it.

Re: An Introduction to x86_64 Assembly Language

#27

This is a great resource, and the following is not a criticism, but an observation. What I've found with most assembly language textbooks and online resources is that while the basics get covered well enough, the fundamental knowledge base is often skimmed over, as are the many assumptions and conventions that are made in how the CPU is supposed to work. I first learned 8086 assembler from Peter Norton's book ( http:…

Looks like the book is freely available - https://openlibrary.org/books/OL2197699M/Peter_Norton%27s_as...

Just a warning: the file I linked to is "broken" on account of needing Adobe Digital Editions and only one person (in the world?) can read it at a time.

Re: An Introduction to x86_64 Assembly Language

#29
post #13

This seems like a great start, but it's lacking something that every assembly programming resource that I've ever come across lacks too: How can I experiment? How do I go from instructions in a text file, to compiling, to getting input in some form? What programs do I use (on Linux)? What commands do I run? What are fun projects that are worthwhile doing with assembly? Beyond that, what are good applications of assem…

On Linux, you can use 'as', the gnu assembler, or you can also use nasm, which most people prefer over 'as'. I've used both, and I got used to 'as' syntax after a while.

I long time ago I wrote a threaded/fiber system for DOS. It was mostly C, but the task switching and interrupt stuff was all assembly. It's basically an implementation of setjmp/longjmp hooked up with timer interrupts.

You might use it in your day to day if you were a driver developer for something like PCI chipset drivers, network drivers, things like that. Even then, C is usually preferred. I worked for a company that wrote drivers for scsi jukebox systems and they had a compete software suite written in 100% assembly. It was very clean, modular, well commented, and even object oriented. Yes, you can have objects in assembly, you just have to make your own this pointers. Since the language itself is so limited, most good assembly programs have a lot of macro wizardry involved.

Re: An Introduction to x86_64 Assembly Language

#30
Sure, there are some applications in which we may need to squeeze every ounce of efficiency out of our programs, but in this day and age you’ll be hard pressed to come any where close to the code optimizations made by modern compilers.

Does anyone who regularly writes assembly really believe that it's difficult to write better code than a modern compiler? This isn't my experience at all. Instead, I'd say that with just a handful of tricks and a dozen hours practice you can speed up just about anything a compiler generates. The issue is not that it's hard to beat a modern compiler, but that it's rarely worthwhile.

It's almost as if there is some compiler-writers-protection-racket out there that threatens anyone who doesn't bow to the powers of the modern compiler. The wonder isn't that they generate perfect code (by and large, they don't), but that they can optimize as well as they do without introducing bugs left and right. The relative rarity of compiler bugs is the impressive part, not the speed of the code generated.

Post reply on HN