2022-11-18
Restoring my Commodore P50 calculator with a little solder and a 3D printer
2022-11-17
Restoring my Rockwell 8R calculator with a 3D printer
I've owned a Rockwell 8R calculator for a very long time. It was released in 1975 and it seems to have survived the intervening 47 years pretty well. Except that when I was a child I liked to take it apart to examine its innards. Along the way I lost all four screws and the battery cover.
2022-11-06
Primality testing on the Commodore P50 programmable calculator with one register and 23 steps
Partly because of when I started writing code (the 1970s), and partly because of money, a lot of my early coding was in very constrained environments. I've written before about programming some industrial machinery using a KIM-1. However, the most constrained environment I've coded on is the Commodore P50 programmable calculator in the late 1970s.
Its programming capabilities are very, very limited. There's a single 'register' (the standard memory function of the calculator) and only 24 steps (which are for the most part single presses of a key) are programmable. For example, if your program needs the constant 1234 that's four steps out of 24 taken up!
It was great for writing a program that is just a function that you need to evaluate for multiple values of x. For example, you can store the function sin(1/x) like this:
lrn
1/x
SIN
R/S
GOTO 00
lrn
And then enter a number and press R/S to evaluate sin(1/x). lrn puts the calculator in programming mode and then can accept up to 24 keystrokes. R/S causes the program to terminate.
Adding in line numbers shows that the GOTO takes the program back to the start. This is done because if you run a program and hit R/S again it continues where it left off which could result in an error if the program previously terminated in the middle somewhere.
lrn
00 1/x
01 SIN
02 R/S
03 GOTO
04 00
lrn
Notice how GOTO 00 takes two of 24 steps!
Loops
You can easily write simple loops. For example, if you wanted to plot sin(1/x) for x starting at 0.001 in increments of 0.001 you'd write (STO stores a number in the memory, RCL gets it from memory)
lrn
00 0
01 STO
02 RCL
03 +
04 .
05 0
06 0
07 1
08 =
09 STO
10 1/x
11 SIN
12 R/S
13 GOTO
14 02
lrn
Conditional branching
00 -
01 RCL
02 =
03 SKN
04 GOTO
06 +
07 RCL
08 =
09 R/S
10 GOTO
11 00
lrn
Is this number a prime?
00 RCL
01 -
02 INT
03 *
04 4
05 10^x
06 ➗
07 RCL
08 INT
09 -
10 INT
11 =
12 SKZ
13 GOTO
14 18
15 RCL
16 INT
17 R/S
18 1
19 +/-
01 - 11.0198
02 INT 11
03 * 0.0198
04 4 4
05 10^x 10000
06 ➗ 198
08 INT 11
09 - 18
10 INT 18
11 = 0
12 SKZ
13 GOTO
14 18
15 RCL 11.0198
16 INT 11
17 R/S 11
18 1
19 +/-
01 - 12.0198
02 INT 12
03 * 0.0198
04 4 4
05 10^x 10000
06 ➗ 198
07 RCL 12.0198
08 INT 12
09 - 16.5
10 INT 16
11 = 0.5
12 SKZ
13 GOTO
14 18
15 RCL
16 INT
17 R/S
18 1 1
19 +/- -1