The Museum of HP Calculators


RPN Calculator for the HP-75C

This program was submitted by Emmanuel Compès.

(c) copyright R.Harvey and Les Editions du Cagire
Source: Archives of PPC-Toulouse, digital cassette #75/2

This program is supplied without representation or warranty of any kind. Emmanuel Compès and The Museum of HP Calculators therefore assume 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.

Overview

RPN is a 10 registers Reverse Polish Notation calculator for HP-75. Some explanations about it. At first, what about the keys with LOCKed position on?
1=1           Q=SQRT          E=INT(X)               Z=STO_
2=2           W=LOG(X)        S=SIN(X)               X=RCL_
3=3           E=EXP(X)        D=COS(X)               C=X⇔Y
4=4           R=Y^X           F=TAN(X)               V=RND
5=5           T=1/X           G=HYP SIN COS TAN      F=CLX
6=6           H=EEX           N=ENTER                      
7=7           U=mode DEG-RAD  J=POL-REC              M=X<>_
8=8           I=SIGMA +       K=H.MS-H               ,=MANT
9=9           P=FACT(X)       L=DEG-RAD              .=.
0=0           *=Y*X           /=Y/X
-=Y-X         +=Y+X

For the shifted keys,try them ...

Notes:

Listing

10 ! **** RPN Calculator ****
20 DEFAULT ON @ DELAY .05 @ OPTION ANGLE RADIANS
30 A,X,Y,Z,T,L=0 @ M=1 @ F=11 @ M$="radian" @ FOR I=0 TO 9 @ A(I)=0 @ NEXT I ! F: FIX
40 K$=KEY$ @ IF K$#"" THEN DISP "X=";X @ GOTO 150
50 X$,Y$=STR$(X) @ P=POS(X$,"E") @ IF P#0 THEN X$=X$[1,P-1] @ Y$=Y$[P+1,LEN(Y$)]
60 IF P=0 AND FP(X)=0 THEN X$=X$&"."
70 IF X>0 THEN X$="+"&X$
80 S=1 @ IF X=0 THEN S=0
90 S$="" @ IF ABS(X)>1 THEN S$="+"
100 X$=X$&"00000000000" @ X$=X$[1,F+2+S] @ IF P#0 THEN X$=X$&" E"&S$&Y$
110 DISP "X=";X$ @ B,E,P=0 @ X$="+"
120 IF X$#"+" THEN DISP "X ";X$;"_"
125 K$=KEY$ @ IF K$#"" THEN 150
130 ON TIMER # 0,300 OFF TIMER # 0 @ BEEP @ GOSUB 3110 @ BYE @ GOTO 40
140 K$=KEY$ @ IF K$="" THEN 140
150 OFF TIMER # 0 @ IF K$<"0" OR K$>"9" THEN 210
160 A=1 @ IF E#1 THEN 190
170 IF LEN(X$)=B AND K$>"4" THEN X$=X$&"0"&K$ @ GOTO 120
180 IF LEN(X$)=B+3 THEN 120 ELSE 200
190 IF LEN(X$)-P=13 THEN 120
200 X$=X$&K$ @ GOTO 120
210 IF K$#"H" THEN 260
220 A=1 @ IF E=1 THEN 120
230 E=1 @ IF LEN(X$)≤1 THEN X$="+1" @ P=0 @ GOTO 250
240 IF VAL(X$)=0 THEN X$="+1" @ P=0
250 X$=X$&" E+" @ B=LEN(X$) @ GOTO 120
260 IF K$#"." THEN 300
270 A=1 @ IF P=1 OR E=1 THEN 120
280 P=1 @ IF X$="+" THEN X$="+0"
290 X$=X$&"." @ GOTO 120
300 IF K$#"Y" THEN 350
310 L1,L0=LEN(X$) @ L$=X$[L1,L1] @ IF L1=1 THEN X=-X @ M=1 @ GOTO 40
320 IF VAL(X$)=0 THEN 120
330 IF L$="+" OR L$="-" THEN X$=X$[1,L0-1]&CHR$(88-NUM(L$))&X$[L0+1,L1] @ GOTO 120
340 L0=L0-1 @ L$=X$[L0,L0] @ GOTO 330
350 IF UPRC$(K$)#"B" AND K$#CHR$(8) AND K$#"‹" THEN 430
360 L1=LEN(X$) @ IF L1=1 OR L1=2 OR K$="b" OR K$="‹" THEN DISP "CLX" @ X,M,A=0 @
 GOTO 40
370 L$=X$[L1,L1] @ IF L$="+" OR L$="-" THEN E=0 @ X$=X$[1,L1-3] @ GOTO 400
380 IF L$="." THEN P=0
390 X$=X$[1,L1-1] @ IF LEN(X$)=1 THEN X$="+" @ GOTO 120
400 IF VAL(X$)=0 THEN X$="+"&X$[2,L1-1]
410 GOTO 120
430 IF UPRC$(K$)≥"A" AND UPRC$(K$)≤"Z" THEN 460
440 IF K$="^" OR K$="+" OR K$="-" OR K$="*" OR K$="/" OR K$=" " OR K$="" OR K$=
"‚" THEN 540
445 IF K$="¡" OR K$="¢" OR K$="," THEN 540
450 IF A#1 THEN 40 ELSE 120
460 GOSUB 3110 @ IF K$<"A" OR K$>"N" THEN 480
470 ON NUM(K$)-64 GOTO 1260,5000,640,850,760,870,890,5000,1390,1310,1330,1370,12
80,620
480 IF K$<"O" OR K$>"Z" THEN 500
490 ON NUM(K$)-78 GOTO 1430,1460,710,585,830,800,1200,630,740,1100,5000,1030
500 IF K$<"a" OR K$>"n" THEN 520
510 ON NUM(K$)-96 GOTO 1270,10,1190,860,770,880,940,1020,1410,1320,1340,1380,129
0,660
520 IF K$<"o" OR K$>"z" THEN 540
530 ON NUM(K$)-110 GOTO 1440,1490,730,790,840,810,1240,650,750,1180,820,1170
540 GOSUB 3110 @ IF K$="+" THEN DISP "Y+X" @ L=X @ X=Y+X @ GOTO 3090
550 IF K$="-" THEN DISP "Y-X" @ L=X @ X=Y-X @ GOTO 3090
560 IF K$="*" THEN DISP "Y*X" @ L=X @ X=Y*X @ GOTO 3090
570 IF K$="/" THEN DISP "Y/X" @ L=X @ X=Y/X @ GOTO 3090
580 IF K$#"^" THEN 590
585 DISP "Y^X" @ IF FP(X)#0 AND Y<0 THEN 3190 ELSE L=X @ X=Y^X @ GOTO 3090
590 IF K$=" " THEN DISP "OFF" @ BYE @ DISP "ON" @ GOTO 40
600 IF K$="" THEN DISP "TIME" @ PUT "" @ STOP @ GOTO 40
605 IF K$="¡" THEN DELAY 2 @ DISP "TIME: ";TIME$;"   DATE: ";DATE$ @ DELAY .1 @ 
GOTO 40
610 IF K$="‚" THEN DISP "APPT" @ PUT "‚" @ STOP @ GOTO 40
612 IF K$="¢" THEN DISP "CAT ALL" @ CAT ALL @ GOTO 40
614 IF K$="," THEN DISP "MANT" @ DELAY 2 @ DISP "X=";X @ DELAY .1 @ GOTO 40
620 DISP "ENTER" @ T=Z @ Z=Y @ Y=X @ M=0 @ GOTO 40
630 DISP "RND" @ X0=Y @ Y=Z @ Z=T @ T=X @ X=X0 @ GOTO 40
640 DISP "X<>Y" @ X0=Y @ Y=X @ X=X0 @ GOTO 40
650 DISP "R↑" @ X0=T @ T=Z @ Z=Y @ Y=X @ X=X0 @ GOTO 40
660 DISP "LAST X" @ GOSUB 3100 @ X=L @ GOTO 40
710 DISP "SQRT"
720 IF X<0 THEN BEEP @ DISP "SQR(neg number)" @ GOTO 40 ELSE L=X @ X=SQR(X) @ GOTO 40
730 DISP "X^2" @ L=X @ X=X*X @ GOTO 40
740 DISP "10^X" @ L=X @ X=10^X @ GOTO 40
750 DISP "LOG(X)" @ GOSUB 3140 @ L=X @ X=LOG10(X) @ GOTO 40
760 DISP "EXP(X)" @ L=X @ X=EXP(X) @ GOTO 40
770 DISP "LN(X)" @ GOSUB 3140 @ L=X @ X=LOG(X) @ GOTO 40
790 DISP "%" @ L=X @ X=Y*X/100 @ GOTO 40
800 DISP "1/X" @ L=X @ X=1/X @ GOTO 40
810 DISP "%CH" @ L=X @ X=(X-Y)/Y*100 @ GOTO 40
820 DISP "ABS(X)" @ L=X @ X=ABS(X) @ GOTO 40
830 DISP "SIN(X) en mode ";M$ @ L=X @ X=SIN(X) @ GOTO 40
840 DISP "ASIN(X) en mode ";M$ @ GOSUB 3170 @ L=X @ X=ASIN(X) @ GOTO 40
850 DISP "COS(X) en mode ";M$ @ L=X @ X=COS(X) @ GOTO 40
860 DISP "ACOS(X) en mode ";M$ @ GOSUB 3170 @ L=X @ X=ACOS(X) @ GOTO 40
870 DISP "TAN(X) en mode ";M$ @ L=X @ X=TAN(X) @ GOTO 40
880 DISP "ATAN(X) en mode ";M$ @ L=X @ X=ATN(X) @ GOTO 40
890 DISP "HYP(radians): ";CHR$(211);"IN  ÃOS  ";CHR$(212);"AN ?"
900 GOSUB 3080 @ IF K$="B" OR K$=CHR$(8) THEN 40
910 IF K$="S" THEN DISP "SH(X)" @ L=X @ X=(EXP(X)-EXP(-X))/2 @ GOTO 40
920 IF K$="C" THEN DISP "CH(X)" @ L=X @ X=(EXP(X)+EXP(-X))/2 @ GOTO 40
930 IF K$="T" THEN DISP "TH(X)" @ L=X @ X=EXP(-2*X) @ X=(1-X)/(1+X) @ GOTO 40
ELSE 900
940 DISP "ARGHYP(radians): ";CHR$(211);"IN  ÃOS  ";CHR$(212);"AN ?"
950 GOSUB 3080 @ IF K$="B" OR K$=CHR$(8) THEN 40
960 IF K$="S" THEN DISP "ARGSH(X)" @ L=X @ X=LOG(X+SQR(X*X+1)) @ GOTO 40
970 IF K$#"C" THEN 990 ELSE DISP "ARGCH(X)"
980 IF X<1 THEN 3180 ELSE L=X @ X=LOG(X+SQR(X*X-1)) @ GOTO 40
990 IF K$#"T" THEN 950
1000 GOSUB 3170 @ IF ABS(X)=1 THEN X=X*INF @ GOTO 40
1010 L=X @ X=LOG((1+X)/(1-X))/2 @ GOTO 40
1020 DISP "PI" @ GOSUB 3100 @ X=PI @ GOTO 40
1030 A$="STO " @ O$="" @ GOSUB 3030
1040 IF O$="" THEN A(E)=X @ GOTO 40
1050 IF O$="+" THEN A(E)=A(E)+X @ GOTO 40
1060 IF O$="-" THEN A(E)=A(E)-X @ GOTO 40
1070 IF O$="*" THEN A(E)=A(E)*X @ GOTO 40
1080 IF O$="/" THEN A(E)=A(E)/X @ GOTO 40
1090 IF FP(X)#0 AND A(E)<0 THEN 3190 ELSE A(E)=A(E)^X @ GOTO 40
1100 A$="RCL " @ O$="" @ GOSUB 3030
1110 IF O$="" THEN GOSUB 3100 @ X=A(E) @ GOTO 40
1120 IF O$="+" THEN X=X+A(E) @ GOTO 40
1130 IF O$="-" THEN X=X-A(E) @ GOTO 40
1140 IF O$="*" THEN X=X*A(E) @ GOTO 40
1150 IF O$="/" THEN X=X/A(E) @ GOTO 40
1160 IF X<0 AND FP(A(E))#0 THEN 3190 ELSE X=X^A(E) @ GOTO 40
1170 DISP "CL" @ FOR I=2 TO 7 @ A(I)=0 @ NEXT I @ GOTO 40
1180 DISP "CLREG" @ FOR I=0 TO 9 @ A(I)=0 @ NEXT I @ GOTO 40
1190 DISP "CLST" @ X,Y,Z,T=0 @ GOTO 40
1200 DISP "Mode:  Äegre  ";CHR$(210);"adian"
1210 GOSUB 3080 @ IF K$="B" OR K$=CHR$(8) THEN 40
1220 IF K$="D" THEN OPTION ANGLE DEGREES @ M$="degre" @ DISP M$ @ GOTO 40
1230 IF K$="R" THEN OPTION ANGLE RADIANS @ M$="radian" @ DISP M$ @ GOTO 40 ELSE 1210
1240 DISP "FIX IND X" @ IF ABS(X)≥12 THEN 3210
1250 F=ABS(IP(X)) @ DISP "FIX";F @ GOTO 40
1260 DISP "INT(X)" @ L=X @ X=IP(X) @ GOTO 40
1270 DISP "FRC(X)" @ L=X @ X=FP(X) @ GOTO 40
1280 DISP "X<> _" @ GOSUB 3010 @ DISP "X<>";E @ C=X @ X=A(E) @ A(E)=C @ GOTO 40
1290 DISP "VIEW _"
1300 GOSUB 3010 @ DISP "VIEW";E @ DELAY 2 @ DISP "R";STR$(E);" =";A(E) @ DELAY .
1 @ GOTO 40
1310 DISP "POL-REC en mode ";M$ @ C=COS(Y)*X @ X=SIN(Y)*X @ Y=C @ GOTO 40
1320 DISP "REC-POL en mode ";M$ @ C=ANGLE(X,Y) @ X=SQR(X^2+Y^2) @ Y=C @ GOTO 40
1330 DISP "H.MS-H" @ L=X @ X=(IP(X)*36+IP(FP(X)*100)*.6+FP(X*100))/36 @ GOTO 40
1340 DISP "H-H.MS" @ L=X @ C=3600*X @ X=MOD(C,60) @ C=C-X @ X=X/10000 @ D=MOD(C,3600)
1350 X=X+(C-D)/3600+D/6000 @ GOTO 40
1370 DISP "DEG-RAD" @ L=X @ X=RAD(X) @ GOTO 40
1380 DISP "RAD-DEG" @ L=X @ X=DEG(X) @ GOTO 40
1390 DISP "+" @ L=X @ X,A(2)=A(2)+1 @ A(3)=A(3)+L @ A(4)=A(4)+L^2 @ A(5)=A(5)+Y
1400 A(6)=A(6)+Y^2 @ A(7)=A(7)+X*Y @ M=0 @ GOTO 40
1410 DISP "-" @ L=X @ X,A(2)=A(2)-1 @ A(3)=A(3)-L @ A(4)=A(4)-L^2 @ A(5)=A(5)-Y
1420 A(6)=A(6)-Y^2 @ A(7)=A(7)-X*Y @ M=0 @ GOTO 40
1430 DISP "MEAN" @ GOSUB 3100 @ T=Z @ Z=Y @ Y=A(5)/A(2) @ X=A(3)/A(2) @ GOTO 40
1440 DISP "SDEV  "; @ GOTO 2980
1460 DISP "FACT(X)" @ IF FP(X)#0 THEN 3200
1470 L=X @ IF X>253 THEN X=INF*9 @ GOTO 40
1480 X=1 @ FOR C=1 TO L @ X=X*C @ NEXT C @ GOTO 40
1490 DISP "RAN#" @ GOSUB 3100 @ X=RND @ GOTO 40
2980 DISP "Non Existent" @ GOTO 40
3010 GOSUB 3080 @ IF K$="B" OR K$=CHR$(8) THEN 40
3020 IF K$≥"0" AND K$≤"9" THEN E=VAL(K$) @ RETURN ELSE 3010
3030 DISP A$;"_"
3040 GOSUB 3080 @ IF K$#"B" AND K$#CHR$(8) THEN 3060
3050 IF O$#"" THEN O$="" @ A$=A$[1,LEN(A$)-2] @ GOTO 3030 ELSE 40
3060 IF POS("+-*/^",K$)#0 AND O$="" THEN O$=K$ @ A$=A$&O$&" " @ GOTO 3030
3070 IF K$≥"0" AND K$≤"9" THEN DISP A$;K$ @ E=VAL(K$) @ RETURN ELSE 3040
3080 K$=KEY$ @ IF K$="" THEN 3080 ELSE RETURN
3090 Y=Z @ Z=T @ GOTO 40
3100 IF M=1 THEN T=Z @ Z=Y @ Y=X @ RETURN ELSE RETURN
3110 IF A=1 AND M=1 THEN A=0 @ T=Z @ Z=Y @ Y=X @ X=VAL(X$) ! A=1: XVAL(X$)  
3120 IF A=1 AND M=0 THEN A=0 @ X=VAL(X$) @ M=1 @ RETURN ELSE M=1 @ RETURN
3140 IF X>0 THEN RETURN
3150 POP @ BEEP @ IF X=0 THEN DISP "LOG(0)" @ GOTO 40
3160 DISP "LOG(neg number)" @ GOTO 40
3170 IF X<1 THEN RETURN ELSE POP
3180 DISP "arg out of range" @ BEEP @ GOTO 40
3190 DISP "neg^non-integer" @ BEEP @ GOTO 40
3200 DISP "X non-integer" @ BEEP @ GOTO 40
3210 DISP "Num too large" @ BEEP @ GOTO 40
5000 DISP "Do not run this line" @ BEEP @ END

Go back to the software library
Go back to the main exhibit hall