by KeriWarr · 12y ago · 0 comments
00000011
00000100
00000000
00000001
Looking at this, I expected that it would read line one, then move the value addressed by line two to the value addressed by line three. i.e. set the instruction pointer to 00000001. This didn't work. What did was:
00000000
00000000
00000000
00000011
00000111
00000000
00000001
This program advances to line 4 then remains there. Could someone explain why program two is an infinite loop, but program one isn't? Thanks!
If you modify the last line to "11111101" then when the instruction pointer is increased by 3 it will overflow back to 00000001 and you will get your infinite loop.
The problem is that it moves that value into the instruction pointer, then the instruction pointer increments itself by 3.
the instruction pointer always increments itself by 3 after every instruction.