This program is Copyright © 1999 by Auke Hoekstra and is used here by permission.
This program is supplied without representation or warranty of any kind. Auke Hoekstra and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
In the '80-ties I used my HP-41CX for studies and hobby. Since then I kept it in a save place. Now after about eight years of silence I unintendedly searched on internet for "HP41". This museum site was a place where crazy people like me were still showing interest in old calculators. It is crazy because who runs a program on an HP-41 which can run 1000 times faster on a Pentium laptop. It is fascinating because you try to make a program with the minimum number of lines or the optimal algorithm to use the smallest number of registers or make as much as possible use of the stack registers.
Having started programming on my HP-41CX again, I would like to publish a few of my (old) programs for reasons of reviving the HP-41 feelings again.
I would very much appreciate if you would reply to me on the HP-41 topic.
The loan and savings program was written to review different ways of managing the mortgage and savings. Most banks can provide you with nice listings but what if the interest changes? Below may help a little. A feeling of nostalgia will be experienced when calculating a mortgage over a period of 30 years. The calculation loop has to be performed 360 times. The cursor has to move 30 times over the display, although replaced by a counter.
The listing below shows an extended command in line 08: ATOX. This is to check whether the input character was an 'L' (value 76). For the C and CV this can be replaced by changing it an ASTO X followed by 'L'. The same applies to line 11 where the compare character is an 'S' (value 83).
The number of bytes can easily be reduced by removing subroutine LBL 06 and its calls XEQ 06 or by deleting lines 01-13.
Using the loan and savings program is easy. For both calculations you need to enter three parameters.
The LOAN program requires the following parameters:
The outcome will be the Monthly Payment for the loan (mortgage) on the basis of annuity.
The SAVE program requires the following parameters:
The SAVE program calculates the final Lump Sum you receive after the period of saving.
Please note that a European setting has been used (flag 28) as well as my default FIX 5 setting.
Keystrokes: Display: Comments: [XEQ][ALPHA] L/S [ALPHA] L/S? - Choose loan or savings calculation L [R/S] AMT=? - Enter the loan AMOUNT 50000 [R/S] I%=? - Enter the annual interest 7,5 [R/S] NR.M=? - Enter the duration in number of months 240 [R/S] 20 - Count down in years 19 .. 2 1 M.P=402,80 - Monthly Payment
Keystrokes: Display: Comments: - Continued from previous example [R/S] L/S? - Choose loan or savings calculation S [R/S] M.P=? - Enter the monthly payment 150 [R/S] I%=? - Enter the annual interest 3 [R/S] NR.M=? - Enter the duration in number of months 60 [R/S] 5 - Count down in years 4 . 1 SUM=9.721,25 - Lump Sum [CLX] 9.721,24941 - Normal display
The programs can be executed directly by either:
[XEQ][ALPHA] LOAN [ALPHA]
or
[XEQ][ALPHA] SAVE [ALPHA]
LINE KEYS 01 LBL'L/S' { main entry } 02 LBL 00 { byte saving label } 03 'L/S?' 04 AON 05 PROMPT 06 AOFF 07 76 08 ATOX 09 X=Y? 10 GTO'LOAN' 11 83 12 X#Y? 13 GTO 00 14 LBL'SAVE' { SAVE program } 15 'M.P=?' 16 XEQ 05 17 * 18 'NR.M=?' 19 PROMPT 20 STO 03 21 CLX 22 LBL 02 { Calculate Sum } 23 XEQ 06 24 RCL 01 25 + 26 RCL 02 27 * 28 DSE 03 29 GTO 02 30 'SUM=' 31 GTO 07 32 LBL 05 { Get Interest } 33 PROMPT 34 STO 01 35 'I%=?' 36 PROMPT 37 1200 38 / 39 1 40 + 41 STO 02 42 FIX 0 43 CF 29 44 RTN 45 LBL 06 { Count down display } 46 RCL 03 47 STO 04 48 RDN 49 12 50 ST/ 04 51 X<> 04 52 FRC 53 X=0? 54 VIEW L 55 RDN 56 RTN 57 LBL'LOAN { LOAN program } 58 'AMT=?' 59 XEQ 05 60 'NR.M=?' 61 PROMPT 62 STO 03 63 Y^X 64 , 65 LBL 03 { Calculate monthly payment } 66 XEQ 06 67 RCL 02 68 * 69 1 70 + 71 DSE 03 72 GTO 03 73 / 74 * 75 'M.P=' 76 LBL 07 { Display results } 77 FIX 2 78 ARCL X 79 FIX 5 80 SF 29 81 AVIEW 82 END (177 bytes)
R01 | Loan Amount or Monthly Payment |
R02 | Annual Interest |
R03 | Duration in Number of Months |
R04 | Work register for year count down |
Loan calculation on the basis of annuity is calculated by below algorithm in which AMT and MP represent the amount respectively monthly payment:
MP | = AMT | rm | = AMT | rm |
----------------------- | ----------------------- | |||
rm-1 + rm-2 + .. + r + 1 | r(r(r(....) + 1) + 1) + 1 |
Savings calculation is based on below algorithm in which SUM and MP represent the lump sum respectively monthly payment:
SUM | = | r(r(r(r(...) + MP) + MP) + MP |
r expresses the monthly interest derived from the annual interest I% as
follows:
r | = 1 + | I% |
-------- | ||
12*100 |
Go back to the HP-41 software library
Go back to the general software library
Go
back to the main exhibit hall