Hello all.
Thanks to Willy Kunz and Cuvee I have HP's golden age on my iPhone
Working with RPN67/97 and RPN-65 has certainly revived my programming intrigue.
Over the last few days, I've been diving into the 67's Standard Pac Moving Averages program.
There seems to be a treasure chest of programming tricks, looping, and indirect addressing genius. I feel overwhelmed trying to mentally grasp each technique.
Has anyone broken down and dissected the program so as to provide a synopsis of what each subroutine does and how the program flows?
I have examined the paper tape TRACE mode to follow the sample exercise. After a while, I get lost on the app's flow.
If I can get a grasp on the programming, indirect addressing, and looping tricks, I can see I'll have quite nifty programming skills to learn about.
Perhaps some folks here can give me a detailed sketch of how the program flows and its indirect addressing tricks.
Thank you in advance
A complete analysis of how the program works, followed by a commented program listing, begins on page L01-01 of the HP-97 Standard Pac owner's manual. If you don't have a copy, I'd be happy to scan it into a hi-res PDF for you.
Thanks Joe.
I'd appreciate that. Although not neessaey because I do have, thanks to Vol. 7 of the Museum DVD, the 67 Math Pac manual, it does contain the the execution trail that am looking for! Thanks for pointing me in the right direction. But, if you wish to create the PDF, that's kind of you.
(07-07-2017 03:12 AM)Joe Horn Wrote: [ -> ]This scan might be more readable than the one you already have. It's 1.5 MB: http://holyjoe.net/hp/movavg.pdf
Joe,
Thank you for creating that excerpt from the manual. I appreciate it.
(07-06-2017 10:39 PM)Matt Agajanian Wrote: [ -> ]Over the last few days, I've been diving into the 67's Standard Pac Moving Averages program.
There seems to be a treasure chest of programming tricks, looping, and indirect addressing genius. I feel overwhelmed trying to mentally grasp each technique.
Well, it's not that complicated. There is just a special way of handling the loop counter.
(07-06-2017 10:39 PM)Matt Agajanian Wrote: [ -> ]Perhaps some folks here can give me a detailed sketch of how the program flows and its indirect addressing tricks.
LBL a initializes the program in that it clears all registers, checks whether the input n (the number of values to average) is between 1 and 22 (if not the input flashes, cf. LBL 4). As in many other HP programs, flag 0 is used to indicate print mode, in this case some results are printed. The most important part is that register I is initialized with the number n,nn (i.e. n + n/100). Since for indirect addressing only the integer part is relevant, register I is set to n, the highest register number where the first value will be stored.
LBL A is the main routine that accepts a new value and – after n values have been entered – calculates the average. First the number of entered values k is increased by one (RCL E 1 +), then the oldest value in register (i) is removed from the sum in R0 (RCL i STO-0) and the entered value both replaces it as well as it's added back to the sum (STO i x<>y STO+0). The new number of entered values is compared with n, and if n has been reached, the average is calculated (GSB 0).
Then the pointer in register I is decremented. If you want to average 5 values, the first entry has been stored in R5, and now the pointer is adjusted to R4. If the pointer falls below one (checked by the DSZ in line 48) the content of register I is 0,nn. In this case this is multiplied by 101 which resets this number to n,nn: 0,05*101 = 5,05. So this simply wraps around the pointer: 5 - 4 - 3 - 2 - 1 - 0 - 5 - 4... A simple RCL D STO I would have done the same. ;-)
The output routine at LBL C essentially uses the same trick. The FRC command resets n,nn to 0,nn.
LBL D recalculates the average by dividing the cumulated sum by min(n, k).
That's it.
Dieter
Yes, thanks for the analyses.
See, here's the thing:
As an SR-56 and TI-58C, and HP-41/42 programmer, you get spoiled (I know I do)
--(TI-58/59, HP-41/42) looping with any register and indirectly addressed registers and you can use multiple registers at the same time
--(SR-52/56, TI-58/59, HP-41/42) register exchange with any register.
--(SR-52, TI58/59, HP-41/42) Indirect addressing with any register
as well as some other fancy doo-dads.
So, as much as I love my Woodstock, Classic, and Spike/Spice series calcs, that much more I want to challenge myself to rewrite programs/algorithms from the more advanced cals to give me added functionality and added toolkit resources so I can enjoy my HP's all the more.
Yes, you can't fit an elephant in a VW Bug but, you gotta appreciate the challenge.