Skip to content

Commit

Permalink
added TVM2 program
Browse files Browse the repository at this point in the history
  • Loading branch information
grubmueller committed Jun 14, 2023
1 parent 15d9737 commit 58adc83
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.raw
/tmp
/states
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Information on program usage is written in the according program files.
### non-engineering

- `TVM`: Time value of money (solver function), [HP42-OM]
- `TVM2`: Time value of money, [HP42-PE]

## Toolchain

Expand Down
199 changes: 199 additions & 0 deletions non-engineering/TVM2.hp42s
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
@ Time value of money
@
@ This program is taken from the the HP-42S Programming Examples and Techniques.
@
@ Michael Grubmüller, michael.grubmueller@gmail.com
@ 2023-06-04

00 { 532-Byte Prgm }
01▸LBL "TVM2"
02 REALRES
03 CF 21
04 12
05 SF 25
06 RCL "P/YR"
07 XEQ 21
08 SF 25
09 RCL "p"
10 CF 25
11 1
12 X≠Y?
13 0
14 STO "p"
15 XEQ 20
16▸LBL 99
17 CLMENU
18 "N"
19 KEY 1 XEQ 01
20 "I%YR"
21 KEY 2 XEQ 02
22 "PV"
23 KEY 3 XEQ 03
24 "PMT"
25 KEY 4 XEQ 04
26 "FV"
27 KEY 5 XEQ 05
28 "MODES"
29 KEY 6 GTO 06
30 MENU
31 STOP
32 ASTO "CNTRL"
33 STO IND "CNTRL"
34 VIEW IND "CNTRL"
35 GTO 99
36▸LBL 20
37 CLA
38 RCL "P/YR"
39 AIP
40 ├" P/YR"
41 RCL "p"
42 X=0?
43 ├", END MODE"
44 X≠0?
45 ├", BEGIN MODE"
46 AVIEW
47 CLMENU
48 RTN
49▸LBL 06
50 XEQ 20
51 "P/YR"
52 KEY 1 XEQ 21
53 "BEG"
54 KEY 2 XEQ 22
55 "END"
56 KEY 3 XEQ 23
57 "TVM"
58 KEY 4 GTO "TVM2"
59 MENU
60 RCL "P/YR"
61 STOP
62 GTO 06
63▸LBL 21
64 ABS
65 IP
66 1000
67 X<>Y
68 X≥Y?
69 12
70 X=0?
71 12
72 STO "P/YR"
73 RTN
74▸LBL 22
75 1
76 STO "p"
77 RTN
78▸LBL 23
79 0
80 STO "p"
81 RTN
82▸LBL 01
83 "N"
84 FS?C 22
85 RTN
86 1
87 STO "N"
88 XEQ 10
89 RCL "FV"
90 RCL÷ "MODE"
91 +/-
92 RCL "PMT"
93 RCL "i"
94 X=0?
95 GTO 00
96 ÷
97 +
98 LASTX
99 RCL "PV"
100 RCL÷ "MODE"
101 +
102 ÷
103 LN
104 RCL "i"
105 LN1+X
106 ÷
107 RTN
108▸LBL 00
109 RCL "PV"
110 RCL+ "FV"
111 RCL÷ "PMT"
112 +/-
113 RTN
114▸LBL 02
115 "I%YR"
116 FS?C 22
117 RTN
118 PGMSLV "i"
119 0
120 STO "I%YR"
121 20
122 SOLVE "I%YR"
123 RTN
124▸LBL "i"
125 XEQ 10
126 RCL× "PMT"
127 X<>Y
128 RCL× "FV"
129 +
130 RCL+ "PV"
131 RTN
132▸LBL 03
133 "PV"
134 FS?C 22
135 RTN
136 XEQ 10
137 RCL× "PMT"
138 X<>Y
139 RCL× "FV"
140 +
141 +/-
142 RTN
143▸LBL 04
144 "PMT"
145 FS?C 22
146 RTN
147 XEQ 10
148 X<>Y
149 RCL× "FV"
150 RCL+ "PV"
151 X<>Y
152 ÷
153 +/-
154 RTN
155▸LBL 05
156 "FV"
157 FS?C 22
158 RTN
159 XEQ 10
160 RCL× "PMT"
161 RCL+ "PV"
162 X<>Y
163 ÷
164 +/-
165 RTN
166▸LBL 10
167 RCL "I%YR"
168 RCL÷ "P/YR"
169 100
170 ÷
171 STO "i"
172 RCL× "p"
173 1
174 +
175 STO "MODE"
176 1
177 ENTER
178 RCL+ "i"
179 RCL "N"
180 +/-
181 Y↑X
182 STO ST Z
183 -
184 RCL× "MODE"
185 SF 25
186 RCL÷ "i"
187 FS?C 25
188 RTN
189 1
190 RCL "N"
191 END

0 comments on commit 58adc83

Please sign in to comment.