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.
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 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.
The LOAN program requires the following parameters:
The SAVE program requires the following parameters:
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 01LBL'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 |
| 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 | = 1 + | I% |
| -------- | ||
| 12*100 |
Go back
to the software library
Go back to the main exhibit hall