There was an informal, ongoing contest within DEC, though perhaps only within the PDP-8 group (*), to write code that would completely erase one 4k memory bank completely to zero, running the self-destruct code in that very same memory bank. (So the code had to, in the end, destroy itself too, leaving only zeros behind).
(*) The PDP-8 had a handful of, special memory locations that auto-incremented after you read them.
Well, instruction 000 is AND with AC. So, what ever is left in AC will be masked by zero, clearing AC, and then all over again to eternity (or the machine is switched off, whatever happens first). So, necessarily, AC will be cleared as well, as a bonus.
Let’s say the details are: target a “Straight-8” meaning the very first PDP-8 made with discrete transistors, with no fancy new instructions, and exactly 4096 words of core memory. Hint: use the auto-increment memory locations (0010 through 0017 octal) to simplify and shorten the software (that you probably did have to toggle in by hand). Maybe even do something nuts like overlap the program with the auto-increment locations so the program is self-modifying. Though maybe first we should have a discussion about: dereferencing an auto-increment location via an instruction fetch, does it auto-increment? (again, on a “straight 8”)
Auto increment here is tricky, the last instruction in the field must be DCA I 10
and 10 must be 7777 to zap out the DCA I 10 @ 7777 and clear location 10.
ED. can we post this to a new thead?
My intuition has me worrying less about the top of the field. I’m assuming PC=7777 wraps around to 0000. My first-stab strategy would be to clear the bulk of the field “the easy way,” from almost-bottom to top, then wrap around to the very bottom (page zero), and finally, perhaps with entirely different, but more clever code, delete self. Pretty sure there is a solution. I bet it’s short.