Atari's Small Miracles ====================== by Mark A. Brown - NOVATARI Welcome back to Atari's Small Miracles, the column written for the slow and/or lazy typists in this world. Here, programs are written short enough so anybody can type them in! There are fun programs, useful programs, strange programs, and learning programs. A little for everybody will appear in these pages. This month's theme is the player/missile graphics features the Atari computer can use. There are four quick programs to help you exploit this feature to its fullest! I won't even try to explain player/missile graphics here, I'll simply refer you to the many articles and books written about them. You won't have to look too hard to find some. Compute! publishing has put out literally dozens of good tutorials, ANALOG has put out a few, and so on. Almost every magazine that carries Atari will have covered player/missile graphics at some point. PMEDITOR The first program this month is used to help you create and change player/missile graphics. Type it in, run it, and you can work with any shape you want. The image can be eight pixels wide (obviously) and twenty-four lines high. Use the arrow keys without the control key to move your cursor about (i.e. the "-", "+", "=", and "*" keys move you). Press the space bar to turn on the pixel the cursor is sitting on, unless it was already on in which case the space bar will flip it off. Note that the numbers to the right of the editing area are the decimal numbers of the data you have in the player. If you don't like the player you are creating, you can strike the CLEAR key to erase it and start over. On the other hand, if you like your player, press the ESCape key to quit and a DATA statement will appear with the numbers needed to re-create that image. You can use it in PMMOVER, below, or in a program of your own. 10 GRAPHICS 0:POKE 752,1:DIM A$(2048): Z=INT(ADR(A$)/1024)*1024:Z=Z+1024*(Z Moves cursor" 40 POSITION 17,1:? " marks pixe ls":POSITION 17,2:? " clears pl ayer":POSITION 17,3:? " Ends" 50 D=Y*40+X+S:E=PEEK(D):POKE D,E+128:G ET #1,B:POKE D,E:X=X+(B=42)-(B=43):Y=Y +(B=61)-(B=45):X=X+8*(X=0)-8*(X=9) 60 Y=Y-24*(Y=24)+24*(Y=-1):IF B=125 OR B=60 THEN RUN 70 IF B=27 THEN ? CHR$(125):? "1000 DA TA ";:FOR A=0 TO 23:? PEEK(Z+560+A);", ";:NEXT A:? CHR$(126):END 80 IF B<>32 THEN GOTO 50 90 A=Z+560+Y:POKE A,PEEK(A)+(2^(8-X)*( E=0))-(2^(8-X)*(E<>0)):POSITION 10,Y:? PEEK(A);" ";:POKE D,3*(E=0):GOTO 50 PMMOVER This program is largely instructive, and serves little purpose on its own. It simply takes a player, pokes some data into it, then moves it around at your joystick's command. That is all. What it IS meant to do is show an easy way to vertically move players and missiles, through the technique of strings. This is a fairly simple idea that works quite well for small applications. Study the program for a while to fully comprehend it, and don't forget to notice the zeros at the beginning and end of the player data. Those make sure the player won't leave a stripe of data behind it. Replace them with some other number to see what I mean. 10 POKE 82,0:GRAPHICS 19:POKE 752,1:DI MA$(2048),P$(24),S(15,2):Z=INT(ADR(A$) /1024)*1024:Z=Z+1024*(Z255) 50 Y=Y+128*(Y<0)-128*(Y>127):GOTO 40:D ATA 1,1,1,-1,1,0,0,0,-1,1,-1,-1,-1,0,0 ,0,0,1,0,-1,0,0 60 DATA 0,129,66,36,24,24,36,66,129,66 ,36,24,24,36,66,129,66,36,24,24,36,66, 29,0 PLAYER5 One of the seldom used features of player/missile graphics is the fifth player option. Simply put, turning on bit 4 of location 623 (GPRIOR) turns all the missiles into one color to let them look like a fifth player if put together. PLAYER5 takes care of the tedium of that process, i.e. the continous poking of the four missiles to put them next to each other. POKE the horizontal position of the fifth player into location 256 and PLAYER5 will automatically move all four missiles to their appropriate places to simulate a single player. Remember that bit 4 of GPRIOR must be on and that the color of the player is controlled by location 711. 10 FOR A=256 TO 285:READ B:POKE A,B:NE XT A:A=USR(256):POKE 256,128:POKE 5326 5,255:POKE 623,16 20 DATA 234,104,162,1,160,11,169,6,76, 92,228,173,0,1,160,0,153,4,208,24,105, 2,200,192,4,144,245,76,95,228 VMOVER And finally a program to suit those of you who couldn't understand PMMOVER. This program is a machine language player/missile graphics mover that will take any player and move it any number of bytes up or down. To do this, in your program code the following: JUNK=USR(ADR(A$),PMADR,DIRNO) where PMADR is the address of the player you want moved and DIRNO is the number of bytes you want your player moved down (to go up, subtract the number of lines you want it to go up from 256; for example, to move up one line you would put 256-1 or 255 into DIRNO). And that is all. Your player will be quickly moved to that position. It doesn't matter if it's in single line or double line resolution, VMOVER will adjust automatically. 10 DIM A$(67):FOR A=1 TO 67:READ B:A$( A,A)=CHR$(B):NEXT A:DATA 104,104,133,2 13,104,133,212,104,104,133,215,160 20 DATA 255,173,47,2,41,16,208,2,160,1 27,132,214,160,0,132,216,177,212,72,15 2,24,101,215,37,214,168,177,212,170 30 DATA 104,145,212,196,216,240,5,138, 230,217,208,233,200,165,217,197,214,24 0,6,230,217,208,218,208,216,96 Atari's Small Miracles is a column that needs a regular source of small, quality programs, and that source is the readers, you! If you have any good ideas or programs, send them to: Atari's Small Miracles c/o Mark A. Brown 7097 Game Lord Drive Springfield, VA 22153 If they're less then ten lines and if they're good enough you'll see your name here! See you next month! [Reprinted from the April, 1986 issue of CURRENT NOTES: The Newsletter for Atari Owners. For more information on CURRENT NOTES, see the CNOTES file in the NEW PRODUCTS section of the Developers SIG.] 4444444444444444444444444444444444444444444444444444444444444444444444444444