Sunday, February 11, 2007

Lomont, Mandelbrot and the CoCo 3

Chris Lomont is a computer scientist for Cybernet who, like many of us, has a wide range of interests. His personal page is fantastic example of what a real personal page should be, with sections on everything from Sudoku to Philosophy. He's also got an amazing LED cube kit, called the Hypnocube you can buy and build yourself (you can buy it complete, but where's the fun in that). Oh, and he also does CoCos.

Mr. Lomont's CoCo page is currently on a single subject, a Mandelbrot renderer for the Color Comptuer 3. Written in assembler, the program generates those wild and hypnotic images from the Mandelbrot set right on your own CoCo, or emulator as the case may be. One of the reasons I haven't been active much is, thanks to Mr. Lomont, I've been letting my CoCo run this program pretty much non-stop for about two weeks.

The CoCo 3 rendering the Mandelbrot set using Chris Lomont's generator.
This is the first pass that gets more detailed in each successive pass.

When I was a wee lad I never turned my CoCo off. Seriously, for about ten years, and through three CoCos (1,2 and 3) I doubt the thing was off more than a few hours. Maybe longer if we went on vacation, my memory isn't that good, but mainly it was on 24/7. Since I got back into the CoCo two years ago, it's been mostly off. I turn it on to play games, mess with it, and test vintage stuff, but when I'm done I shut it off. Not lately, though.

With Mr. Lomont's program running, Ramona (the CoCo 3) runs pretty much all the time. Why?


I honestly don't know. Mandelbrot generators fascinate me for some reason. It's one of those weird psycho things, because I really have no idea how they work, why they work, what it's suppose to represent, or anything else for that matter. Did I mention I suck at math and numbers? Yeah? Good. Okay, I did wiki it and actually learned something. But that's not why Chris Lomont's program is so cool. It's just that it makes really cool fractals. More, it makes really cool fractals on a CoCo. Double whammy!
The full set after the final pass on the CoCo 3. Sweet, eh?


First things first. If you just want to see what the program does, or study the source code, fire it up on a PC using an emulator. I ran it in MESS with the throttle off and it renders at a pretty good clip (for an 8-bit computer emulator that is). Very nice. The various assembler routines Mr. Lomont has developed, including a low level keyboard routine and the fixed point mathematics routines for the CoCo are worth looking into for programmers. Mr. Lomont did all the hardware interfacing routines direct, so there's no ROM calls at all. For those looking to go to the CoCo hardware directly, here's a good example of how to go about it.

He's also compiled a couple of outstanding resource files on the CoCo hardware and the 6809. While not complete at the moment, the amount of information included, and the excellent format, make these two compilations pretty essential. Of planning on programming the CoCo seriously, snag these right away.

Of course, if you want a Mandelbrot generator on the PC, just google it and you'll get a ton of them. Good ones, too. But it isn't a CoCo, ya know?

About five zooms in and after three (I think) passes. You can select
how deep you want to go at any point in the program by pressing
a key, which brings up a bounding box to select the area of interest.
The colors were washed out by the camera. The colors are nice
and sharp on a real CoCo.

So how is it on a real CoCo? Fabulous! The images, even in 16-colors, are gorgeous. The caveat, of course, is that it takes a long time to render a selection. As in hours. Mr. Lomont anticipated this and has the CoCo do a quick pass first, so you can start doing deep zooms much faster, looking for interesting fractals. The CoCo then continues to get more detailed with each successive pass. A full render takes several hours, but the result are wonderful. This is truly the CoCo as art. :)

The program does it's job well. You probably do want to download the second version listed on the site. That's the one that includes the zoom feature and progressive rendering. Mr. Lomont also mentions on the site that he may possibily revisit the program. Personally, I'm thinking the save to disk feature would be great. (I have to use the digital camera to capture the nice ones, but it's not really ideal. Also, with a save feature in a standard file format, you could, say import the images into CoCo Max or another editor and play with them.) It would be fun to have several zooms saved to disk and a simple slide show viewer that could show them progressively, or even give a guided tour of some of the more popular and wicked cool sites in the Mandelbrot set (some even have names). A 256 color version is mentioned as a possibility, as are a timer, finished sounds and animated palettes. All would be very cool. I'd also like to see a way to force the program to skip ahead to the "final pass" after finding an agreeable location. As it is now, it goes through each progressive set non stop.

The camera keeps washing out the colors, but I liked the
shape of this one. Drill in much deeper around the point
there and it goes into some neat spiral patterns.

This is a perfect example of CoCo love resulting in some really cool development. Chris Lomont has created a really neat Mandelbrot program for the CoCo. But more importantly, he's done some serious scrounging of technical details on the machine and graciously compiled them for all to use. And to top it off, all the source code is posted for perusal.

Oh, and he also mentioned the possibility of porting Lemmings to the CoCo. Ohhh! Don't tease... :P

Stop by Chris Lomont's site and get your CoCo exploring the infinite possibilities of the Mandelbrot set, dig the technical docs, and enjoy the code. While you're there, poke around the site. I guarantee it'll be an interesting stop. Now I just need to start saving my pennies to snag one of those wicked hypnocubes... hmmm....

Angel's Luck,
Capt.

Drop by Capt's CoCo Hut to discuss this article, talk about CoCo collectibles, and chat abuot NitrOS-9 with the one and only briza!

2 comments:

Anonymous said...

Hi Capt,

Yeah been there done that, Downloaded the program, Mostly I wanted to look at the source code, Fascinating read. I can see how he did the graphics. But still I would love to be able to do a Coco 3 game in Assembly, But I'm years away from doing any games in assembly.
On the Subject of Lemmings, Chris your mean to tease us fellow coconuts, We are all praying you go ahead and do a Lemmings port to the coco 3 platform. And I'll buy a copy for sure.

laters

Briza

Captain Computer said...

I'd buy it too! :)

I do know what ya mean about assembly. I keep looking at it and going "That's not that hard." And it's not, particularly. It's the time to get to it and study on it that's the problem. Ah, well... I'm still going to do games in BASIC, and I'll learn assembly when I get to it. :)

Angel's Luck,
Capt