+KayBee Posted May 30, 2016 Share Posted May 30, 2016 Good Day Atarians, In my quest to learn BASIC, I am understanding many commands and their use, but I am puzzled at how to know what a DATA statement's DATA represents. In this joystick drawing program example below, (from the COMPUTE! first book of Atari Graphics), the DATA statement is a mystery to me. It has 22 values, which number doesn't correspond to anything I can think of. Is there a way to read the DATA and understand what it is? At least in the case below. 10 GRAPHICS 11:DIM SX(15),SY(15):FOR K=5 TO 15:READ X,Y:SX(K)=X:SY(K)=Y :NEXT K:X=40:Y=96:COLOR 1 20 PLOT X,Y:X=X+SX(STICK(O))=X+(X<O)-(X>79):Y=Y+SY(STICK(O)):Y=Y+(Y<0)-(Y>191):IF STRIG(O) THEN 20 30 C=C+1-15*(C=15):COLOR C:GOTO 20:DATA 1,1,1,-1,1,0,0,0,-1,1,-1,-1,-1, 0,0,0,0,1,0,-1,0,0 Thank you very much. KB 1 Quote Link to comment Share on other sites More sharing options...
+KayBee Posted May 30, 2016 Author Share Posted May 30, 2016 Not sure how the emoji got in there... Quote Link to comment Share on other sites More sharing options...
MaPa Posted May 30, 2016 Share Posted May 30, 2016 (edited) DATA values are just data values nothing more. It's up to you what ever you want to represent with it. It can be data for PMG objects, data for assembler routine used with USR etc. In this case the DATA values are just deltaX,deltaY pair which is added to current X,Y position according to joystick read value from register (value 5-15 therefore the READ from DATA stores in arrays SX,SY from index 5 up). For example the first two values are 1,1 so it means it will add 1 to X and 1 to Y which should be joystick right-down and if you look at corresponding values for STICK register, you will find that right-down is value 5 - as the first index where the DATAs are loaded. Edited May 30, 2016 by MaPa Quote Link to comment Share on other sites More sharing options...
+KayBee Posted May 30, 2016 Author Share Posted May 30, 2016 Thank you MaPa for the complete answer. I understand. Great! Cheers, KB Quote Link to comment Share on other sites More sharing options...
Dmitry Posted May 30, 2016 Share Posted May 30, 2016 (edited) removed Edited May 30, 2016 by Dmitry Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.