From 0c9399f52ac5ec1128ea0e8e5c0a9ffc937fd3dd Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 26 May 2016 17:18:11 -0400 Subject: [PATCH] ksp: getting closer --- ksp/c/ksp_launch.c | 1 + ksp/ksp.bas | 127 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 117 insertions(+), 11 deletions(-) diff --git a/ksp/c/ksp_launch.c b/ksp/c/ksp_launch.c index 71b83c7d..26874d59 100644 --- a/ksp/c/ksp_launch.c +++ b/ksp/c/ksp_launch.c @@ -140,6 +140,7 @@ int main(int argc, char **argv) { scanf("%c",&input); + /* 4000 */ while(1) { /* 4010 */ diff --git a/ksp/ksp.bas b/ksp/ksp.bas index 0a694807..82ef206f 100644 --- a/ksp/ksp.bas +++ b/ksp/ksp.bas @@ -1,4 +1,4 @@ -7 HOME +7 TEXT:HOME 10 REM PRINT CHR$(4);"BLOAD GLOBE.HGR,A$2000" 20 AN$="ZURGTROYD" 90 S=3 @@ -6,6 +6,11 @@ 100 EN(1)=1:ST(1)=1:FT(1)=1 101 EN(2)=2:ST(2)=2:FT(2)=1 102 EN(3)=3:ST(3)=3:FT(3)=1 +103 LN=0 +104 CQ=0 +110 HIMEM:7925 +120 POKE 232,245:POKE 233,30 +130 FOR L=7925 TO 8175: READ B:POKE L,B:NEXT L 1000 PRINT "ROCKET SUMMARY:":PRINT 1005 FOR I=1 TO S 1010 EM(I)=EN(I)*1.5+ST(I)*FT(I)*0.5 @@ -34,10 +39,22 @@ 3014 AX=0:AY=0 3015 KR=600000 3016 RX=0:RY=KR+10 -3017 RA=KR -3018 TR=1:T=0 +3017 RA=KR+10 +3018 TR=0:T=0 +3020 HGR:ROT=0:SCALE=2:H=0 +3030 REM ** LAUNCHPAD ** +3035 PRINT:PRINT CHR$(4);"BLOAD LAUNCHPAD.HGR,A$2000" +3038 HCOLOR=1:HPLOT 1,80 TO 132,80: HPLOT 148,80 TO 247,80 +3039 HCOLOR=3:HPLOT 110,110 TO 110,60:HPLOT TO 130,60: HPLOT 110,70 TO 130,70 4000 REM -4010 FL=FM(S)*100/SF(S) +4001 IF LN=0 GOTO 5032 +4003 IF (RA-KR)>1800 THEN GOTO 4012 +4005 HCOLOR=0:HPLOT 1,80+H TO 132,80+H:HPLOT 148,80+H TO 247,80+H +4010 H=(RA-KR)/20:HCOLOR=1:HPLOT 1,80+H TO 132,80+H:HPLOT 148,80+H TO 247,80+H +4012 IF (RA-KR)<10000 AND CQ<>0 THEN GOSUB 7600 +4014 IF (RA-KR)<10000 GOTO 4018 +4016 IF (RA-KR)>10000 AND CQ<>1 THEN GOSUB 7700 +4018 FL=FM(S)*100/SF(S) 4020 IF TR<>1 THEN GOTO 4050 4025 IF FM(S)<0.1 THEN FM(S)=0:AX=0:AY=0:GOTO 4050 4030 AX=(TH(S)/TM(S))*SIN(AN) @@ -66,7 +83,7 @@ 5030 G=-9.8/((RA/KR)*(RA/KR)) 5031 REM PRINT "-------------------------" 5032 VTAB 21 -5040 PRINT "TIME: ";T,"STAGE: ";S;" ";AN$ +5040 PRINT "TIME: ";T,"STAGE: ";S;" ";AN$ 5045 PRINT "ALT: ";INT((RA-KR)/1000);"KM " 5060 PRINT "VEL: ";INT(V);"M/S","FUEL: ";INT(FL);"% " 5080 REM PRINT "GRAVANGLE ";GA*180/3.14 @@ -74,10 +91,98 @@ 5100 REM PRINT "VX: ";VX;" VY: ";VY 5110 REM PRINT "ANGLE: ";AN 5112 REM PRINT "AX: ";AX;"AY: ";AY +5113 XDRAW 1+((S-1)*2)+TR AT 140,80 5115 GET A$ -5118 T=T+1 -5120 REM GET A$:IF A$="Q" THEN END -5130 HX=INT(RX/25000)+140:HY=INT(-RY/25000)+85 -5135 REM CHECK BOUNDS -5140 REM HPLOT HX,HY -5150 GOTO 4000 +6060 IF A$="Q" THEN END +6061 XDRAW 1+((S-1)*2)+TR AT 140,80 +6062 IF A$="A" THEN R=R-8 +6063 IF A$="D" THEN R=R+8 +6064 IF A$="C" THEN GOTO 8000 +6065 IF A$="Z" THEN TH=1 +6066 IF A$="V" THEN RA=RA+100 +6067 IF A$="X" THEN TH=0 +6068 IF A$=" " AND LN=1 THEN S=S-1:XX=PEEK(-16336) +6069 IF A$=" " AND LN=0 THEN GOSUB 7500 +6070 IF A$="E" THEN GOSUB 8100 +6073 IF R=64 THEN R=0 +6074 IF R=-8 THEN R=56 +6075 IF S<0 THEN S=0 +6080 ROT=R +6118 T=T+1 +6200 GOTO 4000 +6500 REM ** ORBIT MODE ** +6530 HX=INT(RX/25000)+140:HY=INT(-RY/25000)+85 +6535 REM CHECK BOUNDS +6540 REM HPLOT HX,HY +6550 RETURN +7200 DATA 6,0,14,0,42,0,77,0,113,0 +7201 DATA 156,0,200,0,219,36,36,44,44,44 +7202 DATA 53,53,53,54,54,54,54,63,63,45 +7203 DATA 46,46,62,63,63,39,37,37,63,36 +7204 DATA 36,0,219,36,36,44,44,44,53,53 +7205 DATA 53,54,54,54,54,63,63,45,46,46 +7206 DATA 62,63,127,73,62,54,62,39,36,39 +7207 DATA 39,37,37,63,36,36,0,219,36,36 +7208 DATA 36,36,44,44,44,53,53,53,54,54 +7209 DATA 54,54,54,54,54,54,63,63,45,46 +7210 DATA 46,62,63,63,39,37,37,63,36,36 +7211 DATA 36,36,0,219,36,36,36,36,44,44 +7212 DATA 44,53,53,53,54,54,54,54,54,54 +7213 DATA 54,54,63,63,45,46,46,62,63,127 +7214 DATA 73,62,54,62,39,36,39,39,37,37 +7215 DATA 63,36,36,36,36,0,219,36,36,36 +7216 DATA 36,36,36,44,44,44,53,53,53,54 +7217 DATA 54,54,54,54,54,54,54,54,54,54 +7218 DATA 54,63,63,45,46,46,62,63,63,39 +7219 DATA 37,37,63,36,36,36,36,36,36,0 +7220 DATA 219,36,36,36,36,36,36,44,44,44 +7221 DATA 53,53,53,54,54,54,54,54,54,54 +7222 DATA 54,54,54,54,54,63,63,45,46,46 +7223 DATA 62,63,127,73,62,54,62,39,36,39 +7224 DATA 39,37,37,63,36,36,36,36,36,36 +7225 DATA 0 +7500 REM *** LAUNCH *** +7510 HCOLOR=0:HPLOT 110,110 TO 110,60:HPLOT TO 130,60: HPLOT 110,70 TO 130,70 +7520 XX=PEEK(-16336) +7530 TR=1:LN=1 +7535 GOSUB 8220 +7540 RETURN +7600 REM *** GROUND *** +7610 PRINT CHR$(4);"BLOAD LAUNCHPAD.HGR,A$2000" +7615 XDRAW 1+((S-1)*2)+TR AT 140,80 +7620 CQ=0 +7650 RETURN +7700 REM *** SPACE_UP *** +7710 PRINT CHR$(4);"BLOAD ORBIT_TOP.HGR,A$2000" +7715 XDRAW 1+((S-1)*2)+TR AT 140,80 +7720 CQ=1 +7750 RETURN +8000 REM *** CRASH *** +8010 SCALE=3 +8015 GOSUB 8200 +8020 FOR I=0 TO 64 STEP 8: ROT=I:XDRAW 1+(S*2)+TH AT 140,80: XX=PEEK(-16336):NEXT I +8030 FOR I=1 TO 50 +8040 X=INT(RND(1)*80)+1:Y=INT(RND(1)*80)+1 +8050 C=INT(RND(1)*7)+1:HCOLOR=C +8060 HPLOT 140,80 TO 100+X,40+Y +8070 XX=PEEK(-16336) +8080 NEXT I +8090 END +8100 REM *** KERBAL EYES *** +8105 HCOLOR=3:HPLOT 258,150 TO 263,150:HPLOT 265,150 TO 270,150 +8110 KE=INT(RND(1)*3) +8120 HCOLOR=0:HPLOT 258+(2*KE),150 TO 259+(2*KE),150 +8125 HPLOT 265+(2*KE),150 TO 266+(2*KE),150 +8130 RETURN +8200 REM *** KERBAL FROWN *** +8205 HCOLOR=1:HPLOT 259,155 TO 271,155:HPLOT 259,156 TO 271,156 +8206 HCOLOR=0:HPLOT 261,155 TO 269,155:HPLOT 259,156 TO 271,156 +8207 RETURN +8210 REM *** KERBAL NEUTRAL *** +8215 HCOLOR=1:HPLOT 259,155 TO 271,155:HPLOT 259,156 TO 271,156 +8216 HCOLOR=0:HPLOT 259,155 TO 271,155 +8217 RETURN +8220 REM *** KERBAL SMILE *** +8225 HCOLOR=1:HPLOT 259,155 TO 271,155:HPLOT 259,156 TO 271,156 +8226 HCOLOR=0:HPLOT 259,155 TO 271,155:HPLOT 261,156 TO 269,156 +8227 RETURN