Assembly Is Sweet

I've been learning linux assembly in the past few, and it's fantastic. It's a billion times easier to write, the only problem being that you're writing in nano instructions. You can't just "print a number," you have to process digits one-by-one into a string of ASCII first. Which comes as a bit of a culture shock.

But I love the directness. Assembly is the primal animal of programming. It does what it's told, and that's it. It can't have "abstract thoughts" like package managers, software stacks, and so on. This is what makes it easy. It's also what makes it fun.

The feeling of it is hard to describe. I guess I would compare it to woodworking, which I do with hand tools. My favorite hand plane, a #4, I keep razor-sharp. In fact I learned to sharpen knives into razors because of my obsession with my hand plane. I know my pressure and speed can screw up a piece. And if I hadn't administered to the iron properly, it'll gouge. But there's no power tool that can do what a hand plane can. It can smooth the surface of wood to glass, almost like varnish, but softer to the touch. It can join pieces together with the kind of accuracy only a milling machine can do.

That's how I feel about assembly.

It took a while to get used to it, though. I reached for "high level" solutions when in actuality the answer with assembly always tends towards simplicity, not complexity. I started out creating space to hold command line arguments, used all kinds of pointer stuff... and then I realized I could just pop the stack and be done with it.

[insert headsmack.gif]

After I realized that "abstraction" is the enemy down here, things got much easier. Natural, even. For example, I wanted a program that could slow down a scriptreplay. Instead of searching for some package or git project, I created my own .asm in a flash. It felt pure, speaking frankly to a computer. Sleep for some nanoseconds, write the next byte, keep going. It was a veritable breeze.

People say assembly is hard but they haven't tried it, not really. Maybe they're confusing "tedious" with "hard." Hard is something you must spend lots of effort to barely accomplish, but tedious things are easy -- they just take a long time.

And so it is with assembly. But to me, it's not tedious. Tedium is looking up the docs for every single CSS instruction because it does one thing in THIS context but another in THAT context. It's such a waste of time. But when I go into assembly, I'm at my workbench, it's just me and a hand plane, communing with the wood, one push after the other...