Comment by wiether
2 days ago
I've been writing code since my teens, I've studied assembly... yet the fact that _things_ start happening when I press the power button on my computer are pure magic to me and I like it this way.
I started digging a few times, but, I prefer the "magic".
I prefer at least a superficial understanding.
Hopefully, there will never be a time when at least some folks are not reading books such as:
https://www.goodreads.com/book/show/44882.Code
Keats blamed Newton for taken the magic out of the rainbow with a prism. Personally I think the magic only got greater.
I'm genuinely puzzled by how you know enough about a system to even understand there is a basic assembly language, but still consider how "switching on" is 'pure magic'.
Doesn't the one explain the other ? It may be turtles all the way down, but at some point there's a fundamental turtle - be it LEA or CMP ?
Eh. The only real things you need are:
- On startup processing begins at a known address, and you put the bootloader code over there. Hardware engineers can guarantee this for you.
- Every time you execute an assembly instruction, the program counter either explicitly jumps to a new location or else it just increments by 1. Hardware people can also make this happen as easily as implementing an adder.
Don't get me wrong, there are LOTS of layers between the hardware and most "useful" programs any of us will ever write. But all of them are pretty understandable. They're often not very complicated, just tedious.
Similarly for making a basic CPU that implements the logic you’re describing. In 2006 or so I made a super simple microcontroller on an FPGA for a course project. It had a whopping 256 bytes of RAM, 1kB of ROM, and I think four 8-bit registers plus a 16-bit program counter. You could only jump +/- 256 bytes. It was largely useless but also incredibly satisfying.
turtles all the way down