10 REM Program ORBIT 20 REM Version B2.0 30 REM Author Cliff Blake 40 REM BEEBUG March 1993 50 REM Program subject to copyright 60 : 100 MODE7:*FX11 110 PROCinfo:g%=GET 120 MODE0:VDU5 130 REPEAT 140 quit%=FALSE 150 CLS:PROCplanet:PROCspaceship 160 REPEAT 170 rerun%=FALSE 180 PROCmove:PROCaltitude 190 PROCgravity:PROCthrust 200 PROCflags 210 UNTIL rerun% 220 UNTIL quit% 230 VDU4:*FX12 240 CLS:*FX21 250 END 260 : 1000 DEF PROCmove 1010 MOVE Xs,Ys:PRINT CHR$64 1020 ENDPROC 1030 : 1040 DEF PROCaltitude 1050 Xd=640-Xs:Yd=512-Ys 1060 Rds=Xd*Xd+Yd*Yd:Rd=SQR(Rds) 1070 alt%=INT(.2*Rd) 1080 VDU4:PRINT TAB(55,2)"ALTITUDE: ";alt%;",000 km";SPC3:VDU5 1090 ENDPROC 1100 : 1110 DEF PROCgravity 1120 Xg=20000*Xd/Rd/Rds:Yg=20000*Yd/Rd/Rds 1130 Xv=Xv+Xg:Yv=Yv+Yg 1140 Rvs=Xv*Xv+Yv*Yv:Rv=SQR(Rvs) 1150 vel%=INT(.85*Rv) 1160 VDU4:PRINT TAB(55,4)"VELOCITY: ";vel%;",000 km/h";SPC3:VDU5 1170 ENDPROC 1180 : 1190 DEF PROCthrust 1200 Xt=0.05*Xv/Rv:Yt=0.05*Yv/Rv 1210 IF INKEY(-103) THEN Xv=Xv-Xt:Yv=Yv-Yt:SOUND0,-7,6,4 1220 IF INKEY(-104) THEN Xv=Xv+Xt:Yv=Yv+Yt:SOUND0,-7,6,4 1230 Xs=Xs+Xv:Ys=Ys+Yv 1240 ENDPROC 1250 : 1260 DEF PROCflags 1270 IF INKEY(-52) THEN rerun%=TRUE 1280 IF INKEY(-17) THEN rerun%=TRUE:quit%=TRUE 1290 ENDPROC 1300 : 1310 DEF PROCplanet 1320 Ca=COS(PI/40):Sa=SIN(PI/40) 1330 CA=1:SA=0:MOVE 640+40,512 1340 FOR A=1 TO 80 1350 Cp=CA:Sp=SA 1360 CA=Cp*Ca-Sp*Sa:SA=Sp*Ca+Cp*Sa 1370 x=40*CA+640:y=40*SA+512 1380 MOVE 640,512:PLOT 85,x,y 1390 NEXT A 1400 ENDPROC 1410 : 1420 DEF PROCspaceship 1430 VDU23,64,192,0,0,0,0,0,0,0 1440 Xs=640:Ys=900 1450 Xv=3.5:Yv=0 1460 ENDPROC 1470 : 1480 DEF PROCinfo 1490 y$=CHR$131:c$=CHR$134:w$=CHR$135 1500 PRINT TAB(10,2)y$+"SATELLITE ORBIT" 1510 PRINT'c$+"A spaceship is in elliptical orbit" 1520 PRINT c$+"around a planet. Try using its" 1530 PRINT c$+"propulsion and retro braking units" 1540 PRINT c$+"to make the orbit circular." 1550 PRINT'w$+"Gently holding down the < key will" 1560 PRINT w$+"fire the retro unit to slow the ship." 1570 PRINT'w$+"Gently holding down the > key will" 1580 PRINT w$+"fire the drive to accelerate the ship."' 1590 PRINT c$+"The smaller the variations in" 1600 PRINT c$+"altitude and velocity, the more" 1610 PRINT c$+"circular the orbit." 1620 PRINT'w$+"Press any key to start." 1630 PRINT'w$+"Press R to clear the screen & Repeat." 1640 PRINT'w$+"Press Q to Quit." 1650 ENDPROC