3 ms·
Can some way more experienced than me ELI5 why the inner loop part was so clever? I'm the most novice of programmers and have never touch anything remotely like
by account-5 4y ago
Can some way more experienced than me ELI5 why the inner loop part was so clever? I'm the most novice of programmers and have never touch anything remotely like pointers so feel I am missing the lightbulb moment the author clearly got. Many thanks.
- teddyh 4y agoFrom the wikipedia article: Eventually he realized that Kaye was using self-modifying code to process elements of an array, and had coded the loop in such a way as to take advantage of an overflow. Adding 1 to the address field of an instruction that referred to address x normally just changed the address to x+1. But when x was already the highest possible address, not only did the address wrap around to 0, but a 1 was carried into the bits from which the opcode would be read—in this case changing the opcode to "jump to" so that the full instruction became "jump to address 0". — https://en.wikipedia.org/wiki/The_Story_of_Mel https://en.wikipedia.org/wiki/The_Story_of_Mel
- jsymolon 4y ago>not only did the address wrap around to 0, ... Very reminisce of the 6502 "issue" of jumping with an address on a page boundary. Per Wikipedia: the processor will not jump to the address stored in xxFF and xxFF+1 as expected, but rather the one defined by xxFF and xx00 (for example, JMP ($10FF) would jump to the address stored in 10FF and 1000, instead of the one stored in 10FF and 1100). This defect continued through the entire NMOS line, but was corrected in the CMOS derivatives.