cottrell@nbs-vms.ARPA (02/12/85)
/* > Now, who remembers the one-instruction core clear? > > Dick Smith ..ihnp4!wlcrjs!rhesmith mov -(pc),-(pc) ; .word 014747 jim */
hal@cornell.UUCP (Hal Perkins) (02/15/85)
>> Now, who remembers the one-instruction core clear? > >mov -(pc),-(pc) ; .word 014747 Ok, you got the easy one. Now here's the harder version of the question. Write a PDP-11 assembly language program that will set ALL of memory and all of the registers (except, possibly, for PC) to the value ZERO. I'll post an answer in a week or two if nobody gets it. (Yes, there are at least two solutions to this.) Hal Perkins UUCP: {decvax|vax135|...}!cornell!hal Cornell Computer Science ARPA: hal@cornell BITNET: hal@crnlcs
cottrell@nbs-vms.ARPA (03/05/85)
/* >> Now, who remembers the one-instruction core clear? >> >>mov -(pc),-(pc) ; .word 014747 > >Ok, you got the easy one. Now here's the harder version of the >question. Write a PDP-11 assembly language program that will set ALL >of memory and all of the registers (except, possibly, for PC) to the >value ZERO. I'll post an answer in a week or two if nobody gets it. How about: clr r0 clr r1 ... clr sp mov (pc)+,@sp ; copy next instruxion jsr pc,-(pc) ; to loc 0 jmp @sp ; execute it The one instruxion repeatedly executes itself, pushing the return address (zero) onto the stack, first at 177776, all the way down to 000000. Core is cleared. Finally, the zero at location 000000 is executed, which is a halt. PC=2. That was fun! jim cottrell@nbs */
cottrell@NBS-VMS (03/12/85)
/* > Close, but no cigar - at least on my 11's. The push on the stack at > 177776 gives a bus timeout trap, the attempted push to service the trap > does different (processor-type dependent) things. Like make an emergency > stack at 4 and push 2 words on it (11/40, 11/23). I didn't try it on an > 11/2, but I know that it would fatally hang an 11/20 with a double bus error. What you say is true. The pdp-11 has an I/O space in the last 8k bytes that is not going to act like memory. The first 400(8) bytes are also special to the processor but will probably act like real memory. However, permit me to make a few assumptions about the environment I am executing in. Both this `program' and the one-instruxion clear core `move -(pc),-(pc)' are executing in user virtual space with all segments mapped to real core. Neat machine either way. jim cottrell@nbs */