On page 43 of the October 1978 Dr. Dobb's Journal (reprinted in Volume 3 Page 425 Issue 10 Number 29) is a letter to the editor giving three 6800 routines to clear ALL of memory, stating...
Routine 1 (8 bytes): fill memory with NOPs. Properly
assembled, this routine will execute anywhere in memory.
2000 8E 20 03 LDS #STACK
2003 86 01 STACK LDAA #NOP
2005 36 PUSH PSHA
2006 20 FD BRA PUSH
Routine 2 (5 bytes): fill memory with zeroes. This routine
must reside at the addresses shown, and assumes that executing
an opcode of zero is identical to executing an NOP.
FFFB 8E FF FD LDS #HERE-1
FFFE 8D FE HERE BSR HERE
Routine 3 (8 bytes): fill memory with ones (all bits on).
This routine must reside at the addresses shown.
FFF7 8E FF FA LDS #THERE
FFFA CE FF FF THERE LDX #HERE+2
FFFD 8D FE HERE BSR HERE
Assuming that every location in the address space acts
like RAM (ie, can be read, written, and executed), then all
three routines fill ALL of memory, obliterating themselves
in the process.
Can anyone confirm this code really works as advertised, given the stated constraints?
(The Letter itself is a comment to an 8080 memory clear routine in DDJ of September 1976 Page 32, left column, all the way down)
PUSH
at address 2005 is a label, and so it belongs in the other column