HP 34s: Three financial routines



I posted three financial routines for the HP 34s on the Articles section, to complement the existing TVM application :

- Cash flow analysis (corrected and improved by Dieter)

- Amortization

- Nominal / Effective interest rate conversion

As always, any suggestion is very welcome.



Edited: 12 Nov 2011, 7:43 p.m.


Hi Miguel,

I am really glad to see you using the preprocessor extension to the WP 34S assembler! That is gratifying. Your code is an excellent example of usage of the extension.

A couple of points that will help in certain cases:

1) Most importantly, if you are using this tool (wp34s_pp or the -pp switch in wp34s_asm), it is better to let the tool assign the local label names (eg: LBL 01) and use a symbolic label for the target of your SLV or XEQ statement. (Just as a reminder, and not that you violated this, but the preprocessor cannot handle duplicate local labels [ie: LBL 01]. It is usually (always?!) better to let the tool choose local labels to use itself.)

2) For ease of input you can recode most of the text strings by using double quotes. The tool will parse it and figure out the most efficient coding required. Several things, like spaces, are automatically recoded as the '[space]' equivalent. In some cases, the double quote technique will produce fewer steps than you would have gotten otherwise. Regardless of whether the output steps are identical or not, it is certainly easier to code the strings using double quotes.

3) You have a few cases where your use stretched to the tool to places it was not intended to go :-) In at least one case, you made use of a GTO with a 'soft' label (step 16 of 'CFE', for example) where it had been my intention that this technique designed for use with the pseudo JMP instruction. In a way I am glad that the GTO actually worked in this case but I don't think it was never tested (at least not extensively)! In this example, if you had used a JMP instead GTO, the tool would have decided that this could have been coded with a SKIP instruction. These JMP->SKIP promotions will save a few steps here and there because the tool would not be forced to inject a LBL for the soft-targetted GTO.

I have attached a 'diff' output between your code and a slightly modified version to show you what I mean. The first line of each diff pair is the original line(s) from your code and the second line(s) are how I modified it. I can send you the modified code as a whole if you'd like. Just let me know.

Not that the resulting compression make too much difference, but your code assembled to 317 words in total (228 steps) and my variation assembled to 314 words (again, in 228 steps). This is mostly the loss of the additional LBLs (I think).

Keep up the fine work!

< [alpha]'CF'
> "CF"
< [alpha] [^]
< [alpha] n
> "[^]n"
< GTO endloop
> JMP endloop
< [alpha]'CF'
< [alpha] =
> "CF="
< [alpha]'CF'
> "CF"
< [alpha] =
> "="
< XEQ 00
< [alpha]'NPV'
< [alpha] =
> "NPV="
< SLV 00
< [alpha]'IRR'
< [alpha] =
> "IRR="
< LBL 00 // Calculates NPV and solves for IRR
< 1
> calcNPV_IRR:: 1 // Calculates NPV and solves for IRR
< GTO intzero
> JMP intzero
< [alpha]'Cap'
< [alpha] ?
> "Cap?"
< [alpha]'Pmt'
< [alpha] ?
> "Pmt?"
< [alpha]'Tpr'
< [alpha]'ds?'
> "Tprds?"
< [alpha]'I/P'
< [alpha]'%?'
> "I/P%?"
< [alpha]'Prd'
< [alpha]'-I?'
> "Prd-I?"
< [alpha]'Prd'
< [alpha]'-F?'
> "Prd-F?"
< [alpha]'Pri'
> "Pri"
< [alpha]'Int'
> "Int"
< [alpha]'Bal'
> "Bal"
< [alpha]'P-Y'
< [alpha] ?
> "P-Y?"
< XEQ 01
< LBL 01 // Calculates EFF and solves for NOM
> calcEFF_NOM:: RCL D // Calculates EFF and solves for NOM


Thank you Neil for your comments, I will make the necessary changes to incorporate them in my code and post an edited version.

Have a nice evening,



...And done!

Possibly Related Threads...
Thread Author Replies Views Last Post
  10bii Financial Calculator is on launch sale - 0.99$ only John 4 832 11-10-2013, 08:02 PM
Last Post: BShoring
  HP-80 Financial Calculator (1973) BShoring 3 672 03-25-2013, 11:39 PM
Last Post: BShoring
  Simple financial problem with a HP-12c Platinum Lapin 3 611 11-11-2012, 09:33 AM
Last Post: Lapin
  HP financial calculator prototypes Keith Midson 4 642 10-06-2012, 03:13 PM
Last Post: Harald
  Financial Calculations for the HP41: another enhanced version Luiz C. Vieira (Brazil) 0 316 04-16-2012, 09:16 AM
Last Post: Luiz C. Vieira (Brazil)
  HP-41CX and Financial Decisions Module Cheyenne Whitley 22 2,005 04-07-2012, 07:51 PM
Last Post: Garth Wilson
  HP-35A/21 D.MS<-->Decimal degrees routines Matt Agajanian 9 1,130 03-29-2012, 11:03 AM
Last Post: Matt Agajanian
  accuracy of integration and solve routines HP 15C LE Jan 3 529 02-02-2012, 01:03 PM
Last Post: Marcus von Cube, Germany
  [WP34s] XROM routines fhub 32 2,474 01-10-2012, 04:28 AM
Last Post: Marcus von Cube, Germany
  [wp 34s] wp 34s picture and scan Jeroen Van Nieuwenhove 2 467 10-27-2011, 09:02 PM
Last Post: Les Wright

Forum Jump: