HP-25 purpose
|
11-04-2020, 01:26 AM
Post: #10
|
|||
|
|||
RE: HP-25 purpose
Hi, Gene: Gene Wrote:I for one have not ever thought that subroutines were ** that ** useful on a 49 step machine given the overhead required to call and return from one. You're wrong, it's precisely the opposite: the less program steps you have available, the more useful is a subroutine capability. The number of steps saved by replacing a sequence of #instructions repeated #times is given by the formula: #Saved steps = (#instructions - 1) * (#times - 1) - 2 For instance, if you have a 7-step sequence that is repeated 5 times then replacing them by 5 subroutine calls will save: #Saved steps = (7 - 1) * (5 - 1) - 2 = 22 steps saved A few values are given in the following table: \begin{array}{|c|c|} \hline Instructions & 1 time & 2 times & 3 times & 4 times & 5 times \\\hline 1 & -2 & -2 & -2 & -2 & -2 \\\hline 2 & -2 & -1 & 0 & 1 & 2 \\\hline 3 & -2 & 0 & 2 & 4 & 6 \\\hline 4 & -2 & 1 & 4 & 7 & 10 \\\hline 5 & -2 & 2 & 6 & 10 & 14 \\\hline 6 & -2 & 3 & 8 & 13 & 18 \\\hline 7 & -2 & 4 & 10 & 16 & 22 \\\hline \end{array} As you can see from the table above, even just 2 instructions repeated 4 or more times will save steps if converted to a subroutine. Same with 3 instructions repeated 3 or more times and 4 or more instructions repeated at least twice. Also, there are times when you can save an additional step, for instance if you can have the last call immediately before the n-step subroutine, in which case you can omit it altogether and save one extra step. Best regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP-25 purpose - Matt Agajanian - 11-03-2020, 01:04 AM
RE: HP-25 purpose - Thomas Okken - 11-03-2020, 01:28 AM
RE: HP-25 purpose - Steve Simpkin - 11-03-2020, 02:07 AM
RE: HP-25 purpose - BobVA - 11-03-2020, 02:41 PM
RE: HP-25 purpose - Dave Britten - 11-03-2020, 03:34 PM
RE: HP-25 purpose - RPZ - 11-03-2020, 04:54 PM
RE: HP-25 purpose - Valentin Albillo - 11-03-2020, 06:50 PM
RE: HP-25 purpose - Steve Simpkin - 11-03-2020, 08:35 PM
RE: HP-25 purpose - Gene - 11-03-2020, 08:47 PM
RE: HP-25 purpose - Valentin Albillo - 11-04-2020 01:26 AM
RE: HP-25 purpose - Gene - 11-04-2020, 03:27 AM
RE: HP-25 purpose - Dave Britten - 11-04-2020, 12:30 PM
|
User(s) browsing this thread: 1 Guest(s)