Sunday, March 20, 2016

Programming with the PrgCalcPro iOS App

App Creator: SekApps
Price: I paid \$0.99
Platform: iOS
Memory: 1,000 steps with 100 registers

The PrgCalcPro is based on the Russian scientific calculator Elektronika MK-61.  The MK-61 was in production from 1981 to 1993.  Originally the MK-61 had 15 memory registers and 105 steps.  There are Boolean operations but no built in statistics mode.

The PrgCalcPro and MK-61 operated by Reverse Polish Notation (RPN), like the Hewlett Packard calculators.  The calculator has 4 stacks.

The PrgCalcPro has more English key labels instead of Russian.  You can find notes of the MK-61 here:

http://www.thimet.de/CalcCollection/Calculators/Elektronika-MK-61/CmdRef.html

Programming Notes:

M is STO, R is RCL.  There are 15 readily accessible memory registers available from the keyboard:  0-9, a, b, c, d, and e.

Angle mode is determined by a manual switch.  Unfortunately it can't be programmed (I don't think).

Certain symbols are used:
[x] Integer Part
{x} Fractional Part
MAX. The maximum of y and x.
SIG.  Sign of x
Bx. Last X recall.
lg Common logarithm (base 10, LOG)
tg Tangent function (TAN)
A small recycling symbol ([ F ], [ . ]) represents the Roll Down function.
<--> represents the exchange function (X<>Y)
x^y: Power function where the base is on the x stack and the exponent is on the y stack.  The exponent remains of the y stack upon calculation and is not "consumed".

This blog entry will have basic programs, and additional programs will follow on the next few blog entries.

Eccentricity of an Ellipse
a ≥ b, b is entered first

0: 13  ;  /
1: 22  ;  X^2
2: 0B  ;  +/-
3: 01  ;  1
4: 10  ;  +
5: 21  ;  sqr \\ √
6: 50  ;  STOP

The Average of Non-Zero Numbers

Keep entering numbers using n, [RUN].  When you are done, enter 0, [RUN].  The display will show sum (memory 0), press [RUN] to get the number of points (memory 1), and finally press [RUN] to get the average.

Notes:
The tests for the ProCalcPro (and the MK-61) work slightly differently from Hewlett Packard RPN programming calculators.

Format:
Test ( x<0, x=0, x≥0, x≠0)
Code Number (00-99), or label
Do this next command instead of test is true

Example:
x≠0
15
R, 0
+

If the number in the display is non-zero (test is true), then recall memory register 0 and add the number to it.  If the number is zero (test is false), skip to line 15.

Thanks to thimet.net.  http://www.thimet.de/CalcCollection/Calculators/Elektronika-MK-61/CmdRef.html

Program:
0: 40  ;  M0
1: 01  ;  1
2: 41  ;  M1
3: 50  ;  STOP
4: 57  ;  X!=0 \\ X≠0
5: 15 \\ Goto line 15 if X is zero
6: 60  ;  R0
7: 10  ;  +
8: 40  ;  M0
9: 61  ;  R1
10: 01  ;  1
11: 10  ;  +
12: 41  ;  M1
13: 51  ;  JMP \\ Goto line 03 (the next code is a step code number)
14: 03
15: 60  ;  R0
16: 50  ;  STOP
17: 61  ;  R1
18: 50  ;  STOP
19: 13  ;  /
20: 50  ;  STOP

Equation: Ax^2 + Bx + C = 0
Determinant: D = B^2 - 4AC
Roots:  -B/(2A) ± √(D)/(2A)

Store A, B, and C in the a, b, and c registers respectively.
Register a: [ . ]
Register b: [ +/- ]
Register c: [ EXT ]

Output Registers:
D = determinant
Memory 0 = root 1 if D ≥0, real part if D < 0
Memory 1 = root 2 if D ≥ 0, imaginary part if D < 0
Complex Roots Format: M0 ± i*M1

0: 6B  ;  RB // RCL B
1: 22  ;  X^2
2: 04  ;  4
3: 6A  ;  RA
4: 12  ;  *
5: 6C  ;  RC
6: 12  ;  *
7: 11  ;  -
8: 4D  ;  MD // STO D
9: 50  ;  STOP // determinant
10: 59  ;  X>=0 // if X≥0 Goto line 12, else Goto line 28
11: 28
12: 21  ;  sqr // finding the real roots, sqr = √
13: 0E  ;  ^
14: 6B  ;  RB
15: 11  ;  -
16: 53  ;  SUB // execute subroutine located at line 41
17: 41
18: 40  ;  M0
19: 50  ;  STOP
20: 14  ;  XY
21: 0B  ;  +- // CHS
22: 6B  ;  RB
23: 11  ;  -
24: 53  ;  SUB
25: 41
26: 41  ;  M1
27: 50  ;  STOP
28: 31  ;  abs // complex roots
29: 21  ;  sqr
30: 6B  ;  RB
31: 0B  ;  +-
32: 53  ;  SUB
33: 41
34: 40  ;  M0
35: 50  ;  STOP
36: 14  ;  XY
37: 53  ;  SUB
38: 41
39: 41  ;  M1
40: 50  ;  STOP
41: 6A  ;  RA // subroutine
42: 02  ;  2
43: 12  ;  *
44: 13  ;  /
45: 52  ;  RET // return

This blog is properly of Edward Shore.  2016.