Dale’s Atari 800 Games › Stan Ockers
By Stan Ockers, in the ACE newsletter of July/August 1981.
Play Plus-ZeroThis installment introduces some more missile graphics routines (just about filling up page six), and presents a program using most of them. The program, ‘Plus-Zero’is found in listing 1.
It would be nice to have a routine which would update the location of a player on the screen depending on the position of a joystick. Such a routine is poked into memory by lines 46 and 47 and is called by A=USR(1721,X), where X is the player involved. This routine uses joystick #0,(PLYR 1 jack). The direction is remembered and held in zero page location 00D0, (decimal 208). The routine calls vertical movement routines and updates horizontal and vertical position locations as necessary. The player will move one unit each time the routine is called.
Occasionally more than one joystick may be required. A routine poked in by line 34 and called by A=USR(1584,X) will move player X according to joystick 2(PLYR 3). The other two joysticks could be handled with a little extra code.
The last two routines turned out to be lifesavers for USR called PM graphics. Initially I had a routine which moved a player once in a specified direction each time it was called. It turned out to be much too slow. Even if a number of USR calls were strung together, the time required for Basic to execute the function slowed things down. An answer to this problem is given by the routine called by A=USR(1567,X) and poked in by line 32. This routine repeatedly calls the machine level joystick routine a given number of times before returning to Basic. The number of repetitions is determined by number poked into decimal location 1789.
Line 30 pokes in a routine which does the same thing but using direction (DIR) instead of the joystick. The values for DIR are the same as those produced by the joystick,(see page 60 of the Basic Reference Manual).
Here then is a summary of routines:
LINE CALL PURPOSE 30 A=USR(1544,X,DIR)-Update plyr X N times in direction DIR 32 A=USR(1567,X) —-Update plyr X N times by joystick(0) 34 A=USR(1584,X) -Update plyr X by joystick(2) 38-39 A=USR(1606,X,ADDR)- Load plyr X with dato at address ADDR 40-41 A=USR(1637,X) -Move plyr X downscreen one unit 42-43 A=USR(1673,X) -Move plyr X upscreen one unit. 44 A=USR(1706,X) - Clear plyr X area 46-47 A=USR(1721,X) -Update plyr X with joystick(0)
In order to use missile graphics then you must do all these things:
(1) Poke into page six all the routines you will use. The routines in lines 30,32 & 34 use to one at 44-47, otherwise they are independent.
(2) Calculate START of PM graphics area. START must fall on a boundary for double line resolution. We dropped down 8 pages (2K) from the end of RAM (RAMTOP dec. loc. 106). This leaves a gap of 1K between player 3 area and the end of RAM. Display information is built down from the end of RAM and will use this area. The amount needed depends on the graphics mode used (see table 9.1 in Basic Manual). Modes 4 and lower are o.k. but would extend slightly into player #3 area (o.k. if 3 not used). Extra memory could be alloted if START were dropped another 1K, (4 pages). Poke the page number of START into location 54279 and use START page to set pointer to players. I’ve set pointers to only players 0 and 1 because only these are used. Poke graphics images into an unused portion of memory. I use the bytes beginning at START (384 unused in double line resolution). Remember to end each image with a zero.
(4) Initialize each image you will be using by setting up its horizontal and vertical positions and color. Horizontal positions can vary from 41 to 200 (in playfield area) and must be poked into two places. Vertical positions go from 16 to 111. Finally, call routines to clear the player followed by the routine to fill with the appropriate image.
(5) Enable player missile graphics by poking 559 with 46 (double line) and 53277 with 3.
Once these things have been done the images should appear on the screen no matter what else is there. ALWAYS SAVE ANYTHING THAT HAS TAKEN ANY LENGTH OF TIME TO TYPE IN BEFORE YOU RUN IT! A misplaced number in a USR call can send you off to never-never land where you have to turn the power off to get back. If images don’t appear, check START and the appropriate pointers. Also check the horizontal positions as it’s possible for images to ‘hide’ at the edges of the screen if numbers are too large or too small. It helps to check that routines have been properly poked in by peeking various locations after running just the ‘poking routines’ section. I hope you find these routines useful—write if you have any questions.
—Stan Ockers

The listing, “PLUS-ZERO by Stan Ockers”, is on pages 7, 8 of the issue. The game page runs it line by line in an emulated Atari 800, just as typed in.
Where this copy came from: Typed-in copy from Atarimania (Plus_Zero.zip), proofread against the August 1981 issue in ACE Volume 1 (pages 83-85). The copy was a reworked version with a new header, title screen and instruction wording; those lines are restored exactly as Stan printed them (including the credit to L. Christopherson, whose game it was based on). The machine-language DATA matched throughout.
1 REM **** PLUS-ZERO ***** 2 REM ** STAN OCKERS ** 4 REM ** LOCKPORT, IL ** 5 REM ** 60441 ** 6 REM ** FROM A GAME BY ** 7 REM * L.CHRISTOPHERSON * 8 REM ****** 7-81 ******** 10 OPEN #1,4,0,"K:":GRAPHICS 18:POSITION 4,3:? #6;"PLUS - ZERO":POSITION 2,5:? #6;"NEED DIRECTIONS?" 12 POSITION 3,7:? #6;"(Y)ES OR (N)O":GET #1,A:IF A=89 THEN GOSUB 2000:GOTO 16 14 IF A<>78 THEN 12 16 GRAPHICS 0:POKE 752,1:POSITION 9,12:? "JUST A SECOND PLEASE.." 19 REM * POKE MISSILE-GR. ROUTINES * 20 FOR I=1544 TO 1768:READ A:POKE I,A:NEXT I 30 DATA 173,253,6,133,209,104,104,104,170,104,104,133,208,165,208,32,192,6,198,209,208,247,96 32 DATA 173,253,6,133,209,104,104,104,170,32,189,6,198,209,208,249,96 34 DATA 104,104,104,170,173,1,211,76,192,6 36 DATA 170,189,233,6,133,203,189,238,6,133,204,96 38 DATA 104,104,104,32,58,6,104,133,206,104,133,205,188,243,6,162,0,161,205,201,0,240,7,145,203,230,205,200 39 DATA 208,243,96 40 DATA 104,104,104,32,58,6,188,243,6,200,192,126,176,21,177,203,208,247,136,177,203,240,6,200,145,203,136 41 DATA 208,245,200,145,203,254,243,6,96 42 DATA 104,104,104,32,58,6,188,243,6,192,1,240,19,208,1,200,177,203,240,6,136,145,203,200,208,245,136,145 43 DATA 203,222,243,6,96 44 DATA 104,104,104,32,58,6,160,0,152,145,203,200,16,251,96 46 DATA 104,104,104,170,173,0,211,133,208,133,207,70,207,176,4,138,32,140,6,70,207,176,4,138,32,104,6,70,207 47 DATA 176,3,222,248,6,70,207,176,3,254,248,6,189,248,6,157,0,208,96 48 REM * VECTORS FOR PLAYER MEM * 50 A=PEEK(106)-8:POKE 54279,A:POKE 1774,A+2:POKE 1775,A+2 55 POKE 1769,0:POKE 1770,128:START=256*A 58 REM ** POKE IMAGE DATA ** 60 FOR I=START TO START+17:READ A:POKE I,A:NEXT I 62 DATA 255,255,195,219,219,195,255,255,0,24,24,24,255,255,24,24,24,0 70 REM ** CREATE DIRECTION STRING ** 72 DIM D$(20):FOR I=1 TO 20:READ D:D$(I,I)=CHR$(D):NEXT I 74 DATA 11,10,14,6,7,11,9,13,5,7,14,10,11,9,13,14,6,7,5,13 90 GRAPHICS 5:POKE 752,1:SCORE=0:BUMP=0:POKE 1789,5 100 REM ** SET SPEED ** 105 IF KEY>0 THEN 115 110 ? :? :? " INPUT SPEED 1(SLOW) TO 6(FAST)":GET #1,KEY 115 IF KEY<49 OR KEY>54 THEN 110 120 SPEED=KEY-48:POKE 1789,SPEED 150 REM ** INITIALIZE ZERO ** 160 POKE 1784,128:POKE 53248,128:POKE 1779,65:POKE 208,13:POKE 704,200:A=USR(1706,0):A=USR(1606,0,START) 170 REM ** INITIALIZE PLUS ** 180 POKE 53249,128:POKE 1785,128:POKE 1780,40:A=USR(1706,1):A=USR(1606,1,START+9):POKE 705,184 200 REM ** INIT. MISSILE GR. ** 210 POKE 559,46:POKE 53277,3 220 R=INT(RND(0)*20)+1:DIR=ASC(D$(R,R)) 260 GOSUB 1000:POKE 53278,0 300 REM ** MAIN LOOP STARTS HERE ** 310 A=USR(1567,1):IF PEEK(53261)=1 THEN 610 317 A=USR(1721,1):SOUND 0,0,0,0 320 IF PEEK(53253)>1 THEN 710 330 A=USR(1544,0,DIR):X=PEEK(1784):Y=PEEK(1779) 335 IF Y>85 OR Y<19 OR X>196 OR X<51 THEN 810 340 X0=X/2-22:Y0=Y/2-7:LOCATE X0,Y0,Z:IF Z=0 THEN COLOR 2:PLOT X0,Y0:COUNT=COUNT+1:SOUND 0,30,10,12 390 GOTO 310 610 SCORE=SCORE+COUNT:COUNT=0:BUMP=0:SOUND 0,100,14,14:FOR I=1 TO 100:NEXT I:SOUND 0,0,0,0:GOSUB 1000:GOTO 150 700 REM ** END OF GAME ** 710 POKE 656,0:POKE 657,2:? " Game over - Press speed key" 715 SOUND 0,60,12,14:FOR I=1 TO 300:NEXT I:SOUND 0,0,0,0 720 IF SCORE>HIGH THEN HIGH=SCORE 730 GET #1,KEY:POKE 53277,0:GOTO 90 800 REM ** HIT AN EDGE ** 810 SOUND 0,50,4,12:IF Y>85 THEN OFFSET=0:GOTO 850 820 IF Y<19 THEN OFFSET=5:GOTO 850 830 IF X>196 THEN OFFSET=10:GOTO 850 840 IF X<51 THEN OFFSET=15 850 R=INT(RND(0)*5)+1:P=R+OFFSET:DIR=ASC(D$(P,P)):POKE 53278,0:BUMP=BUMP+1:COUNT=0 860 IF BUMP=20 THEN 710 870 GOTO 260 1000 REM ** DRAW FIELD ** 1010 ? #6;CHR$(125):COLOR 1:PLOT 0,0:DRAWTO 79,0:DRAWTO 79,39:DRAWTO 0,39:DRAWTO 0,0 1020 POKE 656,1:POKE 657,4:? "HIGH SCORE = ";HIGH,"SCORE = ";SCORE; 1030 POKE 656,3:POKE 657,18:? "SPEED ";SPEED; 1040 RETURN 2000 GRAPHICS 0:? :? ,"INSTRUCTIONS":? :? ,"PLUS - ZERO":? :? "(1) Use joystick (PLYR 1) to move the":? " plus." 2010 ? :? "(2) If Plus and Zero hit each other":? " your score increases by the" 2020 ? " number of dots behind the Zero.":? :? "(3) If you hit a dot, you're out!" 2030 ? :? "(4) If you allow the zero to bounce":? " off the screen edge 20 times" 2040 ? " without scoring ... game's over!":POKE 752,1 2050 ? :? " HIT ANY KEY TO CONTINUE":GET #1,A 2060 RETURN