One other point about EXCH/SWAP instructions: Over the past decades I've played with these kinds of instructions via Common Lisp's "ROTATEF" function: (rotatef (aref array i) (aref array j) (aref array k)) does a circular permutation (rotate left, I believe): array[i]<-array[j]<-array[k]<-array[i] Common Lisp places no requirement that these locations come from the same array; I merely did this to indicate that this was a "location" type of function akin to "SETF", rather than a "value" type of function. This made a lot more sense on the Lisp Machine, where rotatef could be an actual *function*, rather than just a very smart *macro*. Of course, Common Lisp's rotatef can take any number of arguments; 0,1 are no-ops; 2 is SWAP/EXCH. I have found the 3-argument version of rotatef perhaps the most useful for playing around with linked lists. I'm curious why this was never noticed by Knuth & others. Perhaps I'm the only one in the Lisp community that has ever used this rotatef feature? At 11:15 PM 3/13/2018, Bill Gosper wrote:
Yes, JSP A,(A) . The PDP-6 had every imaginable subroutine instruction, jsp, jsr, jda, and, of course pushj, the latter as a sop to the Lisp community. Ironically, pushj turned out to be so fantastically useful that hardly anybody used the others. There was also UUO (unused opcode), which trapped to a uuo handler that could implement any kind of calling sequence you could dream up. It was sometimes possible to "outbum" pushj code using using jsp with an "implicit calling sequence". Instead of storing arguments after the jsp and then skipping over them upon return, you returned to the immediately subsequent instructions, which contrived to mention the arguments, which the subroutine fetched via (possibly multilevel) indirect addressing, with indexing at every level. Given the 16 triple purpose accumulators, it was usually possible to rearrange your steps to suit the expectations of the subroutine. And, of course, you could transmit multiple arguments in the accumulators. It was the greatest order code ever devised. --rwg
Also, I think HAKMEM mentions representing free storage as a linked list of exch instructions. (Talk about data execution.)
At the time, the machine was ridiculed for devoting an entire halfword (18 bits) to address memory, since nobody could need nor afford an entire megabyte. Instead of "Just you wait!", DEC mumbled meekly about symmetry.