Hacker News new | past | comments | ask | show | jobs | submit login
Reversing for dummies – x86 assembly and C code (Beginner/ADHD friendly) (0x44.cc)
124 points by wglb 10 months ago | hide | past | favorite | 36 comments



Maybe it’s just my pattern matching brain and current interests noticing this more, but there seems to be an uptick in content that bridges the knowledge gap between assembly and higher level languages, and that’s been awesome for someone diving in at this later phase of my career.

As a self taught developer, I tried to learn “bottom up”, i.e. starting from low level concepts in my early teens. Everything I tried to learn bounced off of my brain, and what really got me going was picking up Python, and later Ruby (not rails) in the early 2000s.

This eventually grew into a successful career, and I spent most of my professional life not really knowing much more than the general gist of lower level stuff.

More recently, I decided to go back to trying to learn this and it’s like discovering a whole new world. 20 years of coding gave me great intuitions for higher level code, but left all of these unanswered questions about how it works at a lower level. And it’s making me fall in love with code all over again, because now it all makes so much sense, and answers these questions I sometimes forgot that I had. Taking this a step further and going down to the level of circuits is even more mind expanding, and has been a joy.

If you’ve been coding for a long time and this all seems hard to imagine breaking into, all I can say is: try again! You might be surprised at how much easier it will be now.


If you have not encountered it yet, I highly recommend Ben Eater's 8-bit computer series (https://eater.net/8bit/). I don't remember any other piece of material which made me grok the deep underpinnings of CPU instructions as this. There was an almost surreal moment where my brain went "ooooooh, this is how a CPU instructions is just a complex network of switches with on/off states". Ben Eater's other material is also great, he's just a good teacher.

Building on that, the "NAND2Tetris" starts, as the name suggests, with basic logic gates and packages these low level concepts Matryoshka-style into recursive boxes with the end goal of programming a Tetris clone. See https://www.nand2tetris.org/


I’m deep down the Ben Eater rabbit hole and enjoying it thoroughly.

His “Hacking a weird TV censoring device” [0] video is an incredibly fun watch, and what made me an instant subscriber.

Currently working through his 8-bit series and planning to build one at home.

- [0] https://youtu.be/a6EWIh2D1NQ


Oh … I bought one kit for my hotel q for 2 weeks. The rule relaxed and hence no time for that. Should get it out to do after dust for 2+ years


I've noticed the same, and I'm equally happy about it. I was also self-taught. I began teaching myself web dev around 2009 and have been doing it ever since. A few times here and there, I tried to learn the lower level stuff, but it's very daunting outside of an academic setting.

In the past year, however, I've really tried to change my attitude. My 2024 resolution is to gain a baseline level of competency down to the assembly layer at least.


That's a long brave path you had.

From my experience, once you understand the "bottom/low level", you will go back to the "up/high level".

I studied and used at university Assembly language and C (and C++) and I am not willing to write an e-commerce application with ASM 80x86


A big part of my interest is because I want to tinker with electronics projects, and I’m curious about embedded work. I love that there’s an ecosystem of chips and boards that make this easy, but I realized I’d love to be able to crack open e.g. a broken Commodore 64 and know enough to troubleshoot and repair it. Or use smaller microcontrollers for use cases that don’t really require an entire OS.

Beyond this, I think a lot of human thinking is inherently limited by the higher level abstractions we impose on the world, and so while I’d never attempt to write an e-commerce app in assembly, I’ve grown to appreciate the value of understanding the whole system and the wider set of options and deeper intuitions available to me as a result.


Electronics ... I understand you in this case.


not a criticism here, just a genuine question. What about this makes it friendly for ADHD? Is it a formatting/style thing? Information ordering?


Diagnosed with ADHD here, there's nothing ADHD friendly about this imo. I'm REALLY into reverse engineering content and I just bounced right off the GIANT WALL of text at the beginning.

It's presented in a highly linear conversational fashion but the data doesn't appear to need to be linear. I absorb things in a non-linear fashion (I jump around, sometimes I even read/skim things backwards and out of order.) So it could easily be made ADHD friendly with clear delineation between ideas. A really simple way to do this would be surrounding definition blocks with a slightly lighter background color box and sticking strictly to necessary data, not using conversational language.

Also the color scheme sucks (or rather is non-functional at least to me.). The blue text words really stick out, but the white bold text is what's important. However it also matches with the headers since they seem to be the same font and color, it's really distracting for some reason. Under assembly instructions specifically: like all I see is "value, register, destination, source, destination, expression, destination, destination, destination,..." literally the least important information is highlighted.

The sidebar on the left is distracting too and pulls my eye constantly.

Equating Beginner with ADHD is also mildly offensive and defeats the point if this is targeted at people suffering from ADHD. People with ADHD dive head first in the deep end or not at all, no exceptions. If it's labelled beginner/for-dummies, I'm skipping it or at best skimming it (like i did with this).


ADD/ADHD diagnosed for >30 years now and I was actually curious if some new ADHD friendly web format had been discovered after my years in web engineering, turns out the answer is no.


Like most accessibility issues, this cannot be solved with a format, only with care on the author’s behalf.


The chunking and labeling of concise, strictly topical content and illustrative examples rather than having paragraph-after-paragraph of exposition is a huge factor for my flavor of ADHD, though we're obviously not a monolith. For contrast, lots of folks love the expository format of the Python docs which explains a lot about why things work rather than simply how they work, but that setup is absolutely murder for me. My brain is screaming at me after skimming the first two paragraphs to see if I'm even looking at the right doc, and I'm hitting google or stack overflow 3 seconds later. It's not a good strategy-- I definitely consider it a shortcoming-- but other doc systems work much better for me. For example:

C# regex docs: https://learn.microsoft.com/en-us/dotnet/api/system.text.reg...

Java regex docs: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pa...

JS regex docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

PHP preg_replace docs: https://www.php.net/manual/en/function.preg-replace.php

Python regex docs: https://docs.python.org/3/howto/regex.html

Which one of these is not like the others? The Python docs are brilliant for people that click with that style, and as we can see from this well-shared and very controversial piece, (http://cryto.net/~joepie91/blog/2013/02/19/the-python-docume...) suck for others.

Edit: As usual when the Python docs usability is questioned, cue the "well I've got ADHD and I just LOVE the Python docs" (said in the voice of the 'Well I LOVE SPAM' guy from the Monty Python skit). Sure, but you aren't some sort of standard by which others are measured.


Thanks for pointing this out. I had never really thought much about it. I 100% agree with you! The docs are totally why Python is so comfortable for me.


I know so many people that so love them, and I do find the content useful sometimes... but I wish they could be modified a bit to have the deep dive after the really concise reference sheet style doc.

But almost any time I've seen them discussed, even intimating that they're not ideal in their current state is an open invitation to summoning the online equivalent to a pitchfork-wielding crowd implying you're incompetent, lazy, and stupid for having a different usage style. I'm sure there are a lot of people involved who want nothing more than for them to be as useful as possible to everyone who needs them, but those toxic dynamics emerge so quickly in critique. It would obviously be a huge mistake to simply remove that info, but I think the format could be enhanced to work well with other usage styles.


(C# documentation tends to have both types, the API description itself, and expository articles that introduce you to it e.g. https://learn.microsoft.com/en-us/dotnet/standard/base-types... )


As much as they annoy me, I think MS doesn't get enough credit for their dev docs. MDN has some more expository docs in addition to their great reference pages, too. They're super useful, but having them combined can be a real struggle for folks that have difficulty harnessing their attention.


Given the context of conversation, just noting that I too have ADHD and writing in C# has been definitely more doable than dynamically typed languages (or languages that require a lot of code to express something LINQ allows me to do in 1 or 2 lines, like Go). And as long as you know the type for the feature you need, you can usually just write e.g. "Regex" and press `.` and the VS Code or any other IDE of your choice will show you the list of supported methods - most of them are really straightforward to use. It works really well and knowing I don't have to perform much of work to ensure what amounts to type safety manually, or write additional tests, has been really helpful.

More on C# Regex, extra props for source-generated Regexes also generating documentation to explain the exact pattern and how it is matched similar to how websites like regexr do it.


I despise python documentation for this reason. When I want to reference the docs on how to do something I have to cut through huge paragraphs of unorganized and unstructured text to just find out how to do something. It doesn’t help that different builtin modules use different documentation layouts and formatting either.


Yeah I can see why a lot of people love it, but it's fundamentally anathema to the way I use docs. Considering how common other reference formats are, I can't imagine it's rare among developers, but I'm not sure. I'd love to do a usability study. Modern accessibility guidelines implore taking neurological differences into account with web content, but if it's not easily measurable or even a bit subjective, it's not going to get budgeted for in most cases. I imagine without expert advice, even gauging whether or not you've got the right approach is difficult.


At least for me: short sections with emoji, varied formatting, etc provide anchors for me when I loss focus and come back.


IDK. I think sometimes people lean into the idiosyncrasies of their own ADHD. I have ADHD, but I get sucked into writing code because it lets me focus in a way that dishes and laundry do not.


> What about this makes it friendly for ADHD?

Maybe because each section is short and straight to the point?


Isn’t it just friendly for any human?


Another way to look at this is that a lot of content is not well organized.

For some people, this is an inconvenience. For some people, this makes the content impenetrable.

In a learning context, most people benefit from better organization and concision. Some people benefit significantly more than others, and they’re called out here.


Some people are definitely turned off by a terse writing style. If nobody enjoyed long and verbose writing why is there so much of it?

For the record I do think putting ADHD friendly in the title is a little silly.


I was just skimming this and I thought there were easy ways of decompiling into C source as well with generated function names like a, b, c or whatever. Could one just dump that sort of minimized C code into an llm and have it generate variable and function names maybe? I'd be curious to see if that worked.


IDA and Ghidra, which they mention at the bottom, along with Binary Ninja which they didn't, have decompilers that will output C source-ish from compiled assembly. Variables and functions without symbols in the binary are just given unique non-meaningful names. There's a lot of AI-powered extensions for them now trying to automate the reverse engineering process of giving them meaningful names, but IMO they are completely worthless and of negative utility - they're either so high level they just reiterate what the assembly is doing but in English, or are wrong and make up explanations for nearly every name that are incorrect and take more effort to correct than they save.



Some software might even get more readable by using minification and this tool afterward :-D

At least it would bring some normalization to variable and function names.


I had the same thought. Couple it with a source fuzzer to generate a large training dataset of valid source, and you could make a very nice disassembler.


If you are interested in reversing but don't know much about it, including the tools, I made an small plugin for `radare2` that you can ask it questions, it runs the commands and explains you what you need. [1]

The functionality has also been merged into the bigger `r2ai` tool and supports anthropic and local LLMs as well. [2]

[1] https://github.com/dnakov/r2d2

[2] https://github.com/radareorg/r2ai


I don't really appreciate this form of pandering honestly.

Edit: ADHD in software isn't about being able to read blog posts, we don't need blog post labels. It's about surviving our mindless bullshit one-size-fits-all corporate culture that demands perfect organization of pointless tasks and butts in seats at all times....just like our mindless bullshit one-size-fits-all school system.


here something from the few things left from Fravia's stuff:

https://web.archive.org/web/20190917072736/http://www.woodma...


I made it about 20% before having a panic attack... formatting seems adversarial


As someone with adhd I do.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: