Jump to content
IGNORED

"Laser Strike" for TI-99/4A, COMPUTE! Magazine Conversion


OLD CS1

Recommended Posts

1136244320_LaserStrikeArticleTitle.png.7c1d5b80a656b39bed492218061e5ad1.png

Another authorized conversion to the TI-99/4A of programs appearing within COMPUTE! Magazine, from Volume 8, Number 12, Issue 79, December 1986, Pp. 44-52.  This game appeared after COMPUTE! Magazine dropped support for the TI-99/4A.  From the article:

 

Quote


"Laser Strike" is a strategy game based on several popular board games (Battleship is probably the most famous). However, unlike the board games, the action in Laser Strike occurs in outer space. Two players secretly deploy their space ships around the galaxy and then try to locate the opponent's ships by firing laser strikes on the two-dimensional galaxy grid. The first player to find and destroy all the opponent's ships is the winner.

Laser Strike begins by asking each player to enter his or her name. If you wish to play against the computer, press RETURN with out typing anything at the first name prompt. If you press RETURN at both name prompts, the computer plays the entire game by itself.

The program then displays two grids, one for each player. In the first stage of the game, each player decides where to locate the ships in his or her grid. The deployment must be secret, so the second player needs to look away from the screen while the first player deploys ships, and vice versa. To deploy a ship, simply move the cursor to the desired location on the screen and press the joystick fire button (space bar in some versions). After choosing the location, you must also de cide whether to deploy the ship horizontally or vertically. You can not place a ship so that it overlaps the border. If you attempt to place a ship illegally, the program warns you and gives you another chance.

After both players' ships have been placed, the contest begins. The players alternate firing laser shots on each other's grids. To fire a shot, move the cursor to the desired location; then press the fire button or the space bar. If you hit a ship, that square of the grid is marked in the color of the ship you hit. If you miss, the square is marked in a neutral color. The game continues until one player has found and eliminated all of the other player's ships. At that point you can exit the program or play a new game.

 

 

Details on the TI-99 conversions

The very original version of "Laser Strike" for the TI-99 was written in 1988 as a wholly original work of BASIC code, using only the description of play from the article rather than translations of other BASIC versions.  A re-write of the game was required before it was considered finished.  As well, two different computer logic routines were written, requiring two different programs due to TI BASIC memory limitations.  This release was almost 100% re-worked in TIdBiT using only minor parts of the original, and processed from TIdBiT into BASIC listing and TIFILES for download using the tidbit99.com site. As with other versions in the article, the Commodore 64 version game play was used as the basis of the conversion.

 

This first post contains the program listing as it might have appeared in the magazine back in 1986.  A later post will contain the TIdBiT source, the programs in TIFILES format, in a cassette tape audio wav, as well as a disk image.
 

Playing on the TI-99/4A

In the TI versions, player one uses the left-side keyboard arrow keys, ESDX and Q for fire, or the left (number one) joystick.  Player two uses the right-side keyboard unmarked arrow keys, IJKM and Y for fire, or the right (number two) joystick.  To use joysticks, the ALPHA LOCK key on the TI-99/4A should be in the up position.  The space bar acts as fire for either player, except when playing on a TI-99/4.

When deploying ships, a marker will appear on the board: a white dot for TI BASIC and a purple marker for TI Extended BASIC.  Fire marks the spot to deploy with an "X" or a "+" depending upon which BASIC version, then the player will select right or down.  If the player marks a spot for deployment by mistake, a second press of the fire button will deselect it.  The familiar TI "accept" beep tone will be sounded at the end of each player's deployment phase.  The first beep indicates player one has finished and must now look away from the screen while player two deploys ships.  The second beep indicates player two has finished and now the contest will commence.  Note that computer player deployments are only hidden if playing against a human.  This allows computer vs. computer match observers to know the locations of each computer player's ships.

While playing, the marker for positioning the player's laser will appear in the same form as during deployment.

At the end of a match, players may select to end game play or start again with new players.  At the end of a computer vs. computer match, the computer players will wait several seconds before demanding a rematch.  The game may be stopped during play using CLEAR (FCTN-4 on the /4A or SHIFT-C on the /4) in TI BASIC.  In Extended BASIC, the game cannot be stopped but must be exited using QUIT (FCTN-= or SHIFT-Q on the /4A and /4, respectively.)

 

How the computer plays

The computer player uses fairly simple logic.  It employs no strategy for ship layouts, instead placing them in random locations with random directions.  While searching for a ship, it chooses randomly but spaces shots based upon the shortest remaining intact ship.  Thus, if the explorer remains hidden, shots are spaced two grid positions apart.  If the fighter is the smallest intact ship, then shots are spaced three grid positions apart, and so on.  The computer logic is smart enough to determine if the smallest intact ship will fit in the space around a random firing solution. 

Once a ship is found, the area around the first spot hit is considered by excluding the layout of the ship which cannot hold its full length.  If neither horizontal nor vertical layout can be excluded, then the computer will pick around the hit at random.  Once it determines the layout of the ship, it will continue to follow until the ship is destroyed or it reaches the end of the ship, at which point it will reverse its search to work toward the other end.  If another ship is discovered during the search for the second part of the ship, the longest of the two ships found will be focused upon, then once destroyed the smaller ship will be pursued.

The computer is not, however, smart enough to make a shot which would intersect a ship's multiple layout possibilities.  For instance, if a section of grid could hold a fighter in a "T" shape, that is three spots across and two down from the middle, but the horizontal positioning of the random firing solution puts the shot at the upper-right of the "T", the computer will not adjust the shot to the middle-top in order to exclude both layout possibilities.  Instead, this area will be cleared by two shots.

Envision this placement scenario as below.  An "X" marks already hit or missed position, an underscore marks an open position, the asterisk marks where the shot is placed, and the octothorpe marks the ideal position for the shot.
 

X X X X X    X X X X X    X X X X X
X _ _ _ X    X _ _ * X    X _ # _ X
X X _ X X    X X _ X X    X X _ X X
X X _ X X    X X _ X X    X X _ X X
X X X X X    X X X X X    X X X X X

 

Features of the TI conversions

The currently-active grid is "lit up" in white, while the inactive grid is dimmed in grey.  This may not show up well on some monitors.  Nonetheless, the current player is indicated in both name and by the location of the cursor.  Parts of hit ships will not fade.

Player names are limited to eight characters in TI BASIC, and may contain upper-case letters and numbers.  Names longer than eight characters will be truncated.  This helps cut the amount of time needed to display the current player's name in the message area at the top of the screen.  In TI Extended BASIC, player names may be 13 characters of upper-case letters, only.

The TI BASIC version puts a white dot on top of ships which have already been hit.  As the cursor is active in two modes, one in which the ship underneath needs to be exposed and the other hidden, among other factors, each movement of the cursor requires lengthy calculations.  This makes movement lag a little, but it adds a "neat" factor of a sprite-like cursor as opposed to simply skipping an exposed area during movement.

 

TI Extended BASIC special provisions

The TI Extended BASIC version with the 32k expansion attached makes use of sound lists to enhance game sounds.  To do this, the characters "0" through "8" (ASCII 48 through 56) are "loaded" with the sound lists by way of the CHAR subprogram.  This is also why numbers are prohibited from a player's name.  The console ISR (interrupt service routine) is notified of the location of the list and then instructed to play it.  One of the benefits of interrupt-driven sound is the BASIC interpreter may continue processing.  However, in most cases, the game will issue a call to the SOUND subprogram in a way which halts the program until the list has completed.

This pause works due to how TI BASIC and Extended BASIC play sounds from the SOUND subprogram.  The interpreter creates a sound list from the SOUND subprogram parameters, then sets it to play by the ISR.  By this method, you will likely have noticed how a program will continue while a sound of up to 4.25 seconds plays unless the program executes another call to the SOUND subprogram.  See the BASIC or Extended BASIC manual for more details on how sounds with a positive or negative duration work.

The maximum duration of 4.25 seconds is based upon the highest value for the duration byte in a sound list, >FF or 255, divided by the number of times the ISR executes in one second, which is 60 for an NTSC machine.  To wit, 255 ÷ 60 = 4.25.  See the Editor/Assembler manual for more information on sound lists.

 

Some lessons to take away from this program

TI BASIC has a limited amount of memory to store both its program and run-time variables.  The original version of "Laser Strike" exceeded BASIC's memory.  It was re-written in an attempt to be more code-efficient and removed some superfluousness.  30 years later, this re-working restored some functionality to the game, including a marquee title screen, as well as better computer player logic, and much better program code.  Still lurking was the concern of running out of memory.  It was concluded that reducing the number of variables in use would help with memory management.

The first iteration of this approach was to use minimal utility and loop variables, and use the grid variable G(,,) 0-elements to hold game play information.  However, this became cumbersome to track and inefficient to program.  As well, it was determined that using two-letter descriptive arrays consumed less program space.  For instance, SP(1) uses less space in program memory than G(0,1,1), especially when addressed multiple times.  The uses of 0-elements were eliminated, and OPTION BASE 1 put in place to help spare memory, as well.

Throughout the program, different approaches to grid coordinate addressing is used.  In the main loop the R,C (row and column) method is used.  In other parts X,Y addressing is used, and yet another section H,V (horizontal and vertical.)  This can be confusing to follow, but fortunately only caused minor problems during development.  While a uniform system should have been employed, it did work out as these disparities are isolated to specific sections and functionality.

Initial test releases of this program severely abused variables, again in attempt to keep memory footprint low.  Once feature-complete, BASIC still had a little over 2k of memory remaining.  This is plenty for the purposes of this game so those variable abuses were eliminated.  For instance, the "I" and "J" variables are used for flags and loop counters, but also held critical information during certain phases.  Programming this way make it difficult to ensure important data are not overwritten by temporary values.  They were replaced with "L", for ship length, and "T", for type of ship in focus, to make the program code easier to follow.

The TIdBiT source has some comments on how programming the game was approached, as well as some details on a couple of neat tricks done to enhanced game play experience.

 

"Laser Strike" for the TI-99/4A  laser_strike_nail-biter_cvc.thumb.png.f5de86aeed045818505ff8323c8531c4.png

"Laser Strike" for the TI-99/4A.

Left, the computer plays a good game. Right, computer vs. computer comes down to the wire.

 

Program 7: TI BASIC

 

1 REM ** LASER STRIKE
2 REM * BY BARBARA SCHULAK
3 REM ** (C) 1986 COMPUTE!
4 REM ** PUBLICATIONS INC.
5 REM ** TI CONVERSIONS
6 REM ** (C) 1988,2020
7 REM ** ALAN RATELIFF,II
8 REM ** BASIC/EXT BASIC
9 REM ** PDD VERSION 3.0
10 UNBREAK
11 UNTRACE
12 CALL CLEAR
13 PRINT "ORIGINAL VERSION OF":"""LASER STRIKE"" USED WITH    PERMISSION OF": :
14 PRINT "COMPUTE! PUBLICATIONS, INC. PO BOX 5406":"GREENSBORO NC  27403": :
15 PRINT "COPYRIGHT 1986 COMPUTE!":"PUBLICATIONS, INC.":"ALL RIGHTS RESERVED": :
16 PRINT "TEXAS INSTRUMENTS CONVERSIONCOPYRIGHT 1988, 2020 BY":"ALAN W. RATELIFF, II":
17 OPTION BASE 1
18 DIM G(2,10,10),SP(2,4),SR(2,4),SC(2,4),SH(2,4),SV(2,4),PL(4),UR(2),UC(2),CP(2),P$(2),K$(2),S$(4)
19 GOTO 129
20 J=0
21 CALL KEY(ABS(P),K,S)
22 IF S THEN 23 ELSE 26
23 J=POS(K$(1),CHR$(K),1)
24 IF J=0 THEN 28
25 RETURN
26 CALL JOYST(ABS(P),X,Y)
27 IF X+Y THEN 33
28 CALL KEY(3,K,S)
29 IF S THEN 30 ELSE 32
30 J=4+POS(K$(2),CHR$(K),1)
31 J=J*-(J>4)
32 RETURN
33 IF SGN(X)*SGN(Y)THEN 31
34 J=ABS(((SGN(X)+3)/2)*SGN(X))+(ABS(((SGN(Y)+3)/2)*SGN(Y))-2*(Y<>0))
35 RETURN
36 Y=POS(M$,":",1)
37 X=Y-(LEN(M$)*(Y=0))+(Y>0)
38 CALL HCHAR(R,C+2,32,28-C)
39 FOR M=1 TO X
40 CALL HCHAR(R,C+M+1,ASC(SEG$(M$,M,1)))
41 NEXT M
42 R=R+1-(R=2)
43 IF Y=0 THEN 46
44 M$=SEG$(M$,Y+1,84)
45 GOTO 36
46 RETURN
47 Z=1
48 GOSUB 53
49 IF Z THEN 52
50 Z=1
51 GOSUB 64
52 RETURN
53 FOR X=C TO C+L-1
54 IF X>10 THEN 58
55 IF (G(P,R,X)<0)*(G(P,R,X)<>-T)THEN 58
56 NEXT X
57 RETURN
58 Z=X
59 FOR X=C TO Z-L STEP  -1
60 IF X<1 THEN 75
61 IF (G(P,R,X)<0)*(G(P,R,X)<>-T)THEN 75
62 NEXT X
63 RETURN
64 FOR Y=R TO R+L-1
65 IF Y>10 THEN 69
66 IF (G(P,Y,C)<0)*(G(P,Y,C)<>-T)THEN 69
67 NEXT Y
68 RETURN
69 Z=Y
70 FOR Y=R TO Z-L STEP  -1
71 IF Y<1 THEN 75
72 IF (G(P,Y,C)<0)*(G(P,Y,C)<>-T)THEN 75
73 NEXT Y
74 RETURN
75 Z=0
76 RETURN
77 CALL COLOR(9-(P<0),2,17-ABS(P))
78 CALL COLOR(10+(P<0),2,14+ABS(P))
79 RETURN
80 Z=P-3*(P<0)
81 FOR I=9 TO 18
82 CALL HCHAR(I,14*Z-9,88+8*Z,10)
83 NEXT I
84 RETURN
85 Z=P-3*(P<0)
86 SH(Z,T)=(M=2)-(M=1)
87 SV(Z,T)=(M=4)-(M=3)
88 RETURN
89 R=UR(ABS(P))
90 C=UC(ABS(P))
91 RETURN
92 UR(ABS(P))=R
93 UC(ABS(P))=C
94 RETURN
95 Z=G(P-3*(P<0),R,C)
96 M=104+ABS(Z)*8*((Z<0)+(P<0))*(Z>-5)-8*((P=1)*((Z>=0)+(Z=-5))+((P=-2)*(Z=0)))
97 CALL HCHAR(8+R,C+14*P-10-42*(P<0),M+1)
98 GOSUB 20
99 IF J=0 THEN 98
100 IF J>4 THEN 105
101 CALL HCHAR(8+R,14*P-10-42*(P<0)+C,M-2*(Z=-5))
102 R=R+((J=3)*(R<10))-((J=4)*(R>1))
103 C=C+((J=2)*(C<10))-((J=1)*(C>1))
104 GOTO 95
105 RETURN
106 IF R+L>10 THEN 115
107 FOR Y=R TO R+L
108 IF G(P+3,Y,C)THEN 115
109 NEXT Y
110 FOR Y=R TO R+L
111 G(P+3,Y,C)=T
112 NEXT Y
113 IF CP(-P)*(CP(P+3)=0)THEN 115
114 CALL VCHAR(8+R,C+32+14*P,104+8*T,6-T)
115 RETURN
116 IF C+L>10 THEN 115
117 FOR X=C TO C+L
118 IF G(P+3,R,X)THEN 115
119 NEXT X
120 FOR X=C TO C+L
121 G(P+3,R,X)=T
122 NEXT X
123 IF CP(-P)*(CP(P+3)=0)THEN 115
124 CALL HCHAR(8+R,C+32+14*P,104+8*T,6-T)
125 RETURN
126 DATA MOTHERSHIP,BOMBER,FIGHTER,EXPLORER
127 DATA C3BDBFBFB1BDBDC3,83BDBDBD83B7BBBD,C1F7F7F7F7F7F7C1,83DDDDDDDDDDDD83
128 DATA F7E7D7F7F7F7F7C1C3BDFDFBF7EFDF81,7,11,5,4
129 K$(1)=CHR$(2)&CHR$(3)&CHR$(0)&CHR$(5)&CHR$(18)
130 K$(2)=" "
131 FOR T=1 TO 4
132 READ S$(T)
133 NEXT T
134 FOR I=96 TO 136 STEP 8
135 CALL CHAR(I+0,"007E7E7E7E7E7E")
136 CALL CHAR(I+1,"007E7E66667E7E")
137 NEXT I
138 FOR I=0 TO 8 STEP 8
139 CALL CHAR(98+I,"003C5A66665A3C")
140 RESTORE 127
141 FOR J=0 TO 3
142 READ M$
143 CALL CHAR(99+J+I,M$)
144 NEXT J
145 READ M$
146 CALL CHAR(103+I,SEG$(M$,I*2+1,16))
147 NEXT I
148 FOR I=11 TO 14
149 READ J
150 CALL COLOR(I,J,16)
151 NEXT I
152 CALL SCREEN(2)
153 CALL CLEAR
154 CALL VCHAR(1,31,31,96)
155 FOR I=1 TO 8
156 CALL COLOR(I,1,2)
157 NEXT I
158 M$="   LASER STRIKE "
159 FOR I=3 TO 16
160 CALL SOUND(-200,-5,2*(16-I))
161 CALL SCREEN(I)
162 CALL HCHAR(12,7+I,ASC(SEG$(M$,I,1)))
163 NEXT I
164 FOR I=1 TO 8
165 CALL COLOR(I,16,2)
166 NEXT I
167 CALL SCREEN(2)
168 FOR P=1 TO 2
169 PRINT "PLAYER";P;"NAME";
170 CALL KEY(3,K,S)
171 INPUT P$(P)
172 CP(P)=(P$(P)="")
173 P$(P)=SEG$("COMPUTER"&P$(P),9+8*CP(P),8)
174 PRINT
175 NEXT P
176 IF (P$(1)=P$(2))*(CP(1)*CP(2)=0)THEN 152
177 CALL CLEAR
178 FOR C=1 TO 16 STEP 15
179 M$="MTHRSHIP:  BOMBER: FIGHTER:EXPLORER"
180 R=21
181 GOSUB 36
182 NEXT C
183 FOR I=0 TO 4
184 J=I-(I=4)
185 CALL HCHAR(7,7+J,99+I)
186 CALL HCHAR(7,21+J,107+I)
187 NEXT I
188 RANDOMIZE
189 CALL HCHAR(1,3,32,124)
190 FOR P=1 TO 2
191 GOSUB 80
192 FOR T=1 TO 4
193 SP(P,T)=6-T
194 CALL HCHAR(20+T,P*15-4,104+T*8,6-T)
195 NEXT T
196 FOR I=1 TO 10
197 FOR J=1 TO 10
198 G(P,I,J)=0
199 NEXT J
200 NEXT I
201 UR(P)=1
202 UC(P)=1
203 NEXT P
204 FOR P=-1 TO  -2 STEP  -1
205 GOSUB 77
206 M$=P$(-P)&",:DEPLOY YOUR"
207 R=1
208 C=1
209 GOSUB 36
210 FOR T=1 TO 4
211 L=5-T
212 IF CP(-P)=0 THEN 223
213 IF T>1 THEN 218
214 M$="SHIPS"
215 R=2
216 C=13
217 GOSUB 36
218 RANDOMIZE
219 R=INT(RND*10)+1
220 C=INT(RND*10)+1
221 ON INT(RND*2)+1 GOSUB 116,106
222 IF G(P+3,R,C)=T THEN 237 ELSE 218
223 M$=S$(T)
224 R=2
225 C=13
226 GOSUB 36
227 GOSUB 89
228 GOSUB 95
229 IF G(P+3,R,C)=0 THEN 232
230 CALL SOUND(150,220,2)
231 GOTO 228
232 CALL HCHAR(8+R,C+32+14*P,M+2)
233 GOSUB 20
234 ON J+1 GOTO 233,233,235,235,233,228
235 ON J-1 GOSUB 116,106
236 IF G(P+3,R,C)=0 THEN 230
237 GOSUB 92
238 NEXT T
239 CALL HCHAR(1,1,32,56)
240 GOSUB 80
241 UR(-P)=1
242 UC(-P)=1
243 CALL SOUND(200,1390,2)
244 NEXT P
245 FOR I=21 TO 24
246 CALL HCHAR(I,11,32,5)
247 CALL HCHAR(I,26,32,5)
248 NEXT I
249 CALL VCHAR(1,31,31,96)
250 FOR P=1 TO 2
251 GOSUB 77
252 M$=P$(P)&",:POSITION AND FIRE LASER:"
253 R=1
254 C=1
255 GOSUB 36
256 IF CP(P)THEN 260
257 GOSUB 89
258 GOSUB 95
259 GOTO 305
260 L=5
261 FOR T=1 TO 4
262 M=SP(P,T)
263 IF M=0 THEN 267
264 IF L<M THEN 266
265 L=M
266 IF M<(6-T)THEN 276
267 NEXT T
268 RANDOMIZE
269 R=INT(10*RND)+1
270 C=INT(10*RND)+1
271 IF (R+C)/L<>INT((R+C)/L)THEN 268
272 IF G(P,R,C)<0 THEN 268
273 T=0
274 GOSUB 47
275 IF Z THEN 305 ELSE 268
276 R=SR(P,T)
277 C=SC(P,T)
278 IF L<(5-T)THEN 297
279 FOR M=1 TO 4
280 PL(M)=0
281 NEXT M
282 L=6-T
283 M=INT(RND*4)+1
284 IF PL(M)THEN 282
285 PL(M)=1
286 Z=1
287 ON M GOSUB 53,53,64,64
288 IF Z=0 THEN 282
289 GOSUB 85
290 X=C+SH(P,T)
291 Y=R+SV(P,T)
292 IF (X=0)+(X=11)+(Y=0)+(Y=11)THEN 282
293 IF G(P,Y,X)<0 THEN 282
294 C=X
295 R=Y
296 GOTO 305
297 R=R+SV(P,T)
298 C=C+SH(P,T)
299 IF (R=0)+(R=11)+(C=0)+(C=11)THEN 302
300 IF G(P,R,C)=-T THEN 297
301 IF G(P,R,C)<0 THEN 302 ELSE 305
302 SH(P,T)=-SH(P,T)
303 SV(P,T)=-SV(P,T)
304 GOTO 297
305 Z=G(P,R,C)
306 IF Z<0 THEN 258
307 FOR I=4 TO 28 STEP 6
308 CALL SOUND(50,554,I)
309 CALL SOUND(1,554,30)
310 NEXT I
311 GOSUB 92
312 IF Z THEN 317
313 CALL HCHAR(8+R,14*P-10+C,90+P*8)
314 M$="::MISS!"
315 Z=5
316 GOTO 338
317 CALL SCREEN(16)
318 SP(P,Z)=SP(P,Z)-1
319 CALL SCREEN(12)
320 CALL HCHAR(8+R,14*P-10+C,104+Z*8)
321 CALL SCREEN(10)
322 CALL HCHAR(20+Z,P*15-4,104+Z*8,6-Z-SP(P,Z))
323 CALL SCREEN(9)
324 CALL SCREEN(2)
325 FOR I=2 TO 26 STEP 4
326 CALL SOUND(500,200,30,220,30,300,30,-8,I)
327 NEXT I
328 SR(P,Z)=R
329 SC(P,Z)=C
330 IF SP(P,Z)>0 THEN 337
331 FOR I=14 TO 2 STEP  -2
332 CALL SOUND(-100,-5,I)
333 NEXT I
334 FOR I=0 TO 30
335 CALL SOUND(66,-7,I)
336 NEXT I
337 M$="::"&S$(Z)&SEG$(" DESTROYED! HIT!",12+11*(SP(P,Z)=0),11)
338 G(P,R,C)=-Z
339 R=1
340 C=1
341 GOSUB 36
342 IF SP(P,1)+SP(P,2)+SP(P,3)+SP(P,4)=0 THEN 345
343 P=2-P
344 NEXT P
345 M$=P$(P)&":HAS FREED THE GALAXY!:PLAY AGAIN (Y/N)?"
346 R=1
347 C=1
348 GOSUB 36
349 FOR I=1 TO 500
350 CALL KEY(3,K,S)
351 IF K=89 THEN 152
352 IF K=78 THEN 355
353 NEXT I
354 IF CP(1)*CP(2)THEN 188 ELSE 349
355 CALL CLEAR
356 END

 

 

 

Program 8: TI Extended BASIC

 

1 ! ** LASER STRIKE
2 ! * BY BARBARA SCHULAK
3 ! ** (C) 1986 COMPUTE!
4 ! ** PUBLICATIONS INC.
5 ! ** TI CONVERSIONS
6 ! ** (C) 1988, 2020
7 ! ** ALAN RATELIFF, II
8 ! ** EXTENDED BASIC
9 ! ** PDD VERSION 3.0
10 UNBREAK :: ON BREAK NEXT :: UNTRACE :: CALL CLEAR
11 PRINT "ORIGINAL VERSION OF":"""LASER STRIKE"" USED WITH    PERMISSION OF": :
12 PRINT "COMPUTE! PUBLICATIONS, INC. PO BOX 5406":"GREENSBORO NC  27403": :
13 PRINT "COPYRIGHT 1986 COMPUTE!":"PUBLICATIONS, INC.":"ALL RIGHTS RESERVED": :
14 PRINT "TEXAS INSTRUMENTS CONVERSIONCOPYRIGHT 1988, 2020 BY":"ALAN W. RATELIFF, II":
15 OPTION BASE 1
16 DIM G(2,10,10),SP(2,4),SR(2,4),SC(2,4),SH(2,4),SV(2,4),PL(4),UR(2),UC(2),CP(2),P$(2),K$(2),S$(4),SL$(4)
17 GOTO 81
18 J=0
19 CALL KEY(ABS(P),K,S):: IF S THEN 20 ELSE 21
20 J=POS(K$(1),CHR$(K),1):: IF J=0 THEN 22 ELSE RETURN
21 CALL JOYST(ABS(P),X,Y):: IF X+Y THEN 25
22 CALL KEY(3,K,S):: IF S THEN 23 ELSE RETURN
23 J=4+POS(K$(2),CHR$(K),1)
24 J=J*-(J>4):: RETURN
25 IF SGN(X)AND SGN(Y)THEN 24
26 J=ABS(((SGN(X)+3)/2)*SGN(X))+(ABS(((SGN(Y)+3)/2)*SGN(Y))-2*(Y<>0)):: RETURN
27 Z=1 :: GOSUB 29 :: IF Z THEN RETURN
28 Z=1 :: GOSUB 40 :: RETURN
29 FOR X=C TO C+L-1
30 IF X>10 THEN 34
31 IF (G(P,R,X)<0)*(G(P,R,X)<>-T)THEN 34
32 NEXT X
33 RETURN
34 Z=X
35 FOR X=C TO Z-L STEP -1
36 IF X<1 THEN 51
37 IF (G(P,R,X)<0)*(G(P,R,X)<>-T)THEN 51
38 NEXT X
39 RETURN
40 FOR Y=R TO R+L-1
41 IF Y>10 THEN 45
42 IF (G(P,Y,C)<0)*(G(P,Y,C)<>-T)THEN 45
43 NEXT Y
44 RETURN
45 Z=Y
46 FOR Y=R TO Z-L STEP -1
47 IF Y<1 THEN 51
48 IF (G(P,Y,C)<0)*(G(P,Y,C)<>-T)THEN 51
49 NEXT Y
50 RETURN
51 Z=0
52 RETURN
53 CALL COLOR(9-(P<0),2,17-ABS(P),10+(P<0),2,14+ABS(P)):: RETURN
54 Z=P-3*(P<0):: FOR I=9 TO 18 :: CALL HCHAR(I,14*Z-9,88+8*Z,10):: NEXT I :: RETURN
55 Z=P-3*(P<0):: SH(Z,T)=(M=2)-(M=1):: SV(Z,T)=(M=4)-(M=3):: RETURN
56 R=UR(ABS(P)):: C=UC(ABS(P)):: RETURN
57 UR(ABS(P))=R :: UC(ABS(P))=C :: RETURN
58 CALL SPRITE(#1,98,14,(R+7)*8+1,(C*8)+25-112*((P=2)+(P=-1)))
59 GOSUB 18 :: IF J=0 THEN 59 ELSE IF J=5 THEN RETURN
60 R=R+((J=3)*(R<10))-((J=4)*(R>1)):: C=C+((J=2)*(C<10))-((J=1)*(C>1)):: GOTO 58
61 IF R+L>10 THEN RETURN
62 FOR Y=R TO R+L :: IF G(P+3,Y,C)THEN RETURN
63 NEXT Y
64 FOR Y=R TO R+L :: G(P+3,Y,C)=T :: NEXT Y
65 IF CP(-P)AND CP(P+3)=0 THEN RETURN
66 CALL VCHAR(8+R,C+32+14*P,104+8*T,6-T)
67 RETURN
68 IF C+L>10 THEN RETURN
69 FOR X=C TO C+L :: IF G(P+3,R,X)THEN RETURN
70 NEXT X
71 FOR X=C TO C+L :: G(P+3,R,X)=T :: NEXT X
72 IF CP(-P)AND CP(P+3)=0 THEN RETURN
73 CALL HCHAR(8+R,C+32+14*P,104+8*T,6-T)
74 RETURN
75 CALL LOAD(-31796,4,128,"",-31747,@,"",-31794,1):: RETURN
76 CALL SOUND(1,554,30):: RETURN
77 DATA MTHRSHIP,038A0C9202019F02019502019F02019802019F02019B02019F02019E02019F00
78 DATA BOMBER,05CC12DFE7F10A01F30A01F50A01F70A01F90A01FB0A01FD0A029FFF00
79 DATA FIGHTER,02E4F70401F50401F30401F10402E6F00A01F10A01F20A01F30A01F40A01F50A
80 DATA EXPLORER,01F60A01F70A01F80A01F90A01FA0A01FB0A01FC0A01FD0A01FE0A01FF00
81 CALL PEEK(-31952,@):: @=A<>55 :: IF @ THEN CALL INIT :: CALL PEEK(-31747,@):: @=@+1
82 K$(1)=CHR$(2)&CHR$(3)&CHR$(0)&CHR$(5)&CHR$(18):: K$(2)=" " :: FOR I=96 TO 136 STEP 8
83 CALL CHAR(I,"007E7E7E7E7E7E00007E7E66667E7E")
84 NEXT I
85 FOR I=0 TO 8 STEP 8
86 CALL CHAR(98+I,"003C5A66665A3C")
87 CALL CHAR(99+I,"C3BDBFBFB1BDBDC383BDBDBD83B7BBBDC1F7F7F7F7F7F7C183DDDDDDDDDDDD83")
88 CALL CHAR(103+I,SEG$("F7E7D7F7F7F7F7C1C3BDFDFBF7EFDF81",I*2+1,16))
89 NEXT I
90 CALL COLOR(11,7,16,12,11,16,13,5,16,14,4,16)
91 CALL CLEAR :: CALL SCREEN(2):: RESTORE
92 FOR I=1 TO 4 :: READ S$(I),SL$(I):: NEXT I
93 CALL VCHAR(1,31,31,96):: FOR I=1 TO 8 :: CALL COLOR(I,1,2):: NEXT I
94 M$="   LASER STRIKE "
95 FOR I=3 TO 16 :: CALL SOUND(200,-5,2*(16-I)):: CALL SCREEN(I):: CALL HCHAR(12,7+I,ASC(SEG$(M$,I,1))):: NEXT I
96 FOR I=1 TO 8 :: CALL COLOR(I,16,2):: NEXT I :: CALL SCREEN(2)
97 CALL COLOR(9,2,16,10,2,16)
98 FOR P=1 TO 2 :: PRINT "PLAYER ";CHR$(95+P*8);" NAME? ";:: ACCEPT VALIDATE(UALPHA)SIZE(13)BEEP:P$(P):: CP(P)=(P$(P)=""):: IF CP(P)THEN P$(P)="COMPUTER"
99 NEXT P
100 IF P$(1)=P$(2)AND(CP(1)*CP(2)=0)THEN 93 ELSE CALL COLOR(9,2,2,10,2,2)
101 CALL CLEAR
102 FOR C=9 TO 24 STEP 15 :: FOR I=1 TO 4 :: DISPLAY AT(20+I,C-LEN(S$(I))):S$(I):: NEXT I :: NEXT C :: S$(1)="MOTHERSHIP"
103 FOR I=0 TO 4 :: J=I-(I=4):: CALL HCHAR(7,7+J,99+I):: CALL HCHAR(7,21+J,107+I):: NEXT I
104 RANDOMIZE :: CALL HCHAR(1,3,32,124)
105 FOR P=1 TO 2 :: GOSUB 54 :: UR(P),UC(P)=1
106 FOR T=1 TO 4 :: SP(P,T)=6-T :: CALL HCHAR(20+T,P*15-4,104+T*8,6-T):: NEXT T
107 FOR I=1 TO 10 :: FOR J=1 TO 10 :: G(P,I,J)=0 :: NEXT J :: NEXT I
108 NEXT P
109 FOR P=-1 TO -2 STEP -1
110 GOSUB 53 :: DISPLAY AT(1,1):P$(-P);",";TAB(1);"DEPLOY YOUR" :: FOR T=1 TO 4 :: L=5-T
111 DISPLAY AT(2,13):S$(T):: IF CP(-P)=0 THEN 114
112 RANDOMIZE :: R=INT(RND*10)+1 :: C=INT(RND*10)+1 :: ON INT(RND*2)+1 GOSUB 68,61
113 IF G(P+3,R,C)=T THEN 122 ELSE 112
114 GOSUB 56
115 GOSUB 58 :: IF G(P+3,R,C)=0 THEN 117
116 CALL SOUND(150,220,2):: GOTO 115
117 CALL PATTERN(#1,43)
118 GOSUB 18
119 ON J+1 GOTO 118,118,120,120,118,115
120 ON J-1 GOSUB 68,61
121 IF G(P+3,R,C)=0 THEN 116
122 CALL DELSPRITE(#1):: GOSUB 57 :: NEXT T
123 CALL HCHAR(1,1,32,56):: GOSUB 54 :: UR(-P),UC(-P)=1 :: CALL SOUND(200,1390,2):: NEXT P
124 FOR I=21 TO 24 :: CALL HCHAR(I,11,32,5):: CALL HCHAR(I,26,32,5):: NEXT I
125 CALL VCHAR(1,31,31,96)
126 FOR P=1 TO 2
127 GOSUB 53 :: DISPLAY AT(1,1):P$(P);",";TAB(1);"POSITION AND FIRE LASER";RPT$(" ",56)
128 IF CP(P)THEN 132
129 GOSUB 56
130 GOSUB 58
131 GOTO 152
132 L=5
133 FOR T=1 TO 4 :: M=SP(P,T):: IF M=0 THEN 135 ELSE L=MIN(M,L)
134 IF M<(6-T)THEN 139
135 NEXT T
136 RANDOMIZE :: R=INT(10*RND)+1 :: C=INT(10*RND)+1 :: IF (R+C)/L<>INT((R+C)/L)THEN 136
137 IF G(P,R,C)<0 THEN 136
138 T=0 :: GOSUB 27 :: IF Z THEN 152 ELSE 136
139 R=SR(P,T):: C=SC(P,T)
140 IF L<(5-T)THEN 149
141 FOR M=1 TO 4 :: PL(M)=0 :: NEXT M
142 L=6-T :: M=INT(RND*4)+1 :: IF PL(M)THEN 142
143 PL(M)=1 :: Z=1 :: ON M GOSUB 29,29,40,40
144 IF Z=0 THEN 142
145 GOSUB 55
146 X=C+SH(P,T):: Y=R+SV(P,T):: IF X=0 OR X=11 OR Y=0 OR Y=11 THEN 142
147 IF G(P,Y,X)<0 THEN 142
148 C=X :: R=Y :: GOTO 152
149 R=R+SV(P,T):: C=C+SH(P,T):: IF R=0 OR R=11 OR C=0 OR C=11 THEN 151 ELSE IF G(P,R,C)=-T THEN 149
150 IF G(P,R,C)<0 THEN 151 ELSE 152
151 SH(P,T)=-SH(P,T):: SV(P,T)=-SV(P,T):: GOTO 149
152 Z=G(P,R,C):: IF Z<0 THEN 130
153 IF @ THEN CALL CHAR(48,SL$(1)):: GOSUB 75 :: GOTO 155
154 FOR I=4 TO 28 STEP 6 :: CALL SOUND(50,554,I):: CALL SOUND(1,554,30):: NEXT I
155 GOSUB 76 :: GOSUB 57 :: DISPLAY AT(1,1):RPT$(" ",84)
156 CALL DELSPRITE(#1):: IF Z THEN 159
157 CALL HCHAR(8+R,14*P-10+C,90+P*8):: DISPLAY AT(4,1):"MISS!" :: Z=5
158 CALL SOUND(1500,554,30):: GOSUB 76 :: GOTO 168
159 CALL SCREEN(16):: SP(P,Z)=SP(P,Z)-1 :: CALL SCREEN(12)
160 CALL HCHAR(8+R,14*P-10+C,104+Z*8):: CALL SCREEN(10)
161 CALL HCHAR(20+Z,P*15-4,104+Z*8,6-Z-SP(P,Z)):: CALL SCREEN(9):: SR(P,Z)=R :: SC(P,Z)=C :: CALL SCREEN(2)
162 DISPLAY AT(4,1):S$(Z)&SEG$(" DESTROYED! HIT!",12+11*(SP(P,Z)=0),11):: IF @ THEN CALL CHAR(48,SL$(2)):: GOSUB 75 :: GOSUB 76 :: GOTO 165
163 FOR I=2 TO 26 STEP 4 :: CALL SOUND(500,200,30,220,30,300,30,-8,I)
164 NEXT I
165 IF SP(P,Z)>0 THEN 168
166 IF @ THEN CALL CHAR(48,SL$(3),52,SL$(4)):: GOSUB 75 :: GOTO 168
167 FOR I=14 TO 2 STEP -2 :: CALL SOUND(-100,-5,I):: NEXT I :: FOR I=0 TO 30 :: CALL SOUND(66,-7,I):: NEXT I
168 G(P,R,C)=-Z
169 IF SP(P,1)+SP(P,2)+SP(P,3)+SP(P,4)=0 THEN 171 ELSE IF CP(3-P)THEN GOSUB 76
170 P=2-P :: NEXT P
171 DISPLAY AT(1,1):P$(P);TAB(1);"HAS FREED THE GALAXY!" :: DISPLAY AT(4,1):"PLAY AGAIN (Y/N)?"
172 FOR I=1 TO 500
173 CALL KEY(3,K,S):: IF K=89 THEN 91 ELSE IF K=78 THEN CALL CLEAR :: END
174 NEXT I
175 IF CP(1)AND CP(2)THEN 104 ELSE 172


 
 

 

 

  • Like 8
Link to comment
Share on other sites

423660535_LaserStrike(COMPUTE!MagazineArticleMock-Up).thumb.png.aa8d8380b54673fc2b8ffeeb0d1826cb.png

Per the FP, attached is a Zip archive containing documents, listings, sources, and programs.  Contained within the documents is the proposal for a "networking" protocol to allow two players over RS-232.  In theory, this could have allowed play over the Internet by way of a serial-to-TCP/IP type device, like a UDS-10 or similar, or the TIPI.  I decided this moves away from the original scope and intent, which was to be a magazine type-in conversion of the original.  I have also shelved the idea of an "enhanced" edition which would change some of the elements of the game which I find unappealing.  Honestly, I want to finish up this project to re-work my original conversions and move on.

 

Seen to the right I did for fun: a mock-up of how these conversions might have appeared if published in COMPUTE!.  It was fun for a second to imagine what a teen-aged me would have thought to see it in print.  Working this up was more difficult than I expected and I spent more time than planned as I ran into limitations of both Microsoft Word and OpenOffice Writer, as well as my experience with the two.

 

  • Like 4
Link to comment
Share on other sites

  • 7 months later...

Over six months after release, I stumbled across a problem with Extended BASIC with no 32k expansion.  I was certain I had tested this before loosing it to the public.

 

This R2 update includes the 32k detection fix (thanks to @senior_falcon,) optimized joystick detection formula (per my blog,) all sources and program files updated, as well as a mock-up of a CAPUTE! (COMPUTE! errata) article.   Because, why not.

 

Laser Strike(R2).zip

 

BTW, the AA editor does not allow editing spoilers without major damage, so instead of changing the listings in the FP, the fix for the Extended BASIC version is the line

81 CALL PEEK(-31868,@):: IF @ THEN CALL INIT :: CALL PEEK(-31747,@):: @=@+1

 

If you want to incorporate the optimized joystick detection, for BASIC:

34 J=(ABS(X)/2+(X<0))+(ABS(Y)+(Y<0))

and for Extended BASIC:

26 J=(ABS(X)/2+(X<0))+(ABS(Y)+(Y<0)):: RETURN

 

Edited by OLD CS1
Ammend with listing fixes
  • Like 4
  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...