home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 227
/
227.d81
/
t.64nex
< prev
next >
Wrap
Text File
|
2022-08-26
|
7KB
|
286 lines
u
6 4 N E X
by Brian Crosthwaite
64nex is not only a new set of
Nexae plots, it marks a graphics
comeback for me. I started doing both
graphics and the Nexus plots on the
C64 back in 1982. I soon moved to the
C64 with SIMONS' BASIC. I've messed
around with the Tool and others too
nominal to mention. I really got into
the guts of the computer when I got
into programming the VIC20.
I finally started programming the
C128 (shortly after a small, yet
productive, stint on the c16). The 128
made doing hires graphics easy and I
had no memory problems. Programming in
geoBASIC is a pleasure, and that's
what I've spent the last couple of
years doing.
Which brings us full circle. While
geoBASIC is nice, not every
LOADSTARite has GEOS. Enter commodore
BASIC. That's what 64nex, my latest
creation, is written in. Having
written that first program means I now
have a skeleton with which I can put
the maths of other Nexae. This means
more cool screen-burning-time-wasting
fun! ;)
The program is fairly self-
explanatory. 64nex has three nexus
designs I wrote on my Kyocera
smartphone. When coding on the x64
from the VICE emulator package, I made
a discovery. The original code simply
plotted the base Nexus (for all
three). The palm version had three
separate programs that only ran
through the math, did the plots, and
that was it. The plot on the 64 didn't
reset C -- my sneaky dimensionalizer
variable! Something I had overlooked
in the past. Running the plot again
produced different results based on
this variable starting at a different
value. It was the magnification I had
thought I previously programmed, and
later thought was not possible.
C can be reset to zero, set to any
value (+ or -), or randomly selected
(0-319).
The PRG saves the screen as a
Doodle. I'd like to thank Duane Forte
at this time for the addresses he gave
me for the Doodle save, and to Aaron
Shaigun -- my save routine was based
on his PrintShop Panel Save routine.
For those who have not heard of
the Nexus, it is a math I created when
I first got my C64 back in 1982. It
started with me plotting with the
simple conversion from radians to
degrees. Those oft seen formulae in
many a beginner BASIC book:
X=INT(XC+R*SIN(N/180*PI))
Y=INT(YC-R*COS(N/180*PI))
(or maybe it was in my electronics
books -- it was sooo long ago ;) X and
Y are the Cartesian Coordinates we
learned as Ordered Pairs.
INT simply cuts off any fractional
value in the calculation (this is left
over from converting to a byte
conversion as integer math tends to be
faster and only whole numbers get the
privilege of being POKEd into memory).
XC and YC are basically 159 and 99
since the X is zero to the left of the
Commodore' screen and Y is zero at the
top, allowing for R (radius) and N
(degrees) to be literal numbers when
we make the circle with the circle
appearing centered on the screen.
otherwise the circle would be centered
at the top left of the screen, only
showing a quarter of it.
To over simplify the rest, 180 is
half a circle in degrees and X takes
care of one half while Y the other.
SIN & COS are the math functions for
returning the sine and cosine of a
given value. In this case, we are
converting to a plot that contains the
information of a certain radius (size
of the circle from center out) and a
certain degrees starting from the top,
going clockwise, thus the +R, and -R
in X and Y, respectively) on around to
complete a circle). This part takes
the degrees that we use and turns them
into radians, the computer uses.
X = xcenter + R radius * degrees,
Y = ycenter - R radius * degrees
(* is computerese for times).
You can change x's and Y's R
separately to make ovals and the like.
In our calculation, you'll see it
changes with every individual plot
sweep of the inner loop. (This is not
necessarily true of all Nexae.)
PI is 3.14, or in the case of the
C-64, 3.14159265 as there is a decent
slice of PI in the computer before you
:)
To make a circle, of course, you
plot n from 1 to 360. The bigger R
the bigger the circle, the smaller R
the smaller the circle.
Enter the mind warp (or was it
just a warped mind?).
Having a computer in the early
80s was almost unbelievable: "Wow, I
have a computer -- cool!" And thinking
as such, "You can do stuff with
computers, by simply telling it what
to do!" So I did.
"Computer...computer?" Try the
keyboard. Ok, now then let's change
this and see what happens, oh, and
I'll add this here and lets split that
p....
Soon the snailSkin Nexus was born
(see ULTIPLOT128, LOADSTAR128 issue
41). It was only the beginning as I
made more complex designs, carefully
tweaking values and making loops that
interacted with each other.
This set of Nexae was a logical
step of interacting loops. Here is
the base math:
nexNexus (NN):
--------------
FOR N=1 TO 100
FOR V=-N TO N
C=C+.05
X=INT(XC+V*SIN(N/(C/N)*3.14))
Y=INT(YC-V*COS(N/(C/V)*3.14))
plot (x,y) see BASIC listing for more
info on plotting.
NEXT V
NEXT N
priorNex (PN):
--------------
FOR N=1 TO 99
FOR V=-N TO N
C=C+.05
X=INT(XC+V*SIN(N/(C/V)*3.14))
Y=INT(YC-V*COS(N/(C/V)*3.14))
plot (x,y) see BASIC listing for more
info on plotting.
NEXT V
NEXT N
yan (YAN):
----------
FOR N=1 TO 100
FOR V=-N TO N
C=C+.05
X=INT(XC+V*SIN(N/(C/N)*3.14))
Y=INT(YC-V*COS(N/(C/N)*3.14))
plot (x,y) see BASIC listing for more
info on plotting.
NEXT V
NEXT N
NOTE: To see the source code, simply
load the program from BASIC without
running it, then list. Also note that
division by 0 (/0) is handled by
simply not doing it.
The difference between the three
Nexae can be seen in C's divisor:
NN has X= C/N and Y= C/V;
PN has X= C/V and Y= C/V;
YAN has X= C/N and Y= C/N.
While these Nexae are closely
related, they produce a very different
image on the screen.
Using variations in C at the start
will produce pictures that are
seemingly unrelated. But C is the key
to how these Nexae work. So far, in
everything I've done with this kind of
plot, it is the closest thing to a
zoom feature -- and you can zoom both
ways!
Try minus numbers.
C does not automatically reset, so
to see each Nexus in it's base form
simply hit <<7>> to reset it. Pressing
<<8>> will let you enter a value for
C. Note that my input is of a funky,
space aged, style here -- there is no
cursor on the screen. It's just what I
chose for the interface and if it
proves to be a problem then in future
Nexae I'll put a cursor.
C can be set to a random number by
the computer by selecting <<9>>.
The over plot, <<5>>, allows you
to plot on the screen without clearing
it. The screen can be cleared in this
mode by hitting <<6>>. Want to
reverse the screen, making a negative
like image? <<4>> will do it before
your very eyes.
Multiple drives are supported, to
access another drive, press <</>>,
then press it again until you get the
drive you want. Screens can be saved
a Doodle.
Ok, enough dribble drabble -- hit
<<R>> and run the thing!
Enjoy!
Brian a.k.a. noesis0
[DAVE'S AFTERWORD]: When I ran GEONex,
I had no idea what it did (being a
non-GEOS kind of person). Now I see
these amazing plots and stand in awe
of the power of mathematics -- and
Brian's ability to bring the images to
our machines.
If you have a SuperCPU (or use VICE in
Warp Mode), the patterns will sweep
around the screen. On a stock C-64,
plan to get a cup of coffee while the
Nexae plot.
DMM