Jump to content

BASIC 'Twisted Transcendentals' 1.0.0

   (1 review)
Sign in to follow this  

7 Screenshots

About This File

This weekend, I decided to play with X16 BASIC using the emulator and wound up making an X16 adaptation/extension of a short program for the Plus/4 that appeared in 'The Transactor' journal decades ago. The program uses three parameters: "S" (squiggles/spokes/segments), "W" (wave factor), and "A" (amplitude).  Using X16 BASIC's extensions in terms of bitmap drawing commands, it outputs a neat design with lots of color and a surprising amount of visual variety.

The original Plus/4 program just plotted in black and white and had some built in limitations (and at least two bugs), but I decided to extend the program, add a menu, and upload it after I added color and decided these were fairly cool looking results from such a short simple BASIC routine. 

It strikes me as a cool demo because with just three core parameters, you can get an astonishing range of outputs. Of course, like many graphics demos based on stacking transcendental functions, there are combos of inputs where the functions will sort of fall apart and produce something akin to a kiddo scribbling with crayons , but there are also weird "islands" in the domain of possible parameter combinations where order re-asserts itself, both in terms of what gets drawn and (because colors are picked by an AND mask over one of the function variables) how the colors play out.     Note that I included a sample screen shot about some weirdness you can get with very high numbers.   Mostly that is  the result of my simple use of .01745 to convert between degrees and radians, and is caused by amplifying that really simplified rounding of  PI/180.

There are 4 'modes' of operation you can pick from the menu.   You can specify inputs for S, W and A manually; the program can run a sequence with fixed S and A while incrementing W; there is a mode that tries to picks random parameters within several domains where the program produces nice outputs; and there's one that just reads the inputs from some "presets" in DATA statements.  (You can of course add your own 'best of' examples by adding data statements between lines 432 and 499).   

I always considered myself a passable BASIC programmer, but this weekend showed me I'm really sort of rusty so please go easy on me if I did something inefficiently or especially 'dumb' in my implementation. The main output routine is extremely crunched (sorry, not sorry) and I did some further things to optimize from the original program for purposes of getting  a bit more performance out of the main routine.    Although it absolutely crawled on the Plus4, I think its fairly impressive on the X16 especially if you look at the sheer amount of sines, cosines, multiplications, and variable fetches /updates that occur during an entire cycle through the primary output drawing loops.   

The X16's 40 column mode (SCREEN $00) was used to key this in and format it, so its probably best if listed/ displayed/reviewed in that mode,   Tested on emulator r.38, and I don't see anything in the pending updates for the next emulator release that would break anything here.

If there are questions about why/how I did something I'll be happy to answer. In fact, if there's any interest in a more detailed write-up of this short and fairly simple program (e.g., section by section, and line-by-line), I would be happy to give it a shot, especially if there are folks new to Commodore BASIC that might find it useful.  It seems to me there are many highly advanced programmers for the X16 posting on this site who are using assembly, C, and even languages they are developing themselves.  Its amazing!  However,  its surely the case that part of the mission of the X16 is to get some newbies involved, and from where I sit, that really does mean getting some more content up here written in BASIC. Keeping that in mind,  I'll probably be diving back into more old issues of The Transactor to do more conversions for the X16 and will continue to upload as long as I'm still having fun with BASIC.   Cheers.   


try_it

Yes

try_it_start_prg

TWISTED TRANSCENDENTALS.PRG
  • Like 9



User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest

ZeroByte

  

This reminds me of a "screensaver" I wrote in Turbo Pascal which had many modes based on polar coordinates - drawing spirals, "spyrographs," squiggly snakey lines crawling around, etc. It's neat to watch math make pictures. And I agree with your observation that the community could use some content for newbie-level members who aren't up to talking about bus timing, latches, compiler internals, etc. This program definitely fits the bill.

Share this review


Link to review
×
×
  • Create New...

Important Information

Please review our Terms of Use