home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d150
/
dc10.lha
/
DC10
/
DC10MIA.bas
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1987-06-15
|
22KB
|
531 lines
REM * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
REM * DC-10 Flightsimulation ( part 3 ), by Jan Arkesteijn, <C> 1988 *
REM * V 0.1f released in the public domain 9 april 1988, see doc file *
REM * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CLEAR,30000
start:
SCREEN 2,639,152,2,2
WINDOW 2,"DC-10-30 with autopilot by Jan Arkesteijn <C> 1988",,24,2
PALETTE 0,0,0,0:PALETTE 1,0,0.75,0:PALETTE 2,0,0.8,1:PALETTE 3,1,1,0
RANDOMIZE TIMER:DEFINT n-z:DIM rr%(40),ll%(40),uu%(40),dd%(40),z(12)
DECLARE FUNCTION AllocMem& LIBRARY :DECLARE FUNCTION DoIO% LIBRARY
DECLARE FUNCTION OpenDevice% LIBRARY :DECLARE FUNCTION AllocSignal% LIBRARY
DECLARE FUNCTION FindTask& LIBRARY :LIBRARY "exec.library"
mem&=2^0+2^16:port&=AllocMem&(33,mem&):IF port&=0 THEN PRINT"TROUBLE_1"
sB%=AllocSignal%(-1):IF sB%=-1 THEN PRINT"TROUBLE_2"
st&=FindTask&(0):port$="KbdPort"+CHR$(0)
POKE port&+ 8,4 :POKE port&+ 9,0 :POKEL port&+10,SADD(port$)
POKE port&+14,0 :POKE port&+15,sB%:POKEL port&+16,st&
POKEL port&+20,port&+24 :POKEL port&+28,port&+20: CALL AddPort(port&)
req&=AllocMem&(48,mem&):IF req&=0 THEN PRINT"TROUBLE_3"
kbd&=AllocMem&(13,mem&):IF kbd&=0 THEN PRINT"TROUBLE_4"
POKE req&+ 8,5 :POKE req&+ 9,0:POKEL req&+14,port&
POKEW req&+28,10:POKE req&+30,1:POKEL req&+36,13
POKEL req&+40,kbd&:dev$="keyboard.device"+CHR$(0)
fout%=OpenDevice(SADD(dev$),0,req&,0):IF fout%<>0 THEN PRINT"TROUBLE_5"
x0=16:x7=333:y0=20:y1=80:y5=333:qs=10
p1=13:p2=13:p3=13:p4=13:p6=15:p7=20:p8=20:p9=20
t1=4:t2=42:t3=315:t4=202:s4=13
mp=234000:v6=180:v9=158:wa=320:mz=250000:fl=15000
g1=9.81:mr=1:n0=25:n1=46:n2=110:h0=50:st(1)=16:st(2)=25
nt(1)=5:nt(2)=10:nt(3)=15:nt(4)=25:nt(5)=35:nt(6)=45:nt(7)=55
ca$="###.#":cb$="####.#"::cd$="\ \/###":cl$="#.##":cr$="##.#":cx$="#.#"
cs$="###":cv$="#####":co$=" ":cn$=" "
c0=0.0174533:c1=1.9417:c4=6078.7:c5=0.5:c9=0.0001:do=20160:e0=9e-06
q1=60:q2=90:q3=180:q4=360:q7=100:q9=1000:o1=1:o2=1:o3=1
CLS:COLOR 2,0
LINE(7,4)-(8,11),2,bf:AREA(3,3):AREA(12,3):AREA(8,0):AREA(7,0):AREAFILL
AREA(3,12):AREA (12,12):AREA(8,15):AREA(7,15):AREAFILL
LINE(16,3)-(23,3),2:AREA (31,3):AREA(24,1):AREA (24,5):AREAFILL
LINE(24,11)-(31,11),2:AREA(16,11):AREA(23,9):AREA(23,13):AREAFILL
GET(0,0)-(15,7),uu%:GET(0,8)-(15,15),dd%:GET(16,0)-(31,7),rr%
GET(16,8)-(31,15),ll%:CLS:COLOR 1,0
ak=158:al=ak:fx#=25.8603:fy#=-80.7555:f1=25.9633:f2=-80.46:dz=2140
f3=25.7767:f4=-80.7183:f9=25.79:f0=-80.195:by=52.5:bx=-130:bs=bx*bx+by*by
agn1:
CLS:LOCATE 2,3:PRINT"Enter All Up Weight (min 130, max 175 tons) ";
INPUT m:IF m<130 OR m>175 THEN agn1
ap=1.5+c5*INT((m-130)/9.1):aa=ap+1:m=m*q9:r0=RND*360:z(0)=2
w0=5+RND*4+((r0>50)*(r0<130)+(r0>230)*(r0<310))*RND*8
LOCATE 4,3:PRINT"V AT =";INT(v9*SQR(m/mz)+c5);" kt"
agn1a:
LOCATE 7,3:PRINT"Wind possibilities":LOCATE 9,3:PRINT"< 1 > No wind"
LOCATE 10,3:PRINT"< 2 > Normal wind (groundwind: ";
PRINT USING cd$;RIGHT$(STR$(q9+r0),3);c1*w0;:PRINT")"
LOCATE 11,3:PRINT"< 3 > Choose groundwindparameters"
LOCATE 13,3:PRINT"Enter your choice (1,2 or 3)":INPUT wp
IF wp<1 OR wp>3 THEN agn1a
IF wp=3 THEN
LOCATE 15,3:PRINT"Enter winddirection (0-360 degr) and windforce (0-18 kt)";
LOCATE 16,3:INPUT"###,##";r0,a0:w0=a0/c1
IF r0<0 OR r0>360 OR w0<0 OR w0>9 THEN agn1a
END IF
IF wp=1 THEN r0=0:w0=0 :ELSE r1=SGN(0.5-RND)*(5+RND*10):w2=5+RND*10:r2=r0+4*r1
GOTO rwy
rtn2:
LOCATE 2,4:PRINT RIGHT$(STR$(q7+th),2);":";RIGHT$(STR$(q7+tm),2);":";
PRINT RIGHT$(STR$(q7+ts),2):ts=ts+1
IF ts=q1 THEN tm=tm+1:ts=0:IF tm=q1 THEN th=th+1:tm=0
LOCATE 2,35:PRINT USING ca$;ABS(ap);
IF ap=0 OR (ap<0 AND apo>0) OR (ap>0 AND apo<0) THEN LOCATE 2,33:PRINT" ";
IF ap>0 THEN PUT(256,8),uu%,OR
IF ap<0 THEN PUT(256,8),dd%,OR
LOCATE 2,40:PRINT USING cs$;ABS(ab);
IF ab=0 OR (ab<0 AND abo>0) OR (ab>0 AND abo<0) THEN LOCATE 2,48:PRINT" ";
IF ab>0 THEN PUT(376,8),rr%,OR
IF ab<0 THEN PUT(376,8),ll%,OR
LOCATE 3,44
IF h=0 AND ap=0 AND xo=12 THEN PRINT USING cx$;ABS(an);
IF h=0 AND ap>0 AND ap<6 THEN PRINT co$;
IF an=0 OR (an<0 AND ano>0) OR (an>0 AND ano<0) THEN LOCATE 3,48:PRINT" ";
IF an>0 THEN PUT(376,16),rr%,OR
IF an<0 THEN PUT(376,16),ll%,OR
s1=ap:s2=ab/2:s3=ab/4:s4=44+s1
LINE (260,p1)-(264,p1),0
IF ABS(s1+s2)<28 THEN p1=s4+s2:LINE (260,p1)-(264,p1),3
LINE (292,p2)-(296,p2),0
IF ABS(s1+s3)<28 THEN p2=s4+s3:LINE (292,p2)-(296,p2),3
LINE (352,p3)-(356,p3),0
IF ABS(s1-s3)<28 THEN p3=s4-s3:LINE (352,p3)-(356,p3),3
LINE (388,p4)-(392,p4),0
IF ABS(s1-s2)<28 THEN p4=s4-s2:LINE (388,p4)-(392,p4),3
IF n1>70 THEN IF z1=5 AND h>z4 OR z1=10 AND h>z3 OR z1=15 AND z2<ts THEN o1=0
n3=n1-98-h/3500:n4=n4+n3:n5=n5+n3:IF n4<0 OR n5<0 THEN n4=0:n5=0
IF n4>600 THEN LOCATE 2,55:PRINT"*";:IF n4>630 THEN n4=630
IF n5>1200 THEN o1=0:IF n5>5000 THEN n5=5000
fh=(0.37+0.29*mn)*ABS(ma)/(g1*mr):fc=fh/3600:m=m-fc:fl=fl-fc:g=g1*m
IF fl<200 THEN o1=0:o2=0:o3=0:LOCATE 4,7:PRINT"EMPTY";:GOTO sct0
LOCATE 3,7:PRINT USING ca$;m/q9;:LOCATE 4,7:PRINT USING ca$;fl/q9;
LOCATE 5,7:IF fl>200 THEN PRINT USING ca$;fh/q9; :ELSE PRINT co$;
sct0:
IF n1>n0 OR n1<-n0 THEN n9=ABS(n1) :ELSE n1=n0*SGN(n1):n9=n0
LOCATE 9,52:IF o1=1 THEN PRINT USING cs$;n9; :ELSE PRINT" SD";
LOCATE 9,56:IF o2=1 THEN PRINT USING cs$;n9; :ELSE PRINT" SD";
LOCATE 9,60:IF o3=1 THEN PRINT USING cs$;n9: :ELSE PRINT" SD";
IF tr=1 AND sg<15 THEN tr=0:n1=n0:mr=1:LOCATE 10,52:PRINT" ";
LINE (417,p6)-(423,p6),0:LINE(454,p6)-(456,p6),0:LINE(460,p6)-(462,p6),0
LINE (493,p6)-(499,p6),0:p6=62-0.4*ABS(n1)
IF o1=1 THEN LINE (417,p6)-(423,p6),3
IF o2=1 THEN LINE (454,p6)-(456,p6),3:LINE(460,p6)-(462,p6),3
IF o3=1 THEN LINE (493,p6)-(499,p6),3
n=o1+o2+o3:LOCATE 10,57:IF n<3 THEN PRINT 3-n;"OUT"; :ELSE PRINT co$
ae=(do-dz)/(do+dz):ma=n1*ABS(n1)*c9*n*mr*mp*ae*(1-0.9*mn+c5*mn*mn)
af=0.6113*ae:bb=c0*ab:bk=c0*ak:bo=c0*ao:bp=c0*ap:co=COS(bo):io=SIN(bo)
IF h>h0 THEN dg=0.0476 :ELSE dg=0.0476-0.02*(1-h/h0)
cd=(0.001*(x0+xo+xr+dm)+dg*cl*cl+x7*1e-12*aa^7)*(1-(o1<>o3)*0.08)
IF dz>0 THEN gr=0:GOTO sct1 :ELSE gq=0.02*(g-li)*(bg*bg+15)/(bg*bg+5)
IF q=0 AND ma>0 AND ma<gq THEN gr=ma
IF q=0 AND ma<=0 AND ma>=gq THEN gr=gq
IF q=1 AND bg>1 THEN gr=gq :ELSE IF q=1 AND bg<=1 THEN gr=bg*gq
sct1:
IF bg>5 THEN bv=1 :ELSE bv=0.2*bg
IF h=0 AND uw=1 THEN bw=2*bv*(mz-q*(mz-m)) :ELSE bw=0
dr=af*bs*cd*wa:bn=ABS(bg*bg*an*c0/20)
aw=(ma*COS(bp)+(bg>1)*dr*co-gr-bw-li*io)/m:av=ABS(li*co*SIN(bb)/m)
ax=aw*COS(bk)+av*COS(bk+SGN(ab)*q2*c0)
ay=aw*SIN(bk)+av*SIN(bk+SGN(ab)*q2*c0)
IF uk=1 THEN bk=(rd-2+RND*3)*c0:bx=bh*COS(bk):by=bh*SIN(bk):uk=0
bx=bx+ax+bn*COS(bk+SGN(an)*q2*c0):IF bx=0 THEN bx=c9
by=by+ay+bn*SIN(bk+SGN(an)*q2*c0):bf=bx*bx+by*by:bh=SQR(bf)
IF bh>c9 THEN ak=ATN(by/bx)/c0+q2*(2-SGN(by)-SGN(bx)*SGN(by))
IF h=0 AND ABS(ak-al)>q2 THEN ak=ak+q3:ak=ak+(ak>q4)*q4:bh=-bh:wt=1
IF h<h0 THEN lg=1.05-0.001*h :ELSE lg=1
cl=(0.01*y0+0.001*y1*aa-1e-09*y5*aa*aa*aa*aa*aa)/SQR(1-mn*mn+mn^7)
IF aa>qs AND cl<0 THEN cl=0
li=af*lg*cl*wa*bs:az=(li*co*COS(bb)-g-dr*io+ma*SIN(bp))/m:bz=bz+az
cz=196.72*bz:IF dz<=0 AND bz<=0 THEN az=0:bz=0:cz=0
dz=dz+bz+c5*az:h=3.2787*dz:IF dz<=0 THEN dz=0:h=0
bs=bf+bz*bz:bt=(1+2*(wt=1))*SQR(bs):wt=0:s=c1*bt:si=s*SQR(ae*(1+0.25*mn*mn))
mn=bt/(340-0.0044*dz):ao=ATN(bz/(bh+c9))/c0:aa=ap+1-ao
IF aa<qs AND h>0 THEN LOCATE 3,36:PRINT cn$ :ELSE lstall
rtn3:
br=c0*(ak-wd+q3):cr=COS(br)
IF dz>0 THEN
bg=SQR(fw*fw+bf+2*fw*bh*cr):fd=ak-ATN(fw*SIN(br)/(bh+fw*cr))/c0
ELSE
bg=bh+fw*cr:fd=ak
IF bg<0.2 THEN bg=0
END IF
fd=fd+(fd>=q4)*q4-(fd<0)*q4
LOCATE 12,25:PRINT RIGHT$(STR$(q9+INT(ak+c5)),3);
LOCATE 12,58:PRINT RIGHT$(STR$(q9+INT(fd+c5)),3);
kl=ABS(ak-al):LOCATE 2,44:PRINT USING cx$;ABS(kl+(kl>q2)*q4);:al=ak
LOCATE 9,24:PRINT USING cs$;si;
LOCATE 7,9:PRINT USING cl$;mn;:LOCATE 10,40:PRINT USING cv$;h;
IF ABS(cz)<9999 THEN
LOCATE 10,24:PRINT USING cv$;cz;:LOCATE 10,23:PRINT":";
ELSE
LOCATE 10,24:PRINT USING cv$;9999*SGN(cz);:LOCATE 10,23:PRINT">";
END IF
sg=c1*bg:LOCATE 8,9:PRINT USING cs$;s;:LOCATE 10,9:PRINT USING cs$;sg;
LOCATE 9,6:PRINT USING cd$;RIGHT$(STR$(q9+wd-(wd<0)*q4),3);c1*fw;
LOCATE 2,55:PRINT" ";
LINE(182,p7)-(188,p7),0
IF si>90 AND si <410 THEN p7=74-si/6.25:LINE(182,p7)-(188,p7),3
z=z+1:IF z=7 THEN z=1
IF z<>2 THEN sct2
IF dz<2000 THEN fw=w0+(w2-w0)*dz/2000:wd=r0+r1*dz/500 :ELSE fw=w2:wd=r2
sct2:
IF z=3 OR z=6 THEN
LINE (t1,t2)-(t1+2,t2+1),0,bf:ba=ak*c0:t1=186+18*SIN(ba):t2=115-8*COS(ba)
LINE (t1,t2)-(t1+2,t2+1),2,bf
END IF
fx#=fx#+(bg*COS(fd*c0)+c5*ax)*e0:gx=fx#
fy#=fy#+(bg*SIN(fd*c0)+c5*ay)*e0/COS(gx*c0):gy=fy#
IF z=1 THEN fa=f1:fb=f2
IF z=4 THEN fa=f3:fb=f4
IF z=5 THEN fa=f9:fb=f0
IF z=2 OR z=3 OR z=6 THEN sct3
da=(gx-fa)*q1:db=(gy-fb)*q1*COS((fa+gx)*c5*c0):IF da=0 THEN da=c9
ra=ATN(db/da)/c0+q2*(2-SGN(db)-SGN(da)*SGN(db))
re=q3-fd+ra+c5:re=re+(re>=q4)*q4-(re<0)*q4
ra=ra+(z=5)*q3+c5:ra=ra-(ra<0)*q4+(ra>=q4)*q4
LOCATE 12+z+(z=5)*4,76+(z=5)*70:PRINT RIGHT$(STR$(q9+ra),3);
IF z<>1 THEN LOCATE 13+z+(z=5)*4,71+(z=5)*65:PRINT RIGHT$(STR$(q9+re),3);
IF z=1 OR z=4 THEN
wv=SQR(da*da+db*db):di=4+0.5*wv:LOCATE 12+z,66:PRINT USING ca$;wv;
END IF
IF z=5 THEN re=ra
be=re*c0:ce=COS(be):ie=SIN(be)
IF z=1 THEN
LINE(t6,t7)-(t6+2,t7+1),0,bf
IF wv<30 THEN t6=452+2.2*di*ie:t7=114-di*ce:LINE(t6,t7)-(t6+2,t7+1),2,bf
END IF
IF z=4 THEN
LINE(t8,t9)-(t8+2,t9+1),0,bf
IF wv<30 THEN t8=452+2.2*di*ie:t9=114-di*ce:LINE(t8,t9)-(t8+2,t9+1),3,bf
END IF
IF z=5 THEN
LINE(s8,s9)-(s8+2,s9+1),0,bf
s8=188+25*ie:s9=115-11*ce:LINE(s8,s9)-(s8+2,s9+1),3,bf
END IF
sct3:
IF z=2 OR z=5 THEN
fa=f5:fb=f6
ELSEIF z=3 OR z=6 THEN
fa=f7:fb=f8
ELSE
GOTO sct4
END IF
da=(fa-gx)*q1:db=(fb-gy)*q1*COS((fa+gx)*c5*c0):IF da=0 THEN da=c9
dv=SQR(da*da+db*db)+c9
IF z=2 OR z=5 THEN
am=ATN(db/da)/c0+q2*(2-SGN(db)-SGN(da)*SGN(db))
aho=ah:ah=rd-am:eb=dv*ah:ea=ABS(eb):dt=dv
ELSE
GOTO sct5
END IF
IF h=0 THEN
LOCATE 17,1 :PRINT"REMAIN:";:PRINT USING cv$;dv*c4-q9;:PRINT" FT";
ELSE
GOTO sct6
END IF
ab=0:IF dv<du AND dv>0.16 AND ea<1 THEN sct7
IF dv<du+1 AND dv>du AND ABS(ah)<3 THEN crash1
IF dv<du AND dv>0.16 AND ea>1 AND ea<3 AND ah<45 THEN crash4
IF dv <0.16 AND ea<1 THEN crash5
GOTO crash9
sct7:
IF xo<>12 THEN crash7
IF cz<=-700 THEN crash2
IF cz<-400 AND cz>-700 THEN uv=1
IF sg=0 AND uv=1 THEN crash3
sct6:
IF q<>1 THEN sct4
LOCATE 17,35
IF ABS(ah)<=5 THEN PRINT USING cx$;ABS(ah);
IF ah>5 THEN PRINT" LE";
IF ah<-5 THEN PRINT" RI";
IF ah=0 OR (ah>0 AND aho<0) OR (ah<0 AND aho>0) THEN LOCATE 17,33:PRINT" ";
IF ah>0 THEN PUT(256,128),ll%,OR
IF ah<0 THEN PUT(256,128),rr%,OR
GOTO sct4
sct5:
IF h>0 THEN LOCATE 17,1:PRINT"TO GO:";: PRINT USING cb$;dv;:PRINT" NM";
IF q<>1 THEN sct4
am=ATN(h/(dv*c4))/c0:aio=ai:ai=am-3
IF h<50 THEN LOCATE 17,43:PRINT co$;:GOTO sct8
LOCATE 17,43
IF ABS(ai)<=1 THEN PRINT USING cx$;ABS(ai);
IF ai>1 THEN PRINT" DN";
IF ai<-1 THEN PRINT" UP";
IF ai=0 OR (ai>0 AND aio<0) OR (ai<0 AND aio>0) THEN LOCATE 17,46:PRINT" ";
IF ai>0 THEN PUT(360,128),dd%,OR
IF ai<0 THEN PUT(360,128),uu%,OR
sct8:
LINE(t3,90)-(t3+1,122),0,bf:t3=315-9.6*(ah+(ah>5)*(ah-5)+(ah<-5)*(ah+5))
LINE(t3,90)-(t3+1,122),3,bf:LINE(267,t4)-(363,t4),0
t4=106+16*(ai+(ai>1)*(ai-1)+(ai<-1)*(ai+1)):LINE(267,t4)-(363,t4),3
LOCATE 4,40
IF ABS(ah)<2 THEN
IF dv<4.2 AND dv>3.8 THEN
PRINT"O M";:uom=1
ELSEIF dv<0.7 AND dv>0.5 AND dt>du THEN
PRINT"M M";
ELSE
PRINT co$;:uom=0
END IF
END IF
x2=(4-n)*100:LOCATE 9,40
IF h<x2+30 AND h>x2-10 AND xl=0THEN PRINT"D H"; :ELSE PRINT co$;
IF h<x2+30 AND h>x2-20 AND xl=0THEN
IF ABS(ai)>0.7 OR ABS(ah)>c5 OR ABS(fd-rd)>3 THEN LOCATE 9,40:PRINT"O S";
END IF
sct4:
cw=SQR(m/mz):v2=v6*cw:v1=v2-15:vr=v2-8:va=v9*cw+(3-n)*5
IF v1>160 THEN v1=160
LOCATE 5,25
IF si>380 AND h<24000 THEN PRINT"V MO";:GOTO sct9
IF mn>0.88 AND dh>=24000 THEN PRINT"M MO";:GOTO sct9
IF si>v2-2 AND si<v2+5 AND nt=3 AND q=0 THEN PRINT"V 2 ";:GOTO sct9
IF si>va-5 AND si<va+5 AND nt=7 AND q=1 AND h>0 THEN PRINT"V AT";:GOTO sct9
IF si>vr-2 AND si<vr+5 AND nt=3 AND q=0 AND h=0 THEN PRINT"V R ";:GOTO sct9
IF si>v1-5 AND si<v1+2 AND q=0 AND h=0 THEN PRINT"V 1 ";:GOTO sct9
PRINT" ";
sct9:
IF st=su AND nt=nu THEN sct10
su=st:nu=nt:y0=20+2*nt(nt):y5=-17*(st(st)>5)+1000/(st(st)+3)+2*nt
x0=16+0.4*st(st)+1.3*nt(nt):x7=1000/(st(st)+3)+4*nt(nt)
qs=11+0.4*st(st)-nt(nt)/8
LINE(548,p8)-(552,p8),0:p8=20+0.64*st(st):LINE(548,p8)-(552,p8),3
LINE(598,p9)-(602,p9),0:p9=20+0.58*nt(nt):LINE(598,p9)-(602,p9),3
sct10:
IF uc=1 AND xo<12 THEN xo=xo+1:LOCATE 10,73:PRINT"* "; :ELSE sct11
IF xo>= 12 THEN xo=12:LOCATE 10,73:PRINT"DN";
sct11:
IF uc=0 AND xo>0 THEN xo=xo-1:LOCATE 10,73:PRINT" *"; :ELSE api1
IF xo<=0 THEN xo=0:LOCATE 10,73:PRINT"UP";
api1:
IF xt+xf=0 THEN api2
IF h<20-cz/50 AND h>10 AND (z=2 OR z=5) THEN uos=1 :ELSE uos=0
IF uos=1 AND (ea>0.8 OR dv>du+0.3+cz/3000 OR dv<1) THEN
uos=0:os=1:LOCATE 7,40:PRINT"AOS";:LOCATE 8,40:PRINT"AOS";
END IF
IF os=1 THEN ap=ap+2:IF ap>10 THEN ap=10
IF os=1 THEN n1=n1+10:IF n1>90 THEN n1=90
IF os=1 AND ap=10 AND n1=90 THEN
os=0:xl=0:xf=0:xt=0:ur=0:tz=0:ty=0:tx=0:tw=0:tv=0
LOCATE 7,40:PRINT" ";:LOCATE 8,40:PRINT" ";
END IF
IF os=1 THEN kbd
api2:
IF xl=0 THEN api3
IF tz=0 THEN tz=1:rb=rd-eb
tz=tz+1:IF tz<20 THEN ar=rb:sn=1 :ELSE ar=rd+0.02*(ak-fd)-eb:sn=-1
IF ABS(ar-fd)>2.5 THEN ab=ab-3*SGN(ah)*sn :ELSE ab=INT(2*(ar-fd))
IF ABS(ab)>10 THEN ab=10*SGN(ab)
IF h<20 THEN ab=SGN(ab)
IF h<-cz/40 AND ty=0 THEN uk=1:ty=1
IF h=0 THEN ab=0
IF h=0 AND ap=0 THEN an=INT(3*(ar-fd))/10
IF h>600 AND ap=0 THEN
n1=27+m/6400-(si-va-10)-(20-2*(ai>0))*(ai-(ai>0.2)*(ai-0.2))
END IF
IF h<600 AND tv=0 THEN tv=1:nn=n1
IF tv=1 AND h>300 AND ap<3 THEN n1=nn-10:ap=ap-c5*INT((5.3*sg+cz)/125)
api3:
IF xf=0 THEN api4
IF h<50 AND h>16 AND cz<-300 THEN
tx=tx+1:IF tx <4 THEN ap=ap+c5+0.08*(va-si)
END IF
IF h<16 AND h>0 THEN
aq=ap-ao-c5-(h<6)*0.008*(s-sg)
IF aq-ap>c5 THEN ap=ap+c5 :ELSE ap=aq
END IF
IF h=0 AND tw=0 THEN tw=1:GOTO api4
IF h=0 AND ap>0 THEN ap=ap-2:IF ap<0 THEN ap=0
api4:
IF xt=0 THEN kbd
IF h>450 THEN xr=0:LOCATE 8,73:PRINT"OFF";
IF h>20 AND ap=3 THEN
n1=26+m/6400-(si-va)+(h>150)*(20-2*(ai>0))*(ai-(ai>0.2)*(ai-0.2))
END IF
IF h<15 AND h>0 THEN n1=n0
IF h=0 AND ap=0 AND ur=0 THEN
ur=1:uw=1:LOCATE 9,73:PRINT" ON";:xr=50:LOCATE 8,73:PRINT" ON";
n1=-n0:mr=c5:LOCATE 10,52:PRINT"*R*";:tr=1
END IF
IF tr=1 THEN n1=n1-10:IF n1<-90 THEN n1=-90
IF h=0 AND ap=0 AND si<80 AND dv>0.6 THEN
n1=n0:mr=1:LOCATE 10,52:PRINT" ";:tr=0
END IF
kbd:
DoIO(req&):FOR x=0 TO 12:z(x)=PEEK(kbd&+x):z0=z0+z(x):NEXT
IF z0=0 THEN rtn2 :ELSE z0=0
IF z(6)=8 AND z(9)=32 THEN
pause:
DoIO(req&):IF PEEK(kbd&+6)=8 AND PEEK(kbd&+9)=16 THEN rtn2
GOTO pause
END IF
IF z(2)=1 AND z(9)=32 THEN CLS:GOTO restart
IF xl+xt+xf>0 THEN
IF z(11)=128 AND z(9)=32 THEN
xl=0:xt=0:xf=0:os=0:ur=0:tv=0:tw=0:tx=0:ty=0:tz=0
LOCATE 7,40:PRINT" ";:LOCATE 8,40:PRINT" ";
ELSE
GOTO rtn2
END IF
END IF
IF q=1 AND n=3 AND st=2 AND nt=7 AND xo=12 THEN uap=1 :ELSE uap=0
IF uap=1 AND ABS(ai)<c5 AND ABS(fd-rd)<5 THEN uap=0:GOTO api6 :ELSE GOTO api7
api6:
IF z(11)=128 AND z(5)=1 THEN
IF uom=1 AND ABS(s-va-10)<5 AND ap=0 AND ah<2 THEN
xl=1:xt=1:xf=1:LOCATE 8,40:PRINT"A L";
END IF
END IF
IF xl=0 AND h<700 AND h>500 AND ah<1 AND ABS(si-va)<5 AND ap=3 THEN
IF z(11)=128 AND z(2)=16 THEN
xt=1:LOCATE 8,40:PRINT"A T";
ELSEIF z(11)=128 AND z(4)=8 THEN
xf=1:LOCATE 7,40:PRINT"A F";
END IF
END IF
api7:
IF z(2)<>2 THEN rb1
IF z(1)=4 THEN w$="20.0 MIA 279:26.0150:-80.8250:0"
IF z(0)=2 THEN w$="17.8 MIA 231:25.7767:-80.7183:1"
IF z(0)=4 THEN w$="12.4 MIA 205:25.7750:-80.5567:2"
IF z(0)=8 THEN w$="11.0 MIA 183:25.7783:-80.4717:3"
IF z(0)=16 THEN w$="18.0 MIA 214:25.7117:-80.6450:4"
IF z(0)=32 THEN w$=" 5.2 BSY 293:25.7050:-80.2667:5"
IF z(0)=64 THEN w$=" 4.8 BSY 061:25.7100:-80.1017:6"
IF z(0)=128 THEN w$=" 7.9 BSY 072:25.7101:-80.0451:7"
IF z(1)=1 THEN w$="10.4 BSY 044:25.7967:-80.0450:8"
IF z(1)=2 THEN w$=" 8.3 BSY 028:25.7933:-80.1050:9"
LOCATE 16,74:PRINT RIGHT$(w$,1);
f3=VAL(MID$(w$,14,7)):f4=VAL(MID$(w$,22,8)):wv$=MID$(w$,6,3)
IF wv$="MIA" THEN f1=25.9633:f2=-80.46 :ELSE f1=25.6717:f2=-80.1783
LOCATE 15,67:PRINT LEFT$(w$,12);:LOCATE 13,72:PRINT wv$
rb1:
px=5+(z(8)=1)*4:py=px
IF z(9)=128 THEN px=-px
IF z(9)<>64 AND z(9)<>128 THEN px=0
abo=ab:IF z(2)=8 THEN ab=ab+px
IF ABS(ab)>25 THEN ab=SGN(ab)*25
IF h=0 THEN ab=0
ano=an:IF z(6)=64 THEN an=an+0.1*px
IF ABS(an)>6 THEN an=SGN(an)*6
IF z(9)=32 THEN py=-py
IF z(9)<>16 AND z(9)<>32 THEN py=0
IF z(2)=16 AND xt=0 THEN n1=n1+2*py
IF n1<n0 AND mr=1 THEN n1=n0
IF ABS(n1)>n2 THEN n1=SGN(n1)*n2
apo=ap:IF z(3)=2 AND xf=0 AND si>80 THEN ap=ap+c5*py
IF h=0 THEN IF ap<0 OR si<80 THEN ap=0
IF h=0 AND ap>14 THEN ap=14
IF h>0 OR ap>0 THEN an=0
IF z(9)<>32 THEN jp2
IF z(2)=4 AND h=0 AND xt=0 THEN n1=-n0:mr=c5:tr=1:LOCATE 10,52:PRINT"*R*";
IF z(2)=128 AND xt+xf=0 AND q=1 THEN
q=0:LINE(t3,90)-(t3+1,122),0,bf:LINE(267,t4)-(363,t4+1),0,bf
LOCATE 17,33:PRINT co$;:LOCATE 17,43:PRINT co$;
END IF
IF z(3)=32 AND xt=0 THEN o1=0
IF z(3)=64 AND xt=0 THEN o2=0
IF z(3)=128 AND xt=0 THEN o3=0
IF z(4)=1 AND xt=0 THEN LOCATE 8,73:PRINT" ON";:xr=50
IF z(4)=2 THEN st=st+1:IF st>2 THEN st=2
IF z(4)=8 AND st>=1 AND si<270-nt*10 THEN nt=nt+1:IF nt>7 THEN nt=7
IF z(4)=16 THEN uc=1
IF z(6)=32 AND xt=0 THEN uw=1:LOCATE 9,73:PRINT" ON";
IF z(6)=128 AND fl>15000 THEN fl=fl-5000:m=m-5000
jp2:
IF z(9)<>16 THEN jp4
IF z(2)=4 AND xt=0 THEN n1=n0:mr=1:tr=0:LOCATE 10,52:PRINT" ";
IF z(2)=128 THEN q=1
IF z(3)=32 THEN o1=1
IF z(3)=64 THEN o2=1
IF z(3)=128 THEN o3=1
IF z(4)=1 AND xt=0 THEN xr=0:LOCATE 8,73:PRINT"OFF";
IF z(4)=2 AND xt+xf=0 THEN st=st-1:IF st<0 THEN st=0
IF z(4)=8 AND xt+xf=0 THEN nt=nt-1:IF nt<0 THEN nt=0
IF z(4)=16 AND xt+xf=0 THEN uc=0
IF z(6)=32 AND xt=0 THEN uw=0:LOCATE 9,73:PRINT"OFF";
jp4:
IF z(3)=32 AND z(1)=4 AND q=1 AND h<20 AND h>0 THEN uk=2 :ELSE uk=0
IF uk=2 AND ea<1 AND dv<du AND ABS(ak-rd)>2 AND ABS(fd-rd)<9 THEN uk=1
IF z(4)<>4 OR h=0 OR xt+xf<>0 GOTO jp6
rwy:
IF z(0)=2 THEN
rw$="MIA 09R":rd=87:du=1.71:f5=25.7868:f6=-80.263:f7=25.7855:f8=-80.2914
END IF
IF z(0)=4 THEN
rw$="MIA 27L":rd=267:du=1.7:f5=25.7852:f6=-80.2975:f7=25.7865:f8=-80.269
END IF
IF tt=0 THEN tt=1:GOTO prep :ELSE LOCATE 16,9:PRINT LEFT$(rw$,7);
jp6:
GOTO rtn2
prep:
CLS:LINE (0,83)-(640,83),1
LINE (240,0)-(240,83),1:LINE (400,0)-(400,83),1
LINE (251,83)-(251,152),1:LINE (389,83)-(389,152),1
LINE (125,0)-(125,152),1:LINE (515,0)-(515,152),1
LINE (180,8)-(180,62),2
FOR x=0 TO 3:LINE(176,58-16*x)-(180,58-16*x),2:NEXT
FOR x=0 TO 2:LINE (425+33*x,16)-(425+33*x,62),2:NEXT
FOR x=0 TO 5:LINE (425,22+8*x)-(428,22+8*x),2:NEXT
FOR x=0 TO 5:LINE (488,22+8*x)-(491,22+8*x),2:NEXT
LINE (554,20)-(554,36),2:LINE (596,20)-(596,52),2
FOR x=0 TO 2:LINE (554,20+8*x)-(557,20+8*x),2:NEXT
FOR x=0 TO 4:LINE (593,20+8*x)-(596,20+8*x),2:NEXT
LINE(548,20)-(552,20),3:LINE(598,20)-(602,20),3
LINE (310,88)-(320,88),2:LINE (310,124)-(320,124),2
LINE (264,100)-(265,112),2,bf:LINE (366,100)-(367,112),2,bf
LINE (110,90)-(114,92),3,bf:LINE (135,90)-(139,92),2,bf
LINE (610,90)-(614,92),2,bf:LINE (610,106)-(614,108),3,bf
LOCATE 3,2:PRINT"AUW :":LOCATE 4,2:PRINT"FUEL:":LOCATE 5,2:PRINT"FFHR:"
LOCATE 7,7:PRINT"M:":LOCATE 8,5:PRINT"TAS:":LOCATE 9,3:PRINT"WD:"
LOCATE 10,6:PRINT"GS:":LOCATE 9,19:PRINT"IAS :":LOCATE 10,19:PRINT"VSI :"
LOCATE 2,26:PRINT"IAS":FOR x=1 TO 4:LOCATE 10-2*x,18:PRINT 100*x;:NEXT
LOCATE 6,39:PRINT"--O--":LOCATE 10,36:PRINT"ALT:":LOCATE 2,57:PRINT"N1"
LOCATE 2,37:PRINT"0.0 0/0.0";:LOCATE 3,44:PRINT"0.0";
FOR x=0 TO 4:LOCATE 8-x,55:PRINT USING".#";x/5;:NEXT
FOR x=0 TO 4:LOCATE 8-x,59:PRINT USING".#";x/5;:NEXT
LOCATE 3,55:PRINT"1.";:LOCATE 3,59:PRINT"1.";
LOCATE 2,69:PRINT"SL FL":LOCATE 8,70:PRINT"AB:OFF"
LOCATE 9,70:PRINT"WB:OFF":LOCATE 10,70:PRINT"LG:UP"
FOR x=0 TO 4:LOCATE 3+x,71:PRINT 15*x+(x=4)*5;:NEXT
LOCATE 12,2:PRINT"ADF: MI":LOCATE 13,3:PRINT"BG:":LOCATE 14,2:PRINT"RBG:"
LOCATE 16,1:PRINT"DME RWY ";LEFT$(rw$,7);:LOCATE 12,21:PRINT"HDG:"
LOCATE 17,39:PRINT"ILS";:LOCATE 12,54:PRINT"TRK:":LOCATE 17,64:PRINT"S";
LOCATE 12,67:PRINT"DME/VOR ":LOCATE 13,72:PRINT"MIA";
LOCATE 15,66:PRINT"(17.8 MIA 231)":LOCATE 16,72:PRINT"WP1";
LOCATE 14,67:PRINT"WAYPOINT":LOCATE 17,67:PRINT"RGB:";
LOCATE 13,24:PRINT"N":LOCATE 15,19:PRINT"W * E"
LOCATE 17,24:PRINT"S";:LOCATE 15,57:PRINT"+"
GOTO rtn2
lstall:
qt=qs+4+(st=0):IF aa>=qs AND aa<qt THEN LOCATE 3,37:PRINT"BUFFETING";
IF aa>+qt THEN LOCATE 3,37:PRINT"* STALL *";
IF aa>qt+3 THEN ap=ap-INT(aa/4)
IF aa>qt+13 THEN
CLS:LOCATE 4,20:PRINT"W I T H I N A M I N U T E O R S O
LOCATE 8,10:PRINT"Y O U W I L L C R A S H B E C A U S E O F"
LOCATE 12,20:PRINT"L O W S P E E D S T A L L":GOTO crash9
ELSE
GOTO rtn3
END IF
crash1:
CLS:LOCATE 8,30:PRINT"YOU LANDED SHORT OF RUNWAY":GOTO restart
crash2:
CLS:LOCATE 8,30:PRINT"IT WAS A CRASH LANDING":GOTO restart
crash3:
CLS:LOCATE 8,30:PRINT"IT WAS A HEAVY LANDING":GOTO restart
crash4:
CLS:LOCATE 8,30:PRINT"YOU SLID OF THE RUNWAY":GOTO restart
crash5:
CLS:LOCATE 8,30:PRINT"YOU OVERRUN THE RUNWAY":GOTO restart
crash7:
CLS:LOCATE 8,30:PRINT"YOU LANDED WITH YOU WHEELS UP":GOTO restart
crash9:
FOR a=0 TO 2500+h:NEXT:CLS
FOR x=2 TO 12 STEP 2:LOCATE x,1+RND*60:PRINT"B A N G":NEXT
LOCATE 15,25:PRINT"Y O U H A V E C R A S H E D ! ! !"
restart:
LOCATE 17,30:PRINT "T R Y I T A G A I N";:FOR x=1 TO 9999:NEXT:RUN