There's another side to the coin
Yes, indirect addressing is a beautiful thing and I like it. I like it a lot. However, its power can blind people to faster, cleaner ways of doing things.
We have a sorter program which subtracts the same number from five hundred memory locations in a PLC-5/05 IF-THEN-JUMP loop. Aiming to reduce the program scan time of ~190ms, I teased this loop apart to where I understood exactly what it was doing. As stated above, the extensive use of indirection complicated this effort. Along the way I discovered that nearly 180ms of the entire scan time was devoted to this single loop!
Unacceptable!
I went to the instruction set reference (thank you, Ken Roach) and delved into
indexed addressing, never having had to use it in AB processors before. Luckily, for me, there is a spare 5/05 avalailable so I was able to set up a bench test model to experiment with (after accounting for all the missing I/O modules).
It took awhile but I came up with a version of logic which does the same as the original. There were some small modifications to other parts of the program but the end result was that the loop logic was greatly simplified and the time to execute the loop has been reduced to ~30ms
I can tell you, I was mighty surprised when I saw
that number in the average scan time box!
The original version manipulated and compared everything using indirection. It may seem counterintuitive but, my version uses the index register to bring out the value to be worked on in each iteration into a 'work word' so that manipulations can be done like so:
MOV #N14:0 N7:0 ( "#" denotes indexed addressing mode )
SUB N7:0 N40:6 N7:0
MOV N7:0 #N14:0
as opposed to the indirect method which looks like:
SUB N7:[N7:13] N40:6 N7:[N7:13]
where [N7:13] is the indirect pointer. There is a bit more going on than just the subtraction shown, but remember, this is just an example. I did a few other things too to cut execution time but they were minor compared to the addressing mode changes.
In a SLC-5/05, indirection exacts a heavy price in execution time. As a curious aside, the timing differs depending on whether the source or destination is indirect. Indexed addressing takes longer too than normal addressing but it's not as severe.
The point of this ramble is that as powerful as indirection is, it isn't always the best choice - one needs to investigate any other options as well.
To belabor a point I'll add this: Even my modified logic operates on two files to get the job done (255 word file size limit for SLC). I could redo the files and enable "index across files" which would allow further loop simplification and execution time improvement but it would necessitate
extensive changes throughout the program. Not worth it in my opinion. Now, if I were doing it from scratch...