SHARE |
|
PDP 8 Focal | by Bill Degnan - 07/14/2013 18:53 |
Digital Equipment Corporation came up with FOCAL to help teach programming. It's different than BASIC and the structure of the coding is different. Below is a dump of a PDP 8 session I ran to illustrate some code examples in FOCAL. The commands are in bold, to differentiate from the screen output. The program samples do not all work correctly. It will now be easier to edit and diagnose using a modern PC.
----------------------- FIELD SERVICE PDP-8 DIAGNOSTIC SYSTEM . . . VERSION 8.03 OS/8 V3D DECX8 REV. D RESTART ADDRESS =07600 TYPE TYPE: .R PROGNAME - TO RUN A SYSTEM PROGRAM .R PROGNAME.DG - TO RUN A DIAGNOSTIC PROGRAM .HELP FILENAME - TO TYPE A HELP FILE ON THE TERMINAL .HELP FILENAME - L - TO LIST A HELP FILE ON THE LINE PRINTER .SU BOOK - TO PRINT A COPY OF THE DIAG. HELP FILES "FILENAME" / "PROGNAME" = THE FILE OR PROGRAM TO LIST OR RUN .DIR RKB1:*.FC HELP .FC 6 ADDEX .FC 2 PLOTER.FC 5 CATLOG.FC 3 BARON .FC 6 POLAR .FC 4 FADTES.FC 1 TRIANG.FC 4 GRAPH .FC 5 INTRST.FC 3 CALNDR.FC 3 HARMON.FC 4 CHISQR.FC 5 HANGMN.FC 5 WEB .FC 3 STAT1 .FC 6 HANOI .FC 5 BTLSHP.FC 7 STAT2 .FC 5 322 FREE BLOCKS .R PFOCAL DO YOU WANT THE STANDARD FEATURES OF PS/8 FOCAL, 1971? Y PROCEED. *LIBRARY GO RKB1:HANOI NO. OF DISKS? 3 MOVES OR PLOTS? PLOTS [snip here] AUTO OR MANUAL? AUTO [snip here] DONE ! *WRITE ALL C-PS/8 FOCAL, 1971 01.01 C HANOI BY DEC 01.02 C FROM 'PROGRAMMING LANGUAGES' 01.03 C LAST CHANGE: 8/7/71 01.04 01.05 C THIS PROGRAM WORKS WITH THE TOWERS OF HANOI PROBLEM. 01.06 C YOU ARE GIVEN THREE TOWERS WITH VARIOUS SIZED DISCS ON 01.07 C ONE OF THEM. THE OBJECT IS TO PLACE ALL THE DISCS ON 01.08 C ANOTHER TOWER ON AT A TIME, WITH THE STIPULATION THAT A 01.09 C LARGER DISC MAY NEVER BE ON TOP OF A SMALLER ONE. THIS 01.10 C PROGRAM IS GOOD FOR ANY NUMBER OF DISCS AND CAN BE RUN 01.11 C EITHER IN MANUAL (YOU TELL IT WHERE TO MOVE) OR AUTOMATIC 01.12 C MODE. IT WILL ALSO EXPLAIN ITS MOVES OR DRAW THE FOR YOU, 01.13 C DEPENDING ON HOW YOU ANSWER THE 'MOVES OR PLOTS' QUESTION. 01.14 C ** OUT DISC IS THE DISC (1 ON TOP) THAT YOU WANT TO MOVE 01.15 C ** IN DISC IS THE POSITION (1 ON TOP) WHERE YOU MOVE TO 01.16 C ** OUT TOWER IS THE TOWER (1 ON LEFT) FROM WHICH YOU MOVE 01.17 C ** IN TOWER IS THE TOWER (3 ON RIGHT) YOU MOVE TO 01.18 C THIS PROGRAM ASSUMES NO CHEATING, AND DOES NOT CHECK FOR IT. 01.19 01.29 E 01.30 A "NO. OF DISKS? "N,! 01.40 F I=1,N;S SS(I)=I 01.50 S SO=1;S SI=3 01.60 S NO=N;S NI=N;S I=0 01.70 A "MOVES OR PLOTS? ",MOVE,! 01.80 I (FABS(MO-0MOVES)) ,1.85;D 23 01.85 A "AUTO OR MANUAL? ",A,! 01.90 I (FABS(A-0MANUAL)),5.1;D 2;T !!"DONE !",!!;Q 02.20 I [SS<(SO-1)*N+NO-1>]ER,2.95 02.30 S I=I+1;S NO(I)=NO;S SO(I)=SO;S SI(I)=SI 02.50 S SI=6-SO-SI;S NO=NO-1;D 3;S TE(I)=NI;D 2 02.60 S SI=SI(I);S NO=NO+1;D 3;D 6 02.70 S SO=6-SO-SI;S NO=TE(I);D 3;D 2 02.80 S SI=SI(I);S SO=SO(I);S NO=NO(I);S I=I-1 02.90 R 02.95 D 3;D 6;R 03.10 S NI=N 03.20 I [SS((SI-1)*N+NI)]ER,3.3;S NI=NI-1;G 3.2 03.30 R 05.10 A "OUT-DISC: ",NO,"TOWER: ",SO 05.20 A !"IN-DISC: ",NI,"TOWER: ",SI,!;D 6 05.30 S A=0 05.40 F I=1,N*2;S A=A+SS(I) 05.50 I (-A) 5.1;T !"WELL DONE!"!;Q 06.10 S DO=(SO-1)*N+NO 06.20 S DI=(SI-1)*N+NI 06.30 S SS(DI)=SS(DO) 06.40 S SS(DO)=0 06.50 I (MOVE)ER,6.7;D 23;R 06.70 T !%2,?SO, NO,!SI, NI,?! 23.10 F J=1,N;T !;F K=0,70;D 23.3 23.20 T !!!!;R 23.30 I [K-15+SS(J)*2]23.6;I (-K+15+SS(J)*2)23.6;T "# 23.60 I (K-35+SS(J+N)*2) 23.7;I (-K+35+SS(J+N)*2) 23.7;T "# 23.70 I (K-55+SS(J+N+N)*2) 23.8;I (-K+55+SS(J+N+N)*2)23.77;T "# 23.77 S K=100;R 23.80 T " " *LIBRARY LIST RKB1:*.FC HELP .FC 6 CATLOG.FC 3 FADTES.FC 1 INTRST.FC 3 CHISQR.FC 5 STAT1 .FC 6 STAT2 .FC 5 ADDEX .FC 2 BARON .FC 6 TRIANG.FC 4 CALNDR.FC 3 HANGMN.FC 5 HANOI .FC 5 PLOTER.FC 5 POLAR .FC 4 GRAPH .FC 5 HARMON.FC 4 WEB .FC 3 BTLSHP.FC 7 *LIBRARY GO RKB1:INTRST PRINCIPAL: 200000 INTEREST RATE: 4.38 TERM (IN MONTHS): 30 PRINCIPAL: 200000.0 PAYMENTS 7050.47 PAYMENT INTEREST PRINCIPAL BALANCE 1 730.00 6320.47 193679.53 2 706.93 6343.54 187335.98 3 683.78 6366.70 180969.29 4 660.54 6389.94 174579.35 5 637.22 6413.26 168166.09 6 613.81 6436.67 161729.42 7 590.31 6460.16 155269.26 8 566.73 6483.74 148785.52 9 543.07 6507.41 142278.12 10 519.32 6531.16 135746.96 11 495.48 6555.00 129191.96 12 471.55 6578.92 122613.04 13 447.54 6602.94 116010.10 14 423.44 6627.04 109383.06 15 399.25 6651.23 102731.84 16 374.97 6675.50 96056.33 17 350.61 6699.87 89356.47 18 326.15 6724.32 82632.14 19 301.61 6748.87 75883.28 20 276.97 6773.50 69109.78 21 252.25 6798.22 62311.55 22 227.44 6823.04 55488.52 23 202.53 6847.94 48640.58 24 177.54 6872.94 41767.64 25 152.45 6898.02 34869.62 26 127.28 6923.20 27946.42 27 102.01 6948.47 20997.95 28 76.64 6973.83 14024.12 29 51.19 6999.29 7024.83 30 25.64 7024.83 0.00 TOTAL INTEREST 11514.2 PRINCIPAL: 10000 INTEREST RATE: 5 TERM (IN MONTHS): 24 PRINCIPAL: 10000.00 PAYMENTS 438.71 PAYMENT INTEREST PRINCIPAL BALANCE 1 41.67 397.05 9602.95 2 40.01 398.70 9204.25 3 38.35 400.36 8803.89 4 36.68 402.03 8401.86 5 35.01 403.71 7998.15 6 33.33 405.39 7592.76 7 31.64 407.08 7185.69 8 29.94 408.77 6776.91 9 28.24 410.48 6366.44 10 26.53 412.19 5954.25 11 24.81 413.91 5540.34 12 23.09 415.63 5124.72 13 21.35 417.36 4707.35 14 19.61 419.10 4288.25 15 17.87 420.85 3867.41 16 16.12 422.60 3444.81 17 14.35 424.36 3020.45 18 12.59 426.13 2594.32 19 10.81 427.91 2166.42 20 9.03 429.69 1736.73 21 7.24 431.48 1305.25 22 5.44 433.28 871.98 23 3.63 435.08 436.89 24 1.82 436.89 0.00 TOTAL INTEREST 529.13 *LIBRARY CALL RKB1:TRIANG *WRITE C-PS/8 FOCAL, 1971 01.01 C FROM TRIANG IN 'PROGRAMMING LANGUAGES' COPYRIGHT 1970 01.02 C BY DIGITAL EQUIPMENT CORP. REWRITTEN BY JOHN HUISMAN 01.03 C OMSI SOFTWARE DEVELOPMENT GROUP 01.04 C LAST CHANGE: 8/19/71 01.05 01.06 C GIVEN THREE PIECES OF INFORMATION /I A2 01.07 C ABOUT THE TRIANGLE SHOWN AT THE RIGHT / I 01.08 C THIS PROGRAM WILL DETERMINE THE OTHER / I 01.09 C THREE PIECES. HOWEVER, YOU MUST HAVE S3 / I 01.10 C THE INPUT IN THE RIGHT ORDER. THERE- / I S1 01.11 C FORE, WHEN ASKED "TYPE", RESPOND WITH /AREA I 01.12 C "ASA" TO INPUT ANGLE-SIDE-ANGLE DATA, / I 01.13 C OR "SAS" FOR SIDE-ANGLE-SIDE INPUT OR A1 /-------I A3 01.14 C "SSS" IF YOU KNOW THE SIDE LENGTHS. S2 01.15 C ** THIS MUST BE A RIGHT TRIANGLE. 01.16 C ** BECAUSE OF THE ARCTANGENT FUNCTION, 01.17 C LENGTHS MUST BE UNDER ONE MILLION UNITS. 01.18 01.26 I (FITR(#/6)-(#/6)) 1.27,1.3,1.27 01.27 T "YOU DO NOT HAVE ENOUGH FEATURES. " 01.28 T "RESTART FOCAL WITH FEATURE 2.";Q 01.29 E 01.30 A "TYPE: ",TY;S A3=3.14159/2;I (FABS(TY-0ASA)) ,2.1 01.40 I (FABS(TY-0SAS)) ,3.1;I (FABS(TY-0SSS)) ,4.1 01.50 T !"LIST GROUP 1 FOR INSTRUCTIONS.",!!;Q 02.10 D 6;A "A1: ",A1,!"S2: ",S2, 02.20 I (FABS(DS)) ,2.3;S A1=A1*3.14159/180;S A2=3.14159/2-A1 02.30 S S3=S2/FCOS(A1);S S1=FSQT(S3*S3-S2*S2) 02.40 T !!:10,"RADIANS",:26,"DEGREES",! 02.50 T !,"A1:",:7,A1,:24,A1*57.2958 02.55 T !,"A2:",:7,A2,:24,A2*57.2958 02.60 T !,"A3:",:7,A3,:24,A3*57.2958 02.65 T !!"S1:",S1 02.70 T !"S2:",S2 02.80 T !"S3:",S3 02.90 T !!"AREA =",%4.02,S1*S2/2,!!;G 1.29 03.10 A "S1: ",S1,!"S2: ",S2 03.20 S S3=FSQT(S1*S1+S2*S2);S A1=FATN(S1/S2) 03.30 S A2=A3-A1;G 2.4 04.10 A !"S1: ",S1,!"S2: ",S2,!"S3: ",S3,! 04.20 S A1=FATN(S1/S2);S A2=A3-A1;G 2.4 06.10 A "ARE YOUR ANGLES IN DEGREES? ",ANSWER 06.20 I (-FABS(AN-0YES)) 6.3;S DSWITCH=1;R 06.30 I (-FABS(AN-0NO)) 6.4;S DSWITCH=0;R 06.40 T "YES OR NO.",!;G 6.1 *LIBRARY GO RKB1:TRIANG TYPE: ASA ARE YOUR ANGLES IN DEGREES? Y YES OR NO. ARE YOUR ANGLES IN DEGREES? YES A1: 60 S2: 40 RADIANS DEGREES A1: 1.0472 60.0000 A2: 0.5236 30.0000 A3: 1.5708 90.0000 S1: 69.2819 S2: 40.0000 S3: 79.9999 AREA = 1386 TYPE: SSS S1: 10 S2: 10 S3: 10 RADIANS DEGREES A1: 0.79 45.00 A2: 0.79 45.00 A3: 1.57 90.00 S1: 10.00 S2: 10.00 S3: 10.00 AREA = 50.00 *LIBRARY CALL RKB1:GRAPH *WRITE C-PS/8 FOCAL, 1971 01.01 C GRAPH BY STEVE POULSEN 01.02 C OMSI SOFTWARE DEVELOPEMENT GROUP 01.03 C LAST CHANGE: 8/19/71 01.04 C ***** TEKTRONIX T-4002 GRAPHICS TERMINAL REQUIRED ***** 01.05 01.06 C THIS PROGRAM WILL GRAPH ANY TWO DIMENSIONAL EQUATION ON AN 01.07 C EUCLIDEAN GRAPH. TYPE ANYTHING BUT YES IF YOU WANT TO INPUT AN EQUATION 01.08 C WHEN ASKED IF THE EQUATION IS IN, AND THE COMPUTER WILL INTERRUPT 01.09 C THE PROGRAM AND ALLOW YOU TO MODIFY ITS INPUT EQUATION. IF YOU CHOOSE 01.10 C NOT TO MODIFY THE EQUATION THE PROGRAM WILL ASSUME Y=FSIN(X). TYPE 01.11 C AN '=' AFTER THE CARRIAGE RETURN AND YOU WILL GET THE FIRST PART OF 01.12 C THE EQUATION SINCE IT IS IN MODIFY MODE. REMEMBER, THE EQUATION 01.13 C MUST BE Y IN TERMS OF X. 01.14 C ** X INCREMENT IS THE STEP WITH WHICH YOU WISH THE GRAPH TO GO. 01.15 C ** X OFFSET IS THE VERTICAL DISPLACEMENT FROM THE CENTER OF THE X AXIS. 01.16 C ** Y SCALING FACTOR SETS THE VERTICAL PLOT LIMIT OF THE SCREEN. 01.17 01.18 C WHEN INPUTING YOUR EQUATION, REMEMBER THAT YOU ARE USING MODIFY IN 01.19 C FOCAL SO SINE AND COSINE (AND ALL OTHERS) MUST BEGIN WITH F. 01.20 E 01.21 I ((#/3)-FITR(#/3)) 1.22,1.28,1.22 01.22 T "YOU DO NOT HAVE ENOUGH FEATURES. RESTART FOCAL WITH FEATURE 2.",!;Q 01.23 01.28 A !%6.03,"HAVE YOU ENTERED THE EQUATION?",A1;I (A1-0YES) 1.2,1.3; 01.29 T !"ENTER EQUATION OF Y IN TERMS OF X"!!;M 30.1 01.30 A !"LOWER LIMIT OF X?",X1,"UPPER LIMIT OF X?",X2,"X INCREMENT",X3 01.40 A !"X OFFSET?",X4,"Y SCALING FACTOR?",Y1 01.50 S XS=1000/(X2-X1);S XC=-X1*XS 01.60 S YS=Y1*XS 01.70 S YC=380+X4*YS 01.80 F Q7=0,.2,FOUT(24); 02.10 I (XC) 2.5;I (1020-XC) 2.5;S Q8=FDIS(0,XC,0)+FDIS(1,XC,780) 02.20 S D1=FITR(FLOG(50/YS)/FLOG(10));S DV=FEXP(D1*FLOG(10)) 02.25 S Q8=FOUT(1);T "Y UNITS:",DV 02.30 F U1=FITR(-YC/(YS*DV))*DV,DV,FITR((760-YC)/(YS*DV))*DV;D 5.1 02.50 I (YC) 3.1;I (780-YC) 3.1;S Q8=FDIS(0,0,YC)+FDIS(1,1020,YC) 02.60 S D1=FITR(FLOG(50/XS)/FLOG(10));S DV=FEXP(D1*FLOG(10)) 02.65 S Q8=FOUT(1);T !"X UNITS:",DV 02.70 F U1=FITR(-XC/(XS*DV))*DV,DV,FITR((1020-XC)/(XS*DV))*DV;D 5.2 03.10 S I=0 03.20 F X=X1,X3,X2;D 30.1;D 4 03.30 S Q8=FOUT(1);T !!!;Q 04.10 S XP=XC+X*XS;S YP=YC+Y*YS 04.40 S R=FSQT((510-XP)^2+(510-YP)^2);I (R-510) 4.5;S I=0 04.50 S Q9=FDIS(I,XP,YP);I (R-510) 4.6;R 04.60 S I=1 05.10 S Q8=FDIS(0,XC-5,YC+YS*U1)+FDIS(1,XC+5,YC+YS*U1) 05.20 S Q8=FDIS(0,XC+XS*U1,YC-5)+FDIS(1,XC+XS*U1,YC+5) 30.10 S Y=FSIN(X) *LIBRARY GO RKB1:CALNDR WHAT IS THE DATE? (MM/DD/YYYY) 07/14/2013 THE DAY IS SUNDAY WHAT IS THE DATE? (MM/DD/YYYY) [snip here] *LIBRARY CALL RKB1:BTLSHP *WRITE C-PS/8 FOCAL, 1971 01.01 C BTLSHP BY TOM KLOOS 01.02 C OMSI SOFTWARE DEVELOPMENT GROUP 01.03 C LAST CHANGE: 8/1/71 01.04 C ***** TEKTRONIX T-4002 TERMINAL AND JOYSTICK REQUIRED ***** 01.05 01.06 C YOU HAVE 20 SHOTS TO SINK 3 SHIPS. GUIDE THE CURSOR 01.07 C TO THE SQUARE YOU CHOOSE AND HIT THE SPACE BAR. TO MAKE ROOM FOR THE 01.08 C PROGRAM, GROUP 1 WILL BE ERASED. 01.11 I ((#/2)-FITR(#/2)) 1.12,1.14,1.12 01.12 T "YOU DO NOT HAVE ENOUGH FEATURES. RESTART FOCAL WITH FEATURE 1.";Q 01.14 O I ERASE;E 1 02.05 O I TTY:,E 02.10 S Z=FOUT(1)+FOUT(24);F Z=1,175; 02.20 T !!!!!!" W E L C O M E T O T H E G A M E O F B A T T L E S H I P S"!! 02.30 T !!!!! 03.21 T !!!!!"PLEASE WAIT WHILE THE ENEMY SHIPS MOVE INTO POSITION USA"; D 15;T !! 03.25 E 03.30 F M=1,36;S M(M)=0 03.35 G 3.45 03.40 S U=(S-1)*6+T;R 03.45 F X=1,3;D 4 03.50 S Q=0 03.55 S J=0;S Q=Q+1 03.60 S J=J+1;I ((M((Q-1)*6+J)+M((Q-1)*6+J+1)+M(Q*6+J)+M(Q*6+J+1))-4)3.7,3.25 03.70 I (J-5)3.6,3.6;I (Q-5)3.55,3.55;S R=0;G 5.1 04.10 S A=FITR(6*FRAN()+1);S B=FITR(6*FRAN()+1) 04.15 S S=A;S T=B;D 3.4; I (M(U))4.1,4.2,4.1 04.20 S C=FITR(3*FRAN()-1);I (6-(A+C))4.2;I (A+C-1)4.2 04.25 S D=FITR(3*FRAN()-1);I (6-(B+D))4.25;I (B+D-1)4.25 04.30 I (FABS(C)+FABS(D))4.35,4.2,4.35 04.35 S S=A+C;S T=B+D;D 3.4; I (M(U)-1)4.4,4.2 04.40 I (2-X)4.75 04.45 I (6-(A+C+C))4.55;I (A+C+C-1)4.55;I (6-(B+D+D))4.55;I (B+D+D-1)4.55 04.50 S S=A+C+C;S T=B+D+D;D 3.4;I (M(U))4.55,4.7 04.55 I (6-(A-C))4.1;I (A-C-1)4.1;I (6-(B-D))4.1;I (B-D-1)4.1 04.60 S S=A-C;S T=B-D;D 3.4;I (M(U)-1)4.65,4.1 04.65 S M(U)=1;G 4.75 04.70 S S=A+C+C;S T=B+D+D;D 3.4;S M(U)=1 04.75 S S=A+C;S T=B+D;D 3.4; S M(U)=1 04.80 S M((A-1)*6+B)=1 04.85 R 05.10 S R=0;S H=0;T %3.00;D 2.1;D 7 05.11 S R=R+1;I (7-H)11.1;I (20-R)10.1 05.12 S A1=FOUT(1);T !!!!;F A1=1,R;T ! 05.13 T "ROUND #"R 05.14 S A1=FJOY() 05.15 I (XJ-300)5.14;I (900-XJ)5.14;I (YJ-100)5.14;I (700-YJ)5.14 05.20 D 6 05.25 I (M(V))5.3,5.26,5.3 05.26 D 8;S M(V)=-2;G 5.11 05.30 I (M(V))5.11;S M(V)=-1;S H=H+1;D 9;G 5.11 06.10 S V=(FITR(YJ/100)-1)*6+FITR((XJ-200)/100) 06.20 S Z=FITR((V-1)/6);S XC=(V-Z*6)*100+250;S YC=Z*100+150 07.10 F XG=300,100,900;S Z=FDIS(0,XG,100)+FDIS(1,XG,700) 07.15 F YG=100,100,700;S Z=FDIS(0,300,YG)+FDIS(1,900,YG) 08.10 S Z=FDIS(0,XJ-7,YJ-7)+FDIS(1,XJ+7,YJ+7)+FDIS(0,XJ-7,YJ+7)+FDIS(1,XJ+7,YJ-7 ) 09.20 F X=0,.2,3.141592;D 9.4 09.30 R 09.40 S Z=FDIS(0,XC+50*FCOS(X),YC+50*FSIN(X))+FDIS(1,XC-50*FCOS(X),YC-50*FSIN(X) ) 10.10 D 2.1 10.20 T !!!!!!!!!!"Y O U A R E O U T"!! 10.21 T " O F"!! 10.22 T "A M M U N I T I O N"!! 10.23 T "A N D L U C K ....."!! 10.30 T !!!!"HERE IS HOW THE"!" HARBOR LOOKS:";D 12 10.40 S Z=FOUT(1);F Z=1,30;T ! 10.45 A "WOULD YOU LIKE TO "!"PLAY AGAIN?"Z 10.50 I (Z-0YES)10.51,,10.51 10.51 Q 11.10 D 2.1 11.20 T !!!!!!!!!"Y O U D I D I T................"!!! 11.30 T "Y O U S A N K A L L T H E S H I P S ! ! !"!!! 11.40 T !!!;G 10.45 12.10 D 7;F R=1,36;D 13 13.10 I (M(R))13.3,13.2,13.5 13.20 R 13.30 S V=R;D 6.2;I (M(R)+1)13.4;S XC=XC-30;S YC=YC-10;S Z=FDIS(0,XC,YC)+FOUT(15 9);T "H I T" 13.35 R 13.40 S XC=XC-23;S YC=YC-5;S Z=FDIS(0,XC,YC);T "MISS" 13.45 R 13.50 S V=R;D 6.2;S XC=XC-42;S YC=YC-10;S Z=FDIS(0,XC,YC)+FOUT(159);T "S H I P" 13.60 R 15.01 S X=FDIS(1,575,200) 15.02 S X=FDIS(1,625,150)+FDIS(1,800,150)+FDIS(1,850,200)+FDIS(1,575,200) 15.03 S X=FDIS(1,775,200)+FDIS(1,775,500)+FDIS(1,625,225)+FDIS(1,775,225) 15.04 S X=FDIS(1,775,515)+FDIS(1,745,505)+FDIS(1,775,505) *LIBRARY GO RKB1:BTLSHP ?23.05 @ 01.14 *LIBRARY CALL RKB1:FADTES *WRITE C-PS/8 FOCAL, 1971 01.01 S B=0 01.02 S A=FADC(4);T A,! 01.05 S B=B+1; I (B-20)1.02,1.02,1.20 01.20 Q *RUN *GO ?11.35 @ 01.02 *LIBRARY GO RKB1:FADTES ?11.35 @ 01.02 *WRITE C-PS/8 FOCAL, 1971 01.01 S B=0 01.02 S A=FADC(4);T A,! 01.05 S B=B+1; I (B-20)1.02,1.02,1.20 01.20 Q .R BASIC NEW OR OLD--NEW FILE NAME--LETTER READY Reply |
|
Focal Lunar Lander | by Bill Degnan - 07/15/2013 10:05 |
W A
C-FOCAL,1969 01.04 T "CONTROL CALLING LUNAR MODULE.MANUAL CONTROL IS NECESSARY"! 01.06 T "YOU MAY RESET FUEL RATE K EACH 10 SECS TO 0 OR ANY VALUE"! 01.08 T "BETWEEN 8&200 LBS/SEC.YOU'VE 16000 LBS FUEL.ESTIMATED"! 01.11 T "FREE FALL IMPACT TIME-120 SECS.CAPSULE WEIGHT-32500 LBS"! 01.20 T "FIRST RADAR CHECK COMING UP"!!! 01.30 T "COMMENCE LANDING PROCEDURE"!"TIME,SECS ALTITUDE," 01.40 T "MILES+FEET VELOCITY,MPH FUEL,LBS FUEL RATE"! 02.05 S L=0;S A=120;S V=1;S M=33000;S N=16500;S G=.001;S Z=1.8 02.10 T " ",%3,L," ",FITR(A)," ",%4,5280*(A-FITR(A)) 02.20 T %6.02," ",3600*V," ",%6.01,M-N," K=";A K;S T=10 02.70 T %7.02;I (K)2.72;I (200-K)2.72;I (K-8)2.71,3.1,3.1 02.71 I (K-0)2.72,3.1,2.72 02.72 T "NOT POSSIBLE";F X=1,51;T "." 02.73 T "K=";A K;G 2.7 03.10 I ((M-N)-.001)4.1;I (T-.001)2.1;S S=T 03.40 I ((N+S*K)-M)3.5,3.5;S S=(M-N)/K 03.50 D 9;I (I)7.1,7.1;I (V)3.8,3.8;I (J)8.1 03.80 D 6;G 3.1 04.10 T "FUEL OUT AT",L," SECS"! 04.40 S S=(-V+FSQT(V*V+2*A*G))/G;S V=V+G*S;S L=L+S 05.10 T "ON THE MOON AT",L," SECS"!;S W=3600*V 05.20 T "IMPACT VELOCITY OF",W,"M.P.H."!,"FUEL LEFT:" 05.30 T M-N," LBS."!;I (-W+1)5.5,5.5 05.40 T "PERFECT LANDING !-(LUCKY)"!;G 5.9 05.50 I (-W+10)5.6,5.6;T "GOOD LANDING-(COULD BE BETTER)"!;G 5.90 05.60 I (-W+25)5.7,5.7;T "CONGRATULATIONS ON A POOR LANDING"!;G 5.9 05.70 I (-W+60)5.8,5.8;T "CRAFT DAMAGE.GOOD LUCK"!;G 5.9 05.80 T "SORRY,BUT THERE WERE NO SURVIVORS-YOU BLEW IT!"!"IN" 05.81 T "FACT YOU BLASTED A NEW LUNAR CRATER",W*.277777,"FT.DEEP. 05.90 T "CONTROL OUT";QUIT 06.10 S L=L+S;S T=T-S;S M=M-S*K;S A=I;S V=J 07.10 I (S-.005)5.1;S S=2*A/(V+FSQT(V*V+2*A*(G-Z*K/M))) 07.30 D 9;D 6;G 7.1 08.10 S W=(1-M*G/(Z*K))/2;S S=M*V/(Z*K*(W+FSQT(W*W+V/Z)))+.05;D 9 08.30 I (I)7.1,7.1;D 6;I (-J)3.1,3.1;I (V)3.1,3.1,8.1 09.10 S Q=S*K/M;S J=V+G*S+Z*(-Q-Q^2/2-Q^3/3-Q^4/4-Q^5/5) 09.40 S I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30) * Reply |