C MAIN LOGIC SUBROUTINE LOGIC INTEGER K,G,F1,R,S,L,M,EOL,EOS REAL F,H,A,V,V1,V2,B,B0,V0,A0,H0,V9,D,D1,H8,H9,D2,T,C,I LOGICAL*1 ANSI(2),VT52(11) LOGICAL*1 W1,W2 DATA ANSI/"33,"76/ DATA VT52/"33,"133,"77,"62,"154,"33,"134,"33,"110,"33,"112/ L=0 M=0 EOS="112 EOL="113 TYPE 799,ANSI,VT52 !VT100 TO VT52 COMPATIBILITY MODE TYPE 800 TYPE 801 TYPE 802 TYPE 805 1 K=ITTINR() IF(K.LT.0)GO TO 1 2 IF(ITTOUR(K).NE.0)GO TO 2 IF((K.EQ."116).OR.(K.EQ."156))GO TO 5 CALL HOME CALL ERASE(EOS) CALL PAGE1 K=ITTINR() !SLUFF CR FROM PREVIOUS READ 3 CALL ISLEEP(0,0,1,0) K=ITTINR() IF (K.NE.13) GO TO 3 TYPE 815 CALL HOME CALL ERASE(EOS) CALL PAGE2 4 CALL ISLEEP(0,0,1,0) K=ITTINR() IF (K.NE.13) GO TO 4 5 CALL IPOKE("44,"50100.OR.IPEEK("44)) TYPE 815 CALL HOME CALL ERASE(EOS) CALL PANEL D=32000 D1=30000 I=0 T=0 C=281 C1=281 S=0 G=0 A0=7 B0=0 V0=0 H0=2300 V9=0 F=1000 F1=1 H=2500 A=8 B=25 V=125 V1=0 V2=0 10 A1=-32+V*SIN(A*6.28318531/180) H=H+V1+(.5*A1) V1=V1+A1 V1=(V1+V2)/2 V2=V1 V=V-(.1*V)+(.5*B)-(.4*V1)-(10*G) IF(V.GT.55)GO TO 13 S=1 13 IF(V.LT.80)GO TO 15 S=0 15 IF(S.EQ.0)GO TO 17 A=A-2 H=H-50 17 F=F-ABS(B/4) IF(V.GT.64)GO TO 19 IF(G.EQ.1)GO TO 19 W1=58 W2=10 CALL CURFOR(W1,W2) TYPE 910 CALL ISLEEP(0,0,0,30) CALL CURFOR(W1,W2) TYPE 911 CALL ISLEEP(0,0,0,30) GO TO 20 19 CALL ISLEEP(0,0,1,0) 20 W1=58 W2=6 CALL CURFOR(W1,W2) Z=RAN(L,M) K=ITTINR() IF (K.LT.0) GO TO 32 IF (K.EQ.65) GO TO 22 IF (K.NE.26) GO TO 23 22 A=A+1 GO TO 20 23 IF (K.EQ.66) GO TO 24 IF (K.NE.11) GO TO 25 24 A=A-1 GO TO 20 25 IF (K.EQ.68) GO TO 26 IF (K.NE.8) GO TO 27 26 B=B-1 GO TO 20 27 IF (K.EQ.67) GO TO 28 IF (K.NE.24) GO TO 29 28 B=B+1 GO TO 20 29 IF (K.NE.49) GO TO 30 CALL LEFT(T) GO TO 20 30 IF (K.NE.50) GO TO 31 CALL LEVEL(T) GO TO 20 31 IF (K.NE.51) GO TO 20 CALL RIGHT(T) GO TO 20 32 IF(H.GT.0)GO TO 37 IF(G.EQ.1)GO TO 33 IF(V1.LT.-10)GO TO 300 IF(D.GT.1500)GO TO 320 IF(D.LT.-2500)GO TO 320 IF(R.EQ.1)GO TO 37 IF(V.GT.100)GO TO 200 33 H=0 V1=0 G=1 IF(A.GT.8.0)GO TO 35 A=8.0 35 A=A-1 IF(V.LT.15)GO TO 315 IF(B.EQ.0)GO TO 38 B=B-1 GO TO 38 37 G=0 IF(R.EQ.0)GO TO 38 R=0 A=A-3 38 W1=3 W2=12 CALL CURFOR(W1,W2) TYPE 900,H W1=15 W2=12 CALL CURFOR(W1,W2) TYPE 900,V1 IF(F.GE.0)GO TO 39 F=0 F1=0 39 B=B*F1 W1=55 W2=6 CALL CURFOR(W1,W2) TYPE 900,F IF(B.LE.36.0)GO TO 40 B=36 40 IF(B.GE.0)GO TO 42 B=0 42 CALL POWER(B,B0) B0=B CALL SPEED(V,V0) V0=V CALL ATT(A,A0) A0=A CALL ALT(H,H0) IF(ABS(H-H0).LT.100.0)GO TO 45 H0=H 45 CALL CLIMB(V1,V9) IF(ABS(V9-V1).LT.1.6)GO TO 47 V9=V1 47 IF (T.EQ.0.) GO TO 50 C=C+T IF (C.LT.361.) GO TO 48 C=1 48 IF (C.GT.0.) GO TO 49 C=360 49 W1=31 W2=2 CALL CURFOR(W1,W2) TYPE 900,C 50 IF(C.NE.C1)GO TO 52 D=D-(1.5*V) 52 IF(G.EQ.1)GO TO 520 IF(D.LT.1500)GO TO 500 IF(D.LT.D1)GO TO 400 GO TO 10 200 A=A+3 R=1 H=20 GO TO 10 300 CALL HOME CALL ERASE(EOS) W1=30 W2=9 CALL CURFOR(W1,W2) CALL ISLEEP(0,0,1,0) TYPE 950 310 CALL ISLEEP(0,0,3,0) 315 CALL HOME CALL ERASE(EOS) CALL ISLEEP(0,0,1,0) GO TO 990 320 CALL HOME CALL ERASE(EOS) CALL ISLEEP(0,0,0,30) W1=10 W2=9 CALL CURFOR(W1,W2) TYPE 960 GO TO 310 400 D1=D1-500 W1=46 W2=1 CALL CURFOR(W1,W2) IF(D1.EQ.29500)GO TO 530 IF(D1.EQ.29000)GO TO 535 IF(D1.EQ.28000)GO TO 550 IF(D1.EQ.21000)GO TO 540 IF(D1.EQ.20000)GO TO 555 IF(D1.EQ.18000)GO TO 545 IF(D1.GT.17500)GO TO 10 H9=.0875*D IF(H.LT.H9-50)GO TO 420 IF(H.GT.H9+50)GO TO 440 IF(I.GT.2)GO TO 560 TYPE 700 IF(T.NE.0)GO TO 10 I=I+1 GO TO 10 420 H8=H9-H TYPE 720,H8 GO TO 10 440 H8=H-H9 TYPE 740,H8 GO TO 10 500 IF(D.GE.D1)GO TO 10 D1=D1-500 IF(D.GE.-2500)GO TO 510 IF (H.GT.100)GO TO 515 GO TO 300 510 D2=ABS(-3000-D1) W1=46 W2=1 CALL CURFOR(W1,W2) TYPE 790,D2 GO TO 10 515 W1=46 W2=1 CALL CURFOR(W1,W2) TYPE 760 GO TO 10 520 W1=46 W2=1 CALL CURFOR(W1,W2) TYPE 780 GO TO 10 530 TYPE 710 GO TO 10 535 TYPE 711 GO TO 10 540 TYPE 712 GO TO 10 545 TYPE 713 GO TO 10 550 C3=120 CALL COURSE(C3,C,C1,L,M) GO TO 10 555 C3=30 CALL COURSE(C3,C,C1,L,M) GO TO 10 560 I=0 C3=10 CALL COURSE(C3,C,C1,L,M) GO TO 10 700 FORMAT('+You are on glidepath '$) 710 FORMAT('+ You are in radar contact'$) 711 FORMAT('+ Descend to 1500 feet '$) 712 FORMAT('+ Slow aircraft to 90 mph '$) 713 FORMAT('+ Begin 10 fps descent '$) 720 FORMAT('+You are '$,F4.0,'feet low '$) 740 FORMAT('+You are '$,F4.0,'feet high '$) 760 FORMAT('+Missed approach-go around'$) 780 FORMAT('+ NICE LANDING!!! '$) 790 FORMAT('+',F5.0,' feet of runway left'$) 799 FORMAT (13A1) 800 FORMAT (' AIRCRAFT INSTRUMENT FLIGHT SIMULATION GAME') 801 FORMAT (' By Bill Greene, DIGITAL EQUIPMENT CORP.') 802 FORMAT (' Edited & Modified by Les Parent, DIGITAL') 805 FORMAT (' Do you need instructions?'$) 810 FORMAT (A3) 815 FORMAT(' ') 820 FORMAT(A1) 900 FORMAT ('+',F5.0$) 910 FORMAT('+*'$) 911 FORMAT('+ '$) 950 FORMAT ('+NOW YOU DID IT!!!'$) 960 FORMAT('+How did we get in this cornfield???'$) 980 FORMAT(' Do you want to fly again ? '$) 990 CALL HOME CALL ERASE(EOS) TYPE 980 995 K=ITTINR() CALL ISLEEP(0,0,3,0) IF(K.LT.0)GO TO 995 996 IF(ITTOUR(K).NE.0)GO TO 996 IF((K.NE."116).AND.(K.NE."156))GO TO 5 RETURN END