Some PPC Journal Programs Ported to HP 12C, TI-84 Plus CE Gets Python in the United States
Introduction
In 1978, the Personal Programmers Club wrote an issue containing short utility programs for the classic HP 25A and HP 67 calculators. On today's blog, I am going to port some of these routines for the HP 12C financial calculator. The calculator codes come from the standard-RPN HP 12C (99 step capacity). For those using a HP 12C Platinum, some key codes will differ (example: LST X).
See the Source section for more details.
HP 12C Program: Modulo Division (remainder)
Original HP 25A and HP 67 (section C1) program by John Kennedy.
This program uses register 1, but any register can be used. This program works best when x and y are both positive.
01 x<>y 34
02 STO 1 44, 1
03 x<>y 34
04 STO÷ 1 44, 10, 1
05 RCL 1 45, 1
06 INTG 43, 25
07 × 20
08 - 30
09 GTO 00 43, 33, 00
If you want the result of the division with both the integer and remainder part, press RCL 1.
Example:
4758 mod 360 = 78
4758, ENTER, 360, R/S
HP 12C Program: Infinite Division
Original HP 25A and HP 67 (section C2) program by John Kennedy.
This program allows you to see each digit of a division y/x, one digit at a time. It does not tell you where the decimal point is, you will need to determine that on your own.
The original code for the HP 25A took the advantage of the storage registers R3 and R7. In statistics, R3 = n and R7 = ∑x allowing for the mean function to calculate the division. It was assumed that two registers are cleared before program execution.
The original code also pause for each digit. The HP 12C does not have a pause command, so I used the run/stop (R/S) command instead.
01 STO 1 44, 1
02 x<>y 34
03 STO 2 44, 2 // main loop begins here
04 RCL 1 45, 1
05 STO÷ 2 44, 10, 2
06 RCL 2 45, 2
07 INTG 43, 25
08 R/S 31 // display the digit
09 × 20
10 - 30
11 1 1
12 0 0
13 × 20
14 GTO 03 43, 33, 03
Example: Find the decimal equivalent of 45/78.
45, ENTER, 78, R/S (R/S for each digit)
Results: 0, 7, 8, 9, 4, 7 (and so on)
45/78 = 0.78947368421052631...
HP 12C: Reverse of Integer's Digits
Original HP 25A and HP 67 (section D7) program by Jim Davidson
This program reverses the digits of an integer. Example: the program transforms 82531 to 13258.
01 STO 0 44, 0
02 STO- 0 44, 30, 0
03 FRAC 43, 24
04 STO+ 0 44, 40, 0
05 LST x 43, 36
06 INTG 43, 25
07 . 48
08 1 1
09 STO÷ 0 44, 10, 0
10 × 20
11 x=0 43, 35
12 GTO 14 43, 33, 14
13 GTO 03 43, 33, 03
14 RCL 0 45, 0
15 GTO 00 43, 33, 00
Example: Reverse the digits of 90649.
90649, R/S
Result: 94609
Source
Personal Programmers Club. (various authors) "Special Routines Issue" Vol. 5 No. 7 August 1978 Publication: Santa Ana, CA
Eddie
All original content copyright, © 2011-2021. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.