TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An Introduction to x86_64 Assembly Language

193 pointsby hackeradam17about 11 years ago

19 comments

majikaabout 11 years ago
This seems like a great start, but it&#x27;s lacking something that every assembly programming resource that I&#x27;ve ever come across lacks too:<p><i>How can I experiment?</i><p>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?<p>Beyond that, what are good applications of assembly in general? Where should I use it in my day-to-day development projects? Where can I read about best practices? Where can I find good examples of x86_64 assembly programming?<p>It&#x27;s really easy to merely describe the instructions, the registers, the mapping from compiled procedural languages - but I feel like that information is superficial so long as you don&#x27;t tell us how to apply it.
评论 #7425409 未加载
评论 #7426621 未加载
skywhopperabout 11 years ago
This is a great resource, and the following is not a criticism, but an observation.<p>What I&#x27;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.<p>I first learned 8086 assembler from Peter Norton&#x27;s book (<a href="http://www.amazon.com/Peter-Nortons-Assembly-Language-Book/dp/0136619010" rel="nofollow">http:&#x2F;&#x2F;www.amazon.com&#x2F;Peter-Nortons-Assembly-Language-Book&#x2F;d...</a>), and more than any other resource, that taught me about how things actually work. It goes beyond just knowing the registers and the mnemonics and explains in a fantastically clear way all the implicit work that&#x27;s going on behind the scenes, even in assembly code. From the stack to data segments and direct video control, I learned more about how computers work from this book than from my entire college Computer Science program. And I didn&#x27;t even have an assembler to actually try any of the code at the time I read it.<p>I&#x27;m not sure if the book would still hold up from a practical perspective, as it does focus very much on MS-DOS-specific interrupts. So what I wonder is... is there a similar resource available today for learning what&#x27;s going on behind the scenes in the modern 64-bit CPU on modern OSes?
评论 #7423638 未加载
评论 #7424238 未加载
评论 #7425681 未加载
评论 #7427282 未加载
nkurzabout 11 years ago
<i>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.</i><p>Does anyone who regularly writes assembly really believe that it&#x27;s difficult to write better code than a modern compiler? This isn&#x27;t my experience at all. Instead, I&#x27;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&#x27;s hard to beat a modern compiler, but that it&#x27;s rarely worthwhile.<p>It&#x27;s almost as if there is some compiler-writers-protection-racket out there that threatens anyone who doesn&#x27;t bow to the powers of the modern compiler. The wonder isn&#x27;t that they generate perfect code (by and large, they don&#x27;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.
评论 #7427671 未加载
crussoabout 11 years ago
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.<p>x86_64 is just plain ugly. While I admire the backward compatibility, it&#x27;s sad that this nasty-looking architecture won out. I&#x27;m really glad that the compiler handles it.
评论 #7426925 未加载
评论 #7427206 未加载
评论 #7427614 未加载
评论 #7426962 未加载
wedesoftabout 11 years ago
I am trying to develop a JIT for array processing [1]. Here are some resources I found useful so far<p>* Dr Paul Carter&#x27;s tutorial [2]<p>* Intel processor reference [3]<p>* C ABI standard [4]<p>[1] <a href="https://github.com/wedesoft/aiscm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wedesoft&#x2F;aiscm</a><p>[2] <a href="http://www.drpaulcarter.com/pcasm/" rel="nofollow">http:&#x2F;&#x2F;www.drpaulcarter.com&#x2F;pcasm&#x2F;</a><p>[3] <a href="http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html" rel="nofollow">http:&#x2F;&#x2F;www.intel.com&#x2F;content&#x2F;www&#x2F;us&#x2F;en&#x2F;processors&#x2F;architectu...</a><p>[4] <a href="http://www.sco.com/developers/devspecs/abi386-4.pdf" rel="nofollow">http:&#x2F;&#x2F;www.sco.com&#x2F;developers&#x2F;devspecs&#x2F;abi386-4.pdf</a>
评论 #7424671 未加载
rjzzleepabout 11 years ago
i always thought the art of assembly is the de facto bible [1]<p>personally i had all these books and never really cared too much about them in the end is was having a c compiler and a good disassembler - ida at that time - that made me learn it.<p>here&#x27;s the free copy of ida 5 [2]. i think it doesn&#x27;t do 64 bit, but it&#x27;s good enough, and works perfectly fine in wine on both osx and linux. you can always use biew&#x2F;hiew&#x2F;olly etc, or more recently hopper, but i think for learning ida is still hands down the best choice<p>do a string copy see what it does. make a function notice how it always starts with<p><pre><code> push ebp mov ebp, esp ... pop ebp ret </code></pre> make a switch statement, see what it compiles too(ida annotates it beautifully).<p>i commend the author for what he&#x27;s doing. a little improvement would be to reduce some of the text, and add some more examples, and some guidance on how to experiment.<p>another sidenote is that the code is basically the same as simple c code. c++ code even doing simple things, depending on what you link, and compile in, can be terribly confusing for a newbie to look at.<p>[1] <a href="http://portal.aauj.edu/portal_resources/downloads/programming/assembly_language32bit_edition.pdf" rel="nofollow">http:&#x2F;&#x2F;portal.aauj.edu&#x2F;portal_resources&#x2F;downloads&#x2F;programmin...</a><p>[2] <a href="https://www.hex-rays.com/products/ida/support/download_freeware.shtml" rel="nofollow">https:&#x2F;&#x2F;www.hex-rays.com&#x2F;products&#x2F;ida&#x2F;support&#x2F;download_freew...</a>
评论 #7424489 未加载
infoseckidabout 11 years ago
This could be of interest to someone: <a href="http://www.pentesteracademy.com/course?id=7" rel="nofollow">http:&#x2F;&#x2F;www.pentesteracademy.com&#x2F;course?id=7</a>
评论 #7423329 未加载
ditoaxabout 11 years ago
Learning Assembly language has been on my list of &quot;want to do&quot; for a long time now but as I have never had a need for it professionally I kept putting it off. I actually have time for myself now and outside of learning to cook properly and cycle a lot I would really like to finally tick this off my bucket list. The problem is I am not too sure where to actually start. I want something that starts from the bottom and teaches me about the CPU and goes on from there. I know what a register for example but I don&#x27;t <i>know</i> what a register is if you understand?<p>So is there a book or web resources that is really a beginners guide to assembly? I understand x86 is not the nicest place to start but I have an x86 CPU in my laptop and not much else so it is a better place to start that anywhere else really. Anyone got any advice?<p>NB: My background is very high level languages such as JavaScript and Python and not much lower level. A bit of C++ back in the 90s but that knowledge is long gone.
评论 #7431821 未加载
评论 #7427516 未加载
评论 #7426855 未加载
maccardabout 11 years ago
Are there any books available that someone could recommend for me to go down this route, specifically for hand crafting assembly routines inside my C++ programs. (note I&#x27;m currently only compiling for 32 bit). It&#x27;s something of interest to me, but I&#x27;ve never gotten around to it. I&#x27;m comfortable with ARM assembly, and have a solid enough understanding to proceed, but the references I&#x27;ve come across so far go as far as &quot;here&#x27;s how to embed a simple ASM snipped inside your code, now you know how to do it&quot; and then skip to &quot;copy and paste for specific routine&quot;. I&#x27;d like some exercises for in between stages, for stuff that might actually be worthwhile doing.
评论 #7426692 未加载
ilovecookiesabout 11 years ago
Read this book, it&#x27;s basically only hacking C code with assembly. <a href="http://www.amazon.com/Hacking-The-Art-Exploitation-Edition/dp/1593271441" rel="nofollow">http:&#x2F;&#x2F;www.amazon.com&#x2F;Hacking-The-Art-Exploitation-Edition&#x2F;d...</a> It also covers topics such as TCP sockets and the likes. If you ever want to become a real hacker it&#x27;s your best starting point.<p>And the world was never the same again.
kaspersetabout 11 years ago
Another Relevant book: ftp:&#x2F;&#x2F;gnu.mirrors.pair.com&#x2F;savannah&#x2F;pgubook&#x2F;ProgrammingGroundUp-1-0-booksize.pdf
jtokophabout 11 years ago
Nice write up Adam. Just thought I would mention that your usage of former&#x2F;latter is backwards.
评论 #7426045 未加载
boohoofoodooabout 11 years ago
Big props to Creel ( What&#x27;s a Creel? ) , I encourage you work through his video tutorials if at all interested in x64<p><a href="https://www.youtube.com/playlist?list=PL0C5C980A28FEE68D" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PL0C5C980A28FEE68D</a>
hackeradam17about 11 years ago
From seeing some of the suggestions here I think I will extend this with two more articles:<p>1) Some more detail about how the low level of the computer actually works 2) A more &quot;beginner friendly&quot; guide to getting started in programming assembly.
fleshweaselabout 11 years ago
Reading the examples is a little clunky because I have to scroll up to the dictionary every time I see a word I don&#x27;t remember from skimming the list. Which is often.
arcadeparadeabout 11 years ago
I enjoy the 68k tutorial: <a href="http://mrjester.hapisan.com/04_MC68/Index.html" rel="nofollow">http:&#x2F;&#x2F;mrjester.hapisan.com&#x2F;04_MC68&#x2F;Index.html</a>
userbinatorabout 11 years ago
It&#x27;s nice to see the &quot;correct&quot; order of the registers being used. (The reason for this ordering is in the realm of trivia questions.)
评论 #7427727 未加载
nemasuabout 11 years ago
This is great. I&#x27;m all for something that gets people into assembly. It seems to be a lost art these days.
sixothreeabout 11 years ago
Lots more examples would be very helpful.