V
11

I still think learning assembly first makes you a better coder, even after my project crashed 4 times last Tuesday.

I was debugging a pointer error in my apartment near Chicago at 2 AM and realized all those hours on 6502 assembly taught me exactly why the stack was corrupting, has anyone else found old-school skills saving them in weird spots?
3 comments

Log in to join the discussion

Log In
3 Comments
phoenix_grant
Right, but that 6502 zero page thing is exactly what saved me last week with a buffer overflow in some legacy code. The way that old architecture forced you to visualize memory as this tiny, physical grid just maps directly onto debugging C pointers, even in 2024. Like, I had this struct getting mangled and it clicked that I was treating the heap like I treated zero page back in the day, running past the boundary without realizing it. Sometimes the old mental models are just faster than firing up a profiler, lol.
5
simonk98
simonk981d ago
Oh man, did the same thing last week trying to track down a memory leak in a C program? I spent 3 hours on it before I remembered how the 6502 handled its zero page and suddenly I saw exactly where my array was writing past its bounds. The weird part is I haven't touched assembly in 15 years but that old way of thinking about memory just clicked again when nothing else worked. Those late nights counting cycles on a Commodore 64 really do stick with you in weird ways.
2
pat_roberts55
I mean, I gotta push back a little on that. Idk, I feel like those old assembly habits can actually make things worse when you're dealing with modern abstractions. Like, yeah, the 6502 zero page stuff is neat for C64 demos, but modern memory management is a whole different beast. Half the time when people bring up assembly tricks to debug C, they end up overcomplicating things. Maybe it's just me but I'd rather just use Valgrind or AddressSanitizer and save the 3 hours. Those tools are built exactly for this stuff, you know?
2