LOAN+SAVE

Display

(HP-41CX, Hewlett Packard 1983 and DM41X, SwissMicros 2020)

Overview
Program L/S (with subprograms LOAN and SAVE) calculates monthly payments or savings based on an amount, an interest value and a period. The loan and savings program was written to review different ways of managing the mortgage and savings. Most banks can provide a nice listing but what if the interest changes? Below program may be of help. 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 which is shown by a year-counter.
.

Calculations
The loan on the basis of annuity is calculated by below algorithm in which AMT and MP represent the amount respectively monthly payment and r is the monthly interest and m the number of months:

 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 (in %) as follows:

 r = 1 + I%
12*100 

Example 1: LOAN

Example 2: SAVE

Program Listing
The LOAN program’s outcome will be the Monthly Payment for the loan (mortgage) on the basis of annuity and requires the following parameters:
– the Amount to borrow in your own currency
– the effective Annual Interest
– the Number of Months to pay it back

The SAVE program calculates the final Lump Sum you receive after the period of saving and requires the following parameters:
– the Monthly Payment in your own currency
– the effective Annual Interest
– the Number of Months to save your money

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 listing of program L/S (with subprograms LOAN and SAVE) is given below:

Registers, Labels and Flags

Downloads
PDF format of program LOAN+SAVE.
RAW/TXT format of program LOAN+SAVE (in zip file).

This program is copyright and is supplied without representation or warranty of any kind. The author assumes 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

© 2006-2020 by Auke Hoekstra

 
Don`t copy text!