Vectron

Type
Game
Category
Two-player strategy game
Author
Heath Lawrence
Published in
Antic, March 1987 (Vol. 5, No. 11)
Year
1987
Language
Atari BASIC (with machine-language strings)
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC (see notes), two joysticks; disk or cassette
Vectron playfield: about fifty arrow characters pointing up, down, left and right inside a bordered field, a launcher at each side, DEFLECTOR TYPE prompt at the top and the scores and TARGETS LEFT:50 below

About the program

Vectron was Heath Lawrence's second game in Antic, after Cliffhanger!, from the batch of games the Port Elgin, Ontario programmer sent the magazine when book publishers decided Atari was no longer "marketable". This one is a game of thinking more than reflexes. The computer scatters 50 arrow-shaped "energy deflectors" across a playfield ringed with "atomic containment gutters", and puts a particle launcher at each side.

When your particle hits a deflector, it turns to travel in the direction the arrow points, the deflector is blown up, and you score a point. The skill is in finding long chains of arrows that keep a shot bouncing around the field. Whoever destroys the most deflectors wins.

Typing it in

Lines 575 and 581 are strings of machine code and character data, full of inverse and control characters ({inv} … {/inv} = press the Atari key before and after; {CTRL-E}, {CTRL-X} and so on = hold CTRL and press the letter; {INS CHAR} = ESC then CTRL-INSERT). In the magazine, Listing 2 wrote these lines to a LINES.LST file you could ENTER. It isn't on the disk, so type them carefully. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.

Emulator note: the listing here runs on genuine Atari BASIC and on the Altirra BASIC replacement that many emulators use by default (see Changes from the published listing).

How to play

Plug in two joysticks and press a trigger at the title screen. Player one uses joystick 1 and player two joystick 2. Each turn has four phases:

  1. DEFLECTOR TYPE. Push the joystick in the direction of the arrow you want to add and press the button.
  2. Placement. An inverse image of the arrow appears in the middle of the field. Move it and press the button to put it down. You can't stack it on another deflector.
  3. Aim. Move your launcher up or down.
  4. Fire. The particle flies straight until it hits a deflector, then follows that arrow. If it hits a launcher it reverses, and that launcher vanishes until the next turn, so you can use either launcher to keep a chain going. When it reaches a gutter it rolls away and your turn ends.

Play goes on until no targets are left, and the winner gets a musical victory salute. Lawrence's advice is to study the field before placing your arrow, always look for a new chain, and not to ignore isolated deflectors, which might lead into a chain you thought was out of reach.

How it works

The article included a take-apart. Lines 40–100 move the projectile and check for gutters and deflectors. Lines 160–320 handle launching, choosing a deflector and placing it. Lines 340–380 animate the particle rolling down the gutter, and lines 500–590 set up the field, the title and the redefined arrow characters. The game POKEs directly into screen memory (SC+…) for speed. To change the number of starting targets, edit the 50 in line 540 (more than 99 upsets player two's score display). To change the projectile's speed, change or remove the FOR/NEXT delay in line 60.

Changes from the published listing

One change, so the program also runs under Altirra BASIC, the free replacement BASIC built into many emulators. Altirra BASIC adds commands called CP, MOVE, so it rejected the published lines that use those words as the start of a variable name. The variable is renamed everywhere in the program. The new name is the same length, so the memory layout is unchanged and the program behaves exactly as published on genuine Atari BASIC. If you type it in from the magazine, the original names work fine on a real Atari.

Published Now Lines
CP KP 250, 270, 280, 290, 320
MOVE MOVX 575, 580, 585

Listing

5 REM VECTRON
6 REM BY HEATH LAWRENCE
7 REM (c) 1987, ANTIC PUBLISHING
8 BRK=1:IF PEEK(53279)=5 THEN BRK=0
10 GOSUB 560
20 GOSUB 500:GOTO 120
30 REM MOVE PROJECTILE
40 POKE 77,0:PY=LY:PX=2+34*(PT=2):V=2+2*(PT=2):POKE SC+PX+40*PY,10
50 POKE SC+PX+40*PY,0:PY=PY+(V=3)-(V=1):PX=PX+(V=2)-(V=4):PP=PEEK(SC+PX+40*PY):POKE SC+PX+40*PY,10
60 FOR D=1 TO 10:NEXT D:IF PP=12 OR PP=13 THEN GOSUB 340:RETURN
70 ON (PP<>4 AND PP<>5 AND PP<>6 AND PP<>7 AND PP<>8 AND PP<>9) GOTO 50:POKE 710,67:POKE SC+PX+40*PY,83
80 FOR X=1 TO 200 STEP 3:SOUND 1,X,8,10:NEXT X:SOUND 1,0,0,0:POKE 710,35
90 V=1*(PP=6)+2*(PP=4 OR PP=8)+3*(PP=7)+4*(PP=5 OR PP=9):S1=S1+(PT=1):S2=S2+(PT=2):GOSUB 400
100 NA=NA-(PP<>8 AND PP<>9):ON NA=0 GOTO 420:GOSUB 400:GOTO 50
110 REM MAIN ROUTINE
120 LJK=28:GOSUB 610:PT=1:DT=36:GOSUB 200:LP=8:LX=1:LY=Y1:GOSUB 160:Y1=LY
130 LJK=0:GOSUB 610:PT=2:DT=36:GOSUB 200:LP=9:LX=37:LY=Y2:GOSUB 160:Y2=LY
140 GOTO 120
150 REM MOVE LAUNCHERS
160 TR=STRIG(0)*(PT=1)+STRIG(1)*(PT=2):ON TR=0 GOTO 40:SV=STICK(0)*(PT=1)+STICK(1)*(PT=2)
170 ON SV<>13 AND SV<>14 GOTO 160:POKE SC+LX+40*LY,0:LY=LY+1*(SV=13)-1*(SV=14):LY=LY+1*(LY<1)-1*(LY>19)
180 POKE SC+LX+40*LY,LP:FOR D=1 TO 15:NEXT D:GOTO 160
190 REM SET UP A DEFLECTOR
200 POKE SC+1+40*Y1,8:POKE SC+37+40*Y2,9:POSITION 9,0:? "{inv}DEFLECTOR TYPE> {/inv}";CHR$(DT)
210 TR=STRIG(0)*(PT=1)+STRIG(1)*(PT=2):IF TR=0 THEN FOR D=1 TO 200:NEXT D:GOTO 250
220 SV=STICK(0)*(PT=1)+STICK(1)*(PT=2):ON SV<>14 AND SV<>13 AND SV<>7 AND SV<>11 GOTO 200
230 DT=36*(SV=7)+37*(SV=11)+38*(SV=14)+39*(SV=13):GOTO 200
240 REM MOVE CURSOR
250 POSITION 9,0:? ",,,,,,,,,,,,,,,,,,":CX=20:CY=10:KP=PEEK(SC+CX+40*CY):POKE SC+CX+40*CY,DT+96
260 TR=STRIG(0)*(PT=1)+STRIG(1)*(PT=2)
270 IF TR=0 AND KP<>0 THEN SOUND 1,42,2,12:FOR D=1 TO 50:NEXT D:SOUND 1,0,0,0:GOTO 260
280 IF TR=0 AND KP=0 THEN POSITION CX,CY:? CHR$(DT):FOR D=1 TO 200:NEXT D:NA=NA+1:GOSUB 400:RETURN
290 SV=STICK(0)*(PT=1)+STICK(1)*(PT=2):ON SV=15 GOTO 260:POKE SC+CX+40*CY,KP
300 CX=CX-1*(SV=9 OR SV=10 OR SV=11)+1*(SV=5 OR SV=6 OR SV=7)
310 CY=CY-1*(SV=6 OR SV=10 OR SV=14)+1*(SV=5 OR SV=9 OR SV=13)
320 CX=CX+1*(CX<3)-1*(CX>35):CY=CY-1*(CY>19)+1*(CY<1):KP=PEEK(SC+CX+40*CY):POKE SC+CX+40*CY,DT+96:GOTO 260
330 REM GUTTER BALL
340 ON PP=13 GOTO 370:FOR H=PX TO 0 STEP -1:POKE SC+H+40*PY,11:SOUND 1,H+50,10,8:FOR D=1 TO 15:NEXT D
350 FOR H=PX TO 0 STEP -1:POKE SC+H+40*PY,11:SOUND 1,H+50,10,8:FOR D=1 TO 15:NEXT D:POKE SC+H+40*PY,12
360 POKE SC+H+40*PY,12:NEXT H:SOUND 1,0,0,0:RETURN
370 FOR H=PY TO 1 STEP -1:POKE SC+PX+40*H,14:SOUND 1,H+50,10,8:FOR D=1 TO 15:NEXT D:POKE SC+PX+40*H,13:NEXT H
380 SOUND 1,0,0,0:RETURN
390 REM UPDATE STATS
400 POSITION 9,21:? S1:POSITION 37,21:? S2:POSITION 25,21:? NA;" ":RETURN
410 REM GAME OVER/PLAY AGAIN?
420 GRAPHICS 17:POSITION 5,2:? #6;"{inv}game over{/inv}":POSITION 5,3:? #6;"=========":POSITION 4,5:? #6;"{inv}PLAYER{/inv} 1{inv}>{/inv}";S1
430 POSITION 4,7:? #6;"{inv}PLAYER{/inv} 2{inv}>{/inv}";S2:IF S1=S2 THEN POSITION 5,10:? #6;"{inv}tie game{/inv}!":GOTO 450
440 W=1+(S2>S1):POSITION 3,10:? #6;"{inv}player{/inv} ";W;" {inv}wins{/inv}"
450 POSITION 3,14:? #6;"{inv}PRESS{/inv} <START>":POSITION 3,15:? #6;"{inv}TO PLAY AGAIN{/inv}"
460 FOR Z=1 TO 2:RESTORE 650:FOR X=1 TO 8:READ P:READ D:SOUND 1,P,10,8:SOUND 2,P+10,10,6:FOR DE=1 TO D:NEXT DE
470 SOUND 1,0,0,0:SOUND 2,0,0,0:NEXT X:NEXT Z
480 ON PEEK(53279)<>6 GOTO 480:GOTO 20
490 REM PLAYFIELD
500 GRAPHICS 0:POKE 752,1:POKE 756,ST/256:POKE 710,35:SC=PEEK(88)+256*PEEK(89):S1=0:S2=0:Y1=10:Y2=10
505 POKE 77,0:IF BRK THEN POKE 16,112:POKE 53774,112
510 COLOR 45:PLOT 0,1:DRAWTO 0,19:PLOT 38,1:DRAWTO 38,19
511 COLOR 44:PLOT 0,0:DRAWTO 38,0:PLOT 0,20:DRAWTO 39,20
520 NA=0:POSITION 0,21:? "PLAYER 1:   TARGETS LEFT:   PLAYER 2:":Y1=10:Y2=10
530 Y=INT(RND(0)*19)+1:X=INT(RND(0)*33)+3:V=INT(RND(0)*4)+4:IF PEEK(SC+X+40*Y)<>0 THEN 530:POKE SC+X+40*Y,V
540 POKE SC+X+40*Y,V:NA=NA+1:GOSUB 400:ON NA<>50 GOTO 530:RETURN
550 REM REDEFINE
560 POKE 106,PEEK(740)-5:GRAPHICS 17:POSITION 6,7:? #6;"{inv}VECTRON{/inv}":POSITION 6,8:? #6;"-------":POSITION 8,10
565 POKE 77,0:IF BRK THEN POKE 16,112:POKE 53774,112
570 ? #6;"by:":POSITION 3,13:? #6;"{inv}heath lawrence{/inv}":POSITION 2,17:? #6;"PRESS TRIGGER...":ST=(PEEK(106)+1)*256
575 MOVX=ADR("hh{inv}{CTRL-E}q{/inv}h{inv}{CTRL-E}p{/inv}h{inv}{CTRL-E}U{/inv}h{inv}{CTRL-E}T{/inv}h{inv}{CTRL-E}o{/inv}h{inv}{CTRL-E}n {/inv}{CTRL-,}{inv}1p{CTRL-Q}TfTP{/inv}{CTRL-B}{inv}fUfpP{/inv}{CTRL-B}{inv}fqFnPjFo{/inv}{CTRL-P}{inv}f{/inv}{CTRL-.}")
576 REM X=USR(MOVE,FROM_ADDRESS,TO_ADDRESS,AMOUNT)
580 X=USR(MOVX,57344,ST,1024)
581 Q=ADR("{CTRL-X}{CTRL-L}{CTRL-F}{INS CHAR}{INS CHAR}{CTRL-F}{CTRL-L}{CTRL-X}{CTRL-X}0{CTRL-.}{INS CHAR}{INS CHAR}{CTRL-.}0{CTRL-X}{CTRL-X}<{BACK S}{inv}[{CTRL-Y}{/inv}{CTRL-X}{CTRL-X}{CTRL-X}{CTRL-X}{CTRL-X}{CTRL-X}{inv}{CTRL-Y}[{/inv}{BACK S}<{CTRL-X}{SHIFT-TAB}{INS CHAR}{inv}{CTRL-C}{CTRL-;}{CTRL-;}{CTRL-C}{/inv}{INS CHAR}{SHIFT-TAB}{inv}y{/inv}{INS CHAR}{inv}A__A{/inv}{INS CHAR}{inv}y{/inv}{CTRL-,}{CTRL-X}<{BACK S}{BACK S}<{CTRL-X}{CTRL-,}{INS CHAR}{CTRL-X}<{BACK S}{BACK S}<{CTRL-X}{INS CHAR}{INS CHAR}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{INS CHAR}{inv}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-A}{CTRL-Y}={/inv}{INS CHAR}{INS CHAR}{inv}={CTRL-Y}{CTRL-A}{/inv}")
585 X=USR(MOVX,Q,ST+32,88)
590 IF (STRIG(0) AND STRIG(1)) THEN 590
600 RETURN
610 FOR K=(LJK=28)*28 TO (LJK=0)*28 STEP (2*(LJK=0)-1)
615 SOUND 2,(-2.179*K+121),14,14
620 POSITION K,22:? " ======== ";:SOUND 2,0,0,0:NEXT K
630 POKE 77,0:IF BRK THEN POKE 16,112:POKE 53774,112
635 RETURN
640 REM TUNE DATA
650 DATA 62,20,58,20,54,20,48,30,48,30,54,20,58,20,62,50

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: VECTRON.BAS.

Credits