Pretty fast Mandelbrot set generator...

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Pretty fast Mandelbrot set generator...

Post by Bean »

I wrote a program a play with the Mandelbrot set.
Uses ASM to draw the set and BASIC to handle the user interface.
Takes about 85 seconds in slow mode (NTSC) or about 16 seconds in fast mode.

Comments welcome...

Bean
Attachments
mand01.TZX
(2.28 KiB) Downloaded 406 times
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Pretty fast Mandelbrot set generator...

Post by Bean »

I noticed if you zoom in too much it just goes blank. I think the increment goes to zero.
I am using 8.8 fixed point math in the asm. I guess I could use 4.12 and get more zoom.

Bean
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Pretty fast Mandelbrot set generator...

Post by Bean »

I have updated the mandelbrot drawing program.
I now use 4.12 fixed point math so you can zoom in further.
I also added a couple more features (print, set max depth, etc).

I think this is quite a good demonstration program for the good ol' zeddy.

Bean
Attachments
mand02.P
(2.38 KiB) Downloaded 415 times
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Pretty fast Mandelbrot set generator...

Post by Bean »

I realized I didn't post the assembly source code for those interested...

This code is free to use and modify. Please give credit if you use it.

Bean
Attachments
Mandelbrot02.asm
(12.43 KiB) Downloaded 298 times
stroebeljc
Posts: 63
Joined: Thu Apr 23, 2020 6:02 am

Re: Pretty fast Mandelbrot set generator...

Post by stroebeljc »

It would be nice if the zoom focused on the center of the screen. It seems like I need to move the screen down 2 clicks after every time I zoom.
John
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Pretty fast Mandelbrot set generator...

Post by Bean »

John, To zoom from the center add these four lines

431 LET X = X - XI * 16
432 LET Y = Y - YI * 12
441 LET X = X + XI * 16
442 LET Y = Y + YI * 12

That should do it.

Bean
stroebeljc
Posts: 63
Joined: Thu Apr 23, 2020 6:02 am

Re: Pretty fast Mandelbrot set generator...

Post by stroebeljc »

Excellent!
Thanks, Bean.
John
User avatar
marste
Posts: 250
Joined: Sun Aug 10, 2014 9:58 pm
Location: Italy
Contact:

Re: Pretty fast Mandelbrot set generator...

Post by marste »

Bean wrote: Thu Apr 26, 2018 2:17 pm I now use 4.12 fixed point math so you can zoom in further.
I've seen that you're doing a lot of operations just to manage the 4 bit displacement. Wouldn't it be faster to go 8.16 in case more exponent were needed? (seems to me you would need the same operations to manage the exponent and even having 4 bits more precision, and would be easier to manage the mantissa, without all the mambo/jumbo shifting/rotational logic)

PS: I was thinking as an idea to investigate that as an extreme optimization might even work a 0.16 setup (with mantissa 1 implicit), or a 1.16 one (with 2 bits of mantissa, one implicit and the other one - the sign - managed with just conditional jumps and no operations)...
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Pretty fast Mandelbrot set generator...

Post by Bean »

I think the 0.16 format would be faster, it would just limit what area you could view.
But it would let you zoom in further than my 4.12 format. So it might be worth it.

I was thinking about possibly changing the existing code so that it runs in fast mode, but shows a couple frames (20 or so) after every line so you can see how it going, but I'm not sure I can pull that off.

Bean
Post Reply