home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Glitch Apple Disk Collection
/
2014.glitch.apple.collection.zip
/
indexed
/
RENDEZ.DSK
/
DOCKJ.bas
< prev
next >
Wrap
BASIC Source File
|
2014-09-09
|
10KB
|
144 lines
0 ONERR GOTO 600
1 IF PEEK(764) THEN 5
2 PRINT "<CTRL-D>BLOAD BDOCKJ": HIMEM: 39168
3 PRINT "<CTRL-D>BLOAD STATION"
5 CALL 26306: IF PEEK(766) THEN 903
6 VTAB 22: HTAB 5: PRINT "<CTRL-G>PREPARE FOR RENDEZVOUS APPROACH": IF PEEK(764) THEN 901
7 GOTO 900
10 HPLOT 0,0 TO 279,0: HCOLOR= 6: DRAW 2 AT XO -1,YO: HCOLOR= 3: RETURN
12 F% = NOT F%: IF F% THEN CALL 26216: RETURN
13 CALL 25344: RETURN
14 HOME : POKE 230,32: CALL 62450: HPLOT 0,159 TO 0,0 TO 279,0 TO 279,159: HPLOT 1,0 TO 1,159: HPLOT 278,0 TO 278,159: POKE 230,64: CALL 62450: CALL 26306: INVERSE : POKE -16304,0: RETURN
15 FOR Q = 0 TO 1000: NEXT : RETURN
16 FOR I = 0 TO 3000: NEXT : RETURN
18 POKE -16368,0: GET G$: RETURN
19 TT = TT +T/3600:S0 = S0 +VI *T:T = 0: RETURN
20 IF MID$ (Q$,2,1) = "." THEN Q$ = RIGHT$(Q$, LEN(Q$) -2)
21 RETURN
40 X = X -DX:Y = Y -DY:Z = Z -DZ: GOSUB 44
42 XH = XO +2 *X:YH = YO -2 *Y: RETURN
44 Q = -X: VTAB 22: HTAB 10: GOSUB 50: VTAB 23:Q = -Y: HTAB 10: GOSUB 50: VTAB 24:Q = Z: HTAB 10: GOSUB 50: RETURN
46 A% = 0: IF XH >279 OR YH >159 OR XH <0 OR YH <0 THEN A% = 1: RETURN
48 XDRAW 1 AT XH,YH: RETURN
50 W = 10 * ABS(Q) +.5:H% = W/10:L% = W -10 *H%:Q$ = STR$(H%) +"." + STR$(L%): IF Q <0 THEN Q$ = "-" +Q$
51 IF LEN(Q$) <6 THEN Q$ = " " +Q$: GOTO 51
52 PRINT Q$;: RETURN
60 IF PDL(0) <48 THEN DX = DX -.005:Q = 1000 *DX:S% = 22: GOSUB 70
61 IF PDL(0) >208 THEN DX = DX +.005:Q = 1000 *DX:S% = 22: GOSUB 70
62 IF PDL(1) <48 THEN DY = DY -.005:Q = 1000 *DY:S% = 23: GOSUB 70
63 IF PDL(1) >208 THEN DY = DY +.005:Q = 1000 *DY:S% = 23: GOSUB 70
64 IF PEEK( -16287) >127 THEN DZ = DZ -.005:Q = 1000 *DZ:S% = 24: GOSUB 70
65 IF PEEK( -16286) >127 THEN DZ = DZ +.005:Q = 1000 *DZ:S% = 24: GOSUB 70
67 Q = PEEK( -16384): IF Q <128 THEN RETURN
68 POKE -16368,0: IF Q = 155 THEN POP : GOSUB 19:R = 0: GOTO 305
69 RETURN
70 U% = U% -5: CALL 25954: IF U% < = 0 THEN POP : GOSUB 19: GOTO 325
71 VTAB 21: HTAB 30:Q$ = STR$(U%): GOSUB 51
72 H% = Q +.5:Q$ = STR$(H%): IF H% >999 THEN POP : GOSUB 19: GOTO 326
73 IF LEN(Q$) <4 THEN Q$ = " " +Q$: GOTO 73
74 VTAB S%: HTAB 30: PRINT Q$;: RETURN
80 I = 0: POKE 230,32: HCOLOR= 5: HPLOT 0,0: TEXT : HOME : NORMAL : CALL 62454
82 I = I +1: CALL -198: POKE -16304,0: POKE -16303,0: IF I <6 THEN 82
84 RETURN
85 J = 0:S = X: GOSUB 95:S = Y: GOSUB 95:S = Z: GOSUB 95:S = DX: GOSUB 95:S = DY: GOSUB 95:S = DZ: GOSUB 95:S = U%: GOSUB 95:S = TT: GOSUB 95:S = S0: GOSUB 95: RETURN
87 S = H: GOSUB 95:S = P: GOSUB 95:S = A: GOSUB 95:S = C: GOSUB 95:S = T%: GOSUB 95:S = S1%: GOSUB 95:S = S2%: GOSUB 95:S = DH: GOSUB 95:S = DP: GOSUB 95:S = DB: GOSUB 95: RETURN
90 G$ = ""
92 J = J +1:F$ = CHR$( PEEK(G +J)): IF F$ = CHR$(13) THEN S = VAL(G$): RETURN
94 G$ = G$ +F$: GOTO 92
95 I = 0:G$ = STR$(S):Q = LEN(G$)
96 I = I +1:J = J +1: POKE R +J, ASC( MID$ (G$,I,1)): IF I = Q THEN J = J +1: POKE R +J,13: RETURN
98 GOTO 96
100 T = T +1: GOSUB 46: GOSUB 60
101 GOSUB 46: GOSUB 40: VTAB 24: CALL 26587: IF Z <E0 THEN 104
102 IF Z >200 OR ABS(X) >90 OR ABS(Y) >60 THEN GOSUB 19: GOTO 327
103 GOTO 100
104 C% = 0: IF DZ < = 0 THEN 100
105 S% = DZ <V0:D% = ABS(X) <E0 AND ABS(Y) <E0: IF NOT D% THEN 107
106 W = Z/DZ:AX = X +DX *W:AY = Y +DY *W: IF ABS(AX) <.2 AND ABS(AY) <.2 AND NOT S% THEN C% = 1
107 IF Z <D0 THEN 116
108 IF NOT D% THEN 100
109 IF C% THEN VTAB 21: HTAB 6: PRINT "<CTRL-G>COLLISION!";: GOTO 100
110 IF S% AND ABS(DX) <V0 AND ABS(DY) <V0 THEN 100
111 I = PEEK( -16336):I = PEEK( -16336): VTAB 21: HTAB (3 +S%): PRINT S$(S%);"VEL HIGH";: GOTO 100
116 IF C% THEN GOSUB 80: VTAB 3: PRINT "YOUR SPACECRAFT HAS BEEN DESTROYED": PRINT "BY STATION LASERS IN SELF-PROTECTION":S% = 1:R = 0:J = 3: GOSUB 19: GOTO 340
118 IF ABS(X) <D0 AND ABS(Y) <D0 AND ABS(DX) <V0 AND ABS(DY) <V0 AND S% THEN 180
120 S0 = S0 +100: GOSUB 46: POKE 34,20: CALL 26306: VTAB 22: HTAB 12: PRINT "<CTRL-G><CTRL-G><CTRL-G>PASSING STATION": IF A% THEN GOSUB 15: GOSUB 12: GOSUB 10: GOSUB 15:X = -X: GOTO 136
122 AX = XH:AY = YH:R = SQR(X *X +Y *Y):C = X/R:S = Y/R:I = 0
124 I = I +.05:R = R +I *I:X = C *R:Y = S *R: GOSUB 42: IF XH >279 OR YH >159 OR XH <0 OR YH <0 THEN 130
126 XDRAW 1 AT AX,AY: XDRAW 1 AT XH,YH:AX = XH:AY = YH: GOTO 124
130 GOSUB 12: GOSUB 10:R = R -I *I:X = -.98 *C *R:Y = .98 *S *R: GOSUB 42: GOSUB 48:AX = XH:AY = YH
132 I = I -.05:R = R -I *I: IF I < = 0 THEN 136
134 X = -C *R:Y = S *R: GOSUB 42: XDRAW 1 AT AX,AY: XDRAW 1 AT XH,YH:AX = XH:AY = YH: GOTO 132
136 CALL 26306:DX = -DX:DZ = -DZ:Z = ABS(Z): GOSUB 910: GOSUB 46: GOTO 100
140 IF S% THEN 354
142 HOME : INVERSE : CALL 26306: POKE -16304,0: GOSUB 910: GOTO 101
150 HOME : INVERSE :G = 768: GOTO 907
180 GOSUB 19: POKE 34,0: CALL 26306: VTAB 22: PRINT SPC( 9);"<CTRL-G><CTRL-G>BEGIN DOCKING APPROACH":G = 768: POKE 766,1
182 S = X:X = 1000 *Z:Z = 1000 *Y:Y = -1000 *S:S = DX:DX = -1000 *DZ:DZ = -1000 *DY:DY = 1000 *S:H = -P1:P = 0:A = P1:C = 0:R = 768: GOSUB 85: GOSUB 87
186 N$ = "D.":K$ = "DOCKING":E% = 0: POKE 230,64: CALL 62450: CALL 26306
190 VTAB 22: PRINT SPC( 7);"ENABLING NARROW-ANGLE SCREEN": POKE 206,0
192 J = 0: GOSUB 90:X = S: GOSUB 90:Y = S: GOSUB 90:Z = S: GOSUB 90:DX = S: GOSUB 90:DY = S: GOSUB 90:DZ = S: GOSUB 90:U% = S: GOSUB 90:TT = S: GOSUB 90:S0 = S
194 GOSUB 90:H = S: GOSUB 90:P = S: GOSUB 90:A = S: GOSUB 90:C = S: GOSUB 90:T% = S: GOSUB 90:S1% = S: GOSUB 90:S2% = S: GOSUB 90:DH = S: GOSUB 90:DP = S: GOSUB 90:DB = S
200 CALL 26368
210 ON PEEK(6) GOTO 310,320,330,325,326,327,324
300 R = S0:S = 0
305 S% = 0:J = 2: TEXT : HOME : NORMAL : VTAB 3: PRINT SPC( 10);"<CTRL-G>STATUS": GOTO 340
310 GOSUB 80: VTAB 3: PRINT "YOU HAVE COLLIDED WITH THE SPACE STATIONTHE SPACECRAFT HAS BEEN DESTROYED.":J = 3:S% = 1:R = S0:S = 0: GOTO 340
320 GOSUB 80: HCOLOR= 6: VTAB 3: PRINT "YOU HAVE COLLIDED WITH THE DOCKING PORT":S = 0:R = S0:S% = 1: IF DZ >3 OR Z < -85 THEN J = 5: GOTO 340
322 J = 4: GOTO 340
324 Q$ = "TOO MUCH TIME!": GOTO 328
325 Q$ = "OUT OF ENERGY!": GOTO 328
326 Q$ = "OUT OF CONTROL!": GOTO 328
327 Q$ = "STRAYED TOO FAR!"
328 R = S0: IF E% THEN R = 0
329 CALL 26306: VTAB 22: HTAB 12: PRINT "<CTRL-G><CTRL-G><CTRL-G>";Q$: GOSUB 16: TEXT : HOME : NORMAL : VTAB 3: HTAB 12: PRINT Q$:J = 14:S = 0:S% = 1: GOTO 340
330 IF DZ >2 THEN 320
332 TEXT : HOME : NORMAL : VTAB 3: PRINT "<CTRL-G><CTRL-G><CTRL-G>CONGRATULATIONS!": PRINT "YOU HAVE DOCKED SUCCESSFULLY":S% = 1:J = 2:R = S0:S = .04 *S1% +S2%/2
340 VTAB 6: PRINT "ENERGY CONSUMED: ";:G$ = STR$(100 * PEEK(768) -U%): PRINT SPC( 6 - LEN(G$));G$;" M/S"
341 PRINT "ELAPSED TIME: ";: IF E% THEN Q = TT: GOSUB 50: PRINT " HOURS": GOTO 344
342 IF TT THEN Q = TT +T%/3600: GOSUB 50: PRINT " HOURS": GOTO 344
343 Q = T%/60: GOSUB 50: PRINT " MINS"
344 PRINT : PRINT "APPROACH SCORE:";: HTAB 20: IF R = 0 THEN PRINT S$(6): GOTO 346
345 PRINT S$((R >1800) *7 +(R <1801) *(13 - INT(R/300)))
346 IF E% THEN PRINT : GOTO 349
347 PRINT "DOCKING SCORE :";: HTAB 20: IF S = 0 THEN PRINT S$(6): GOTO 349
348 PRINT S$((S >240) *7 +(S <241) *(13 - INT(S/40)))
349 PRINT "DAMAGE:"; TAB( 20);S$(J): VTAB 13: PRINT SPC( 10);"OPTIONS:": PRINT
350 IF S% THEN 352
351 PRINT "1. RETURN TO ";K$: PRINT "2. SAVE PRESENT POSITION"
352 PRINT "3. LOAD A NEW POSITION": PRINT "4. RETURN TO INITIAL POSITION": PRINT "5. RETURN TO MISSION MENU": PRINT "6. EXIT PROGRAM"
354 VTAB 22: CALL -958: PRINT SPC( 10);"CHOICE: ";: GOSUB 18: PRINT :G = VAL(G$): IF E% THEN ON G GOTO 140,400,500,150,380,390: GOTO 354
356 ON G GOTO 360,400,500,370,380,390: GOTO 354
360 IF S% THEN 354
362 HOME : INVERSE : POKE 34,20: VTAB 21: POKE 26,1: CALL 26306: POKE -16304,0
364 CALL 26492: GOTO 210
370 GOSUB 14:G = 768: GOTO 190
380 HOME : POKE 104,96: POKE 103,1: POKE 24576,0: PRINT "<CTRL-D>RUN MENU"
390 HOME : PRINT "RE-BOOT": CALL 46592
400 IF S% THEN 354
401 POKE 34,0: HOME : PRINT "SAVE POSITION TO DISK:": POKE 567,1: GOTO 520
500 POKE 34,0: HOME : PRINT "LOADING SAVED POSITION FROM DISK:": POKE 567,2
520 R = 39168: POKE R, PEEK(768): GOSUB 85: IF E% THEN S = VI: GOSUB 95: GOTO 524
522 GOSUB 87
524 POKE 566,2: POKE 764,1: PRINT : PRINT CHR$(4)"RUNFILESAVER": END
600 CALL 46613:ER = PEEK(222): PRINT "<CTRL-G><CTRL-G><CTRL-G>";: IF ER >13 THEN 690
601 IF ER = 6 THEN PRINT "FILE NOT FOUND!"
602 IF ER = 9 THEN PRINT "DISK FULL!"
603 IF ER = 4 THEN PRINT "WRITE PROTECTED!"
604 IF ER = 10 THEN PRINT "FILE LOCKED!"
605 IF ER = 11 OR ER = 13 THEN PRINT "BAD FILE NAME!"
606 IF ER = 8 THEN PRINT "DISK ERROR!"
607 GOSUB 16: HOME : POKE 34,0: GOTO 351
690 TEXT : HOME : NORMAL : PRINT "ERR #";ER;" IN LINE #";( PEEK(218) + PEEK(219) *256): CALL 46592
900 PRINT "<CTRL-D>BLOAD STARS"
901 VTAB 23: HTAB 5: PRINT "ENABLING WIDE ANGLE VIEWSCREEN "
903 X = 0:Y = X:Z = Y:P = Z:H = P:A = H:C = A:DX = A:DY = DX:DZ = DY:DP = DZ:DH = DP:DB = DH:M% = 29:N% = 178:U% = 3000:S1% = 0:S2% = 0:T% = 0:P1 = 1.5708:XO = 141:YO = 79:D0 = 2:E0 = 3.1:V0 = .021: INVERSE
904 DIM S$(14):S$(0) = "APPROACH ":S$(1) = "CROSS ":S$(2) = "NONE":S$(3) = "TERMINAL":S$(4) = "LIGHT":S$(5) = "HEAVY":S$(14) = "EMBARRASSMENT"
905 S$(6) = "ZERO!":S$(7) = "SWAB":S$(8) = "ENSIGN":S$(9) = "LIEUTENANT":S$(10) = "COMMANDER":S$(11) = "CAPTAIN":S$(12) = "ADMIRAL":S$(13) = "FLEET ADMIRAL"
906 G = 768 + PEEK(764) *38400: IF PEEK(766) THEN 186
907 J = 0: GOSUB 90:X = S: GOSUB 90:Y = S: GOSUB 90:Z = S: GOSUB 90:DX = S: GOSUB 90:DY = S: GOSUB 90:DZ = S: GOSUB 90:U% = S: GOSUB 90:TT = S: GOSUB 90:S0 = S: GOSUB 90:VI = S
908 PRINT "<CTRL-D>BLOAD DSHAPES": POKE 232,0: POKE 233,153:T = 0: HCOLOR= 3:A% = 0:F% = 0:E% = 1:N$ = "A.":K$ = "APPROACH": POKE 206,0
909 CALL 25344: POKE -16304,0: GOSUB 10: CALL 26306: GOSUB 910: GOSUB 42: GOTO 100
910 VTAB 21: HTAB 22: PRINT "ENERGY ="; TAB( 37);"M/S"
911 PRINT " HORZ ="; TAB( 17);"KM"; TAB( 23);"VELX ="; TAB( 35);"M/S": PRINT " VERT ="; TAB( 17);"KM"; TAB( 23);"VELY ="; TAB( 35);"M/S": PRINT " DIST ="; TAB( 17);"KM"; TAB( 23);"VELZ ="; TAB( 35);"M/S";
912 VTAB 21: HTAB 30:Q$ = STR$(U%): GOSUB 51: GOSUB 44:Q = 1000 *DX:S% = 22: GOSUB 72: PRINT :Q = 1000 *DY:S% = 23: GOSUB 72: PRINT :Q = 1000 *DZ:S% = 24: GOSUB 72: RETURN