|Re: NOP Revisited|
Message #17 Posted by Andrés C. Rodríguez (Argentina) on 28 Aug 2007, 10:14 p.m.,
in response to message #16 by Jeff O.
One use of NOP is as a placeholder for a "to be entered" routine, because the HP25 had absolute addressing (GTO stepnumber), no labels, and no automatic renumbering of steps via insertion/deletion. For instance, in the Newton´s Method program to solve for f(x)=0 (a very primitive solver program), there were some steps where f(x) was to be coded, the remaining steps (if any) were filled with NOPs. Also NOP may be a replacement for a debugging-time PAUSE: after testing your program, you replace the PAUSE with NOP to obtain faster execution, albeit without the intermediate results display. And NOP also may be used to "fine tune" the execution speed of a program. For instance, the program
07 GTO 01
ran after filling the stack with "1"s, worked as a timer on my HP25. Certainly not quartz-based, but the display showed the elapsed time (in seconds) between two R/S presses.
In more modern machines NOP was not needed, but sometimes you may want to use a ISG or DSE function to increment a register without testing and branching upon the result. Since NOP was no longer an option X<> ST X was a good substitute, as close to neutral as possible.
Edited: 28 Aug 2007, 10:15 p.m.