In the PDP-11/05,11/10 computer manual (DEC-11-H05AA-B-D, section 10.5, page 10-3) DEC describes how the PDP-11/05 can execute short programs out of scratch pad memory (SPM or simply SP). Scratch pad memory is DEC's term for a small section of static RAM used to store the PDP-11 registers and other internal processor state.
The manual goes on to give a two instruction program that can be used to validate the basic operation of the processor:
Address Instruction Octal
177700(R0) NOP 000240
177701(R1) BR.-1* 000777
As noted in the text, the code is specially constructed to accommodate the unique behavior of the PC register when executing out of scratch pad memory:
When executing a program from the SP, the PC (R7) is incremented by one; however, BR instructions always modify the PC by multiples of two. Consequently, a BR instruction must be carefully used in a [SP] program to prevent the PC from being modified to an incorrect address.
In addition to validating the operation of the CPU, executing programs out of SPM can be quite useful for diagnosing memory issues, as it avoids the need to fetch instructions from potentially faulty memory. On my own PDP-11/05, I use the following programs (written by me but possibly invented by others as well), to repeatedly read or write a single memory location:
Continuously read a memory location
(Start execution at 177702)
177700 (R0) XXXXXX # Address of memory location to read
177701 (R1) # Scratch location
177702 (R2) 011001 # mov (R0),R1
177703 (R3) 000777 # BR .-1
Continuously write a memory location
(Start execution at 177702)
177700 (R0) XXXXXX # Address of memory location to write
177701 (R1) YYYYYY # Value to be written
177702 (R2) 010110 # mov R1,(R0)
177703 (R3) 000777 # BR .-1
EDIT:
Following up with a bit of related information: According to the PDP-11 UNIBUS Processor Handbook (link, Appendix A, page A-14), the PDP-11/05, 11/10 is the only PDP-11 model that can execute a program out of its general purpose registers.
bra -2
is a short program that fits into one register.bra
is not a PDP-11 instruction.br
?