Re: A design rule for WP34s library software? Message #2 Posted by Walter B on 14 Aug 2011, 3:45 p.m., in response to message #1 by Dieter
Thanks for raising this topic. There are no standards yet, but the following may form the base for a discussion here: Quote:
- Which registers can be used or should preferably be used? Some (most? all?) lettered registers are used for internal purposes ...
All of them have a specific use: please see the first page about "Memory" in the manual. So I don't recommend using these nor the ones employed for statistics if you want to avoid interfering with such commands. Beyond those, feel free to chose whatever registers you like. I think it's good practice to document them in the program header.
Quote:
The same goes for flags.
No user flags but the lettered ones have a specified meaning so far. So here the door is wide open for you. Enjoy (but document)!
Quote:
What about the stack? Consider the quadratic solver. X, Y and Z hold the coefficients, so do we need to preserve the higher registers on return?
Depends. I'd vote for some cleanup at the end of a routine. E.g. if a routine uses X, Y, and Z for input and X and Y for output, then it shall work in a 4-level stack like shown below:
Stack level Content at start ... at end
T t t
Z input parameter 3 t
Y input parameter 2 result (part 2)
X input parameter 1 result (part 1)
I leave it as an exercise to transfer this to an 8-level stack ;-) Remember the commands STOS and RCLS.
Quote: What about initializing modes and handling/changing modes inside library software? For instance, software using trig functions should either use the current angular mode and, if necessary, convert angles to this mode. If modes are changed during the library call, they should be reverted to the original setting before return. The same goes for stack mode, display settings, etc.
I concur. STOM and RCLM will help in hosekeeping.
Quote: What about documentation? What information is mandatory, what is optional?
I can't force anybody to document what (s)he does in his/her routine, but I'd welcome documenting registers and flags used as well as input and output. With the housekeeping suggested above, nothing more will be necessary IMHO.
What do you think?
Walter
|