home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 227 / 227.d81 / t.64nex < prev    next >
Text File  |  2022-08-26  |  7KB  |  286 lines

  1. u
  2.               6 4 N E X
  3.          by Brian Crosthwaite
  4.  
  5.  
  6.     64nex is not only a new set of
  7. Nexae plots, it marks a graphics
  8. comeback for me. I started doing both
  9. graphics and the Nexus plots on the
  10. C64 back in 1982. I soon moved to the
  11. C64 with SIMONS' BASIC. I've messed
  12. around with the Tool and others too
  13. nominal to mention. I really got into
  14. the guts of the computer when I got
  15. into programming the VIC20.
  16.  
  17.     I finally started programming the
  18. C128 (shortly after a small, yet
  19. productive, stint on the c16). The 128
  20. made doing hires graphics easy and I
  21. had no memory problems. Programming in
  22. geoBASIC is a pleasure, and that's
  23. what I've spent the last couple of
  24. years doing.
  25.  
  26.     Which brings us full circle. While
  27. geoBASIC is nice, not every
  28. LOADSTARite has GEOS. Enter commodore
  29. BASIC. That's what 64nex, my latest
  30. creation, is written in. Having
  31. written that first program means I now
  32. have a skeleton with which I can put
  33. the maths of other Nexae. This means
  34. more cool screen-burning-time-wasting
  35. fun!  ;)
  36.  
  37.     The program is fairly self-
  38. explanatory. 64nex has three nexus
  39. designs I wrote on my Kyocera
  40. smartphone. When coding on the x64
  41. from the VICE emulator package, I made
  42. a discovery. The original code simply
  43. plotted the base Nexus (for all
  44. three). The palm version had three
  45. separate programs that only ran
  46. through the math, did the plots, and
  47. that was it. The plot on the 64 didn't
  48. reset C -- my sneaky dimensionalizer
  49. variable! Something I had overlooked
  50. in the past. Running the plot again
  51. produced different results based on
  52. this variable starting at a different
  53. value. It was the magnification I had
  54. thought I previously programmed, and
  55. later thought was not possible.
  56.  
  57.     C can be reset to zero, set to any
  58. value (+ or -), or randomly selected
  59. (0-319).
  60.  
  61.     The PRG saves the screen as a
  62. Doodle. I'd like to thank Duane Forte
  63. at this time for the addresses he gave
  64. me for the Doodle save, and to Aaron
  65. Shaigun -- my save routine was based
  66. on his PrintShop Panel Save routine.
  67.  
  68.     For those who have not heard of
  69. the Nexus, it is a math I created when
  70. I first got my C64 back in 1982. It
  71. started with me plotting with the
  72. simple conversion from radians to
  73. degrees. Those oft seen formulae in
  74. many a beginner BASIC book:
  75.  
  76. X=INT(XC+R*SIN(N/180*PI))
  77. Y=INT(YC-R*COS(N/180*PI))
  78.  
  79. (or maybe it was in my electronics
  80. books -- it was sooo long ago ;) X and
  81. Y are the Cartesian Coordinates we
  82. learned as Ordered Pairs.
  83.  
  84.     INT simply cuts off any fractional
  85. value in the calculation (this is left
  86. over from converting to a byte
  87. conversion as integer math tends to be
  88. faster and only whole numbers get the
  89. privilege of being POKEd into memory).
  90.  
  91.     XC and YC are basically 159 and 99
  92. since the X is zero to the left of the
  93. Commodore' screen and Y is zero at the
  94. top, allowing for R (radius) and N
  95. (degrees) to be literal numbers when
  96. we make the circle with the circle
  97. appearing centered on the screen.
  98. otherwise the circle would be centered
  99. at the top left of the screen, only
  100. showing a quarter of it.
  101.  
  102.     To over simplify the rest, 180 is
  103. half a circle in degrees and X takes
  104. care of one half while Y the other.
  105. SIN & COS are the math functions for
  106. returning the sine and cosine of a
  107. given value. In this case, we are
  108. converting to a plot that contains the
  109. information of a certain radius (size
  110. of the circle from center out) and a
  111. certain degrees starting from the top,
  112. going clockwise, thus the +R, and -R
  113. in X and Y, respectively) on around to
  114. complete a circle). This part takes
  115. the degrees that we use and turns them
  116. into radians, the computer uses.
  117.  
  118.   X = xcenter + R radius * degrees,
  119.   Y = ycenter - R radius * degrees
  120.     (* is computerese for times).
  121.  
  122.     You can change x's and Y's R
  123. separately to make ovals and the like.
  124.  
  125.     In our calculation, you'll see it
  126. changes with every individual plot
  127. sweep of the inner loop. (This is not
  128. necessarily true of all Nexae.)
  129.  
  130.     PI is 3.14, or in the case of the
  131. C-64, 3.14159265 as there is a decent
  132. slice of PI in the computer before you
  133. :)
  134.  
  135.     To make a circle, of course, you
  136. plot n from 1 to 360.  The bigger R
  137. the bigger the circle, the smaller R
  138. the smaller the circle.
  139.  
  140.     Enter the mind warp (or was it
  141. just a warped mind?).
  142.  
  143.     Having a computer in the early
  144. 80s was almost unbelievable: "Wow, I
  145. have a computer -- cool!" And thinking
  146. as such, "You can do stuff with
  147. computers, by simply telling it what
  148. to do!"  So I did.
  149.  
  150.     "Computer...computer?" Try the
  151. keyboard.  Ok, now then let's change
  152. this and see what happens, oh, and
  153. I'll add this here and lets split that
  154. p....
  155.  
  156.     Soon the snailSkin Nexus was born
  157. (see ULTIPLOT128, LOADSTAR128 issue
  158. 41). It was only the beginning as I
  159. made more complex designs, carefully
  160. tweaking values and making loops that
  161. interacted with each other.
  162.  
  163.     This set of Nexae was a logical
  164. step of interacting loops.  Here is
  165. the base math:
  166.  
  167. nexNexus (NN):
  168. --------------
  169.  
  170. FOR N=1 TO 100
  171. FOR V=-N TO N
  172. C=C+.05
  173. X=INT(XC+V*SIN(N/(C/N)*3.14))
  174. Y=INT(YC-V*COS(N/(C/V)*3.14))
  175. plot (x,y) see BASIC listing for more
  176. info on plotting.
  177. NEXT V
  178. NEXT N
  179.  
  180. priorNex (PN):
  181. --------------
  182.  
  183. FOR N=1 TO 99
  184. FOR V=-N TO N
  185. C=C+.05
  186. X=INT(XC+V*SIN(N/(C/V)*3.14))
  187. Y=INT(YC-V*COS(N/(C/V)*3.14))
  188. plot (x,y) see BASIC listing for more
  189. info on plotting.
  190. NEXT V
  191. NEXT N
  192.  
  193. yan (YAN):
  194. ----------
  195.  
  196. FOR N=1 TO 100
  197. FOR V=-N TO N
  198. C=C+.05
  199. X=INT(XC+V*SIN(N/(C/N)*3.14))
  200. Y=INT(YC-V*COS(N/(C/N)*3.14))
  201. plot (x,y) see BASIC listing for more
  202. info on plotting.
  203. NEXT V
  204. NEXT N
  205.  
  206. NOTE:  To see the source code, simply
  207. load the program from BASIC without
  208. running it, then list.  Also note that
  209. division by 0 (/0) is handled by
  210. simply not doing it.
  211.  
  212.     The difference between the three
  213. Nexae can be seen in C's divisor:
  214.  
  215.   NN has X= C/N and Y= C/V;
  216.   PN has X= C/V and Y= C/V;
  217.   YAN has X= C/N and Y= C/N.
  218.  
  219.     While these Nexae are closely
  220. related, they produce a very different
  221. image on the screen.
  222.  
  223.     Using variations in C at the start
  224. will produce pictures that are
  225. seemingly unrelated. But C is the key
  226. to how these Nexae work. So far, in
  227. everything I've done with this kind of
  228. plot, it is the closest thing to a
  229. zoom feature -- and you can zoom both
  230. ways!
  231.  
  232.     Try minus numbers.
  233.  
  234.     C does not automatically reset, so
  235. to see each Nexus in it's base form
  236. simply hit <<7>> to reset it. Pressing
  237. <<8>> will let you enter a value for
  238. C. Note that my input is of a funky,
  239. space aged, style here -- there is no
  240. cursor on the screen. It's just what I
  241. chose for the interface and if it
  242. proves to be a problem then in future
  243. Nexae I'll put a cursor.
  244.  
  245.     C can be set to a random number by
  246. the computer by selecting <<9>>.
  247.  
  248.     The over plot, <<5>>, allows you
  249. to plot on the screen without clearing
  250. it. The screen can be cleared in this
  251. mode by hitting <<6>>.  Want to
  252. reverse the screen, making a negative
  253. like image?  <<4>> will do it before
  254. your very eyes.
  255.  
  256.     Multiple drives are supported, to
  257. access another drive, press <</>>,
  258. then press it again until you get the
  259. drive you want.  Screens can be saved
  260. a Doodle.
  261.  
  262.     Ok, enough dribble drabble -- hit
  263. <<R>> and run the thing!
  264.  
  265. Enjoy!
  266.  
  267. Brian  a.k.a. noesis0
  268.  
  269.  
  270. [DAVE'S AFTERWORD]: When I ran GEONex,
  271. I had no idea what it did (being a
  272. non-GEOS kind of person). Now I see
  273. these amazing plots and stand in awe
  274. of the power of mathematics -- and
  275. Brian's ability to bring the images to
  276. our machines.
  277.  
  278. If you have a SuperCPU (or use VICE in
  279. Warp Mode), the patterns will sweep
  280. around the screen. On a stock C-64,
  281. plan to get a cup of coffee while the
  282. Nexae plot.
  283.  
  284.  DMM
  285.  
  286.  
  287.