It always amazes me how this is not the first thing taught in a CS class. It always makes people have Eureka moments whenever I show this to people...
(also not me calling the program counter the stack pointer because stupidity)
In case you are wondering at the LOAD 200, 0 JUMP 0 part of the program, this basically just exploits the fact that the memory is initialized with zeros and we can get a zero by just loading some address that hasn't been touched yet. Jumping to that value, will reset the program counter (unfortunately called stack pointer in this code due to brain damage) back to 0 to restart the program, creating an infinite loop, which this program aims for.
@mike64_t Usually the first thing taught in a computer engineering course in EE depts
@mike64_t honestly writing a little 6502 emulator is a great way to get into CS
@mike64_t lol this was the easy part, implementing instruction bubbling/optimizations was the nightmare
@mike64_t This reminds me of Feynman's attempts to teach physics "from first principles" to kids who didn't learn physics yet, which didn't work well. It did work for anyone who was taking a second pass through everything. Because then they have the context of "why" and where it goes.
@mike64_t This is the first thing thet taught me and i hated it. It becomes mindblowing only after you learn a lot more
@mike64_t @ethananam imagine hating students so much the first thing you’d teach them is assembly.
@mike64_t For the right kind of student, this would be a great introduction, but immediately going meta (writing programs that simulate computers executing programs) would confuse the shit out of many.
This low level stuff is not THAT helpful and should be abstracted for like 90% of developers. If performance needs to be studied down to this level of granularity is needed, you’re probably part of the 10%. If this was the first thing I saw in class, I would change majors immediately.
@mike64_t I think you are more appreciative of it when you learn it after.
@mike64_t This is the first thing taught in a CS class in my university I’m not really sure this improves understanding unless you want to go low level later on
@mike64_t You’re teaching how computer handles instructions, but not how to translate thought to these formats (e.g. stacks, recursion, loops, etc). Someone with no knowledge ahead of this explanation could easily get lost. SICP is the best book I’ve seen do this so far