What does the command "MOV -(PC), -(PC)" do in PDP-11 assembly?
- User
What does the command "MOV -(PC), -(PC)" do in PDP-11 assembly?
Assistant
The MOV -(PC), -(PC) instruction in PDP-11 assembly is an infinite loop. It does the following:
-
-(PC) refers to the word at the address PC - 2, where PC is the Program Counter. This loads the word at PC - 2 into the accumulator.
-
It then stores the accumulator at the address PC - 2.
-
It increments the PC by 2 to point to the next instruction.
-
However, the next instruction is again MOV -(PC), -(PC). So it loads from PC - 2 again, stores to PC - 2 again, and increments the PC again.
-
This repeats infinitely, forming an infinite loop.
So in short, this instruction continuously loads a value, stores it back to the same location, and loops - forming an infinite loop.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.