CPCWiki forum

General Category => Programming => Topic started by: ComSoft6128 on 10:48, 27 November 20

Title: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: ComSoft6128 on 10:48, 27 November 20
Forty minutes.
That's how long it takes for this program to complete the image which is the end product.
That's a long time! ???

Why?

Is Locomotive BASIC slow when it comes to performing mathematical calculations ?
Or, is the Z80 working flat out here?
Or is it a combination of both?
Something else?

1990 Type-in, by Chris Sangwin, published in issue 60 (P73) of Amstrad Action magazine - completed image at 41:13


https://www.youtube.com/watch?v=aC_Dxh4iPIA (https://www.youtube.com/watch?v=aC_Dxh4iPIA)


Links:

https://en.wikipedia.org/wiki/Amstrad_Action (https://en.wikipedia.org/wiki/Amstrad_Action)

https://en.wikipedia.org/wiki/Locomotive_BASIC (https://en.wikipedia.org/wiki/Locomotive_BASIC)

https://www.cpcwiki.eu/index.php/Locomotive_BASIC (https://www.cpcwiki.eu/index.php/Locomotive_BASIC)

http://www.cpcwiki.eu/index.php/Technical_information_about_Locomotive_BASIC (http://www.cpcwiki.eu/index.php/Technical_information_about_Locomotive_BASIC)

https://rosettacode.org/wiki/Category:Locomotive_Basic (https://rosettacode.org/wiki/Category:Locomotive_Basic)


Not emulated - original hardware and software.

Please note that the aspect ratio for YouTube is 16:9 but the CPC monitor has an
aspect ratio of 4:3 so you may wish to adjust your viewing device accordingly.
Title: Re: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: ervin on 11:32, 27 November 20
I'd say it's a bit of both.
Also depends on how many iterations each pixel is calculated to - that determines the speed of the mandelbrot.
But there also seems to be some 3d calculations going on.
I dunno, I haven't checked the code yet.

Apart from the speed though, it's kind of impressive.
Title: Re: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: Sykobee (Briggsy) on 11:57, 27 November 20
Mandlebrots are slow normally on a Z80, never mind in BASIC. There are a lot of iterations in the complex/centre of the pattern.
The 3D stuff is just a skew and a vertical line the height of the iteration count as far as i can see, which is probably minor in comparison.
Title: Re: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: TotO on 14:46, 27 November 20
May be something else? :)

What if you restart from previous Mandelbrot topic with optimised code to render it now in 3D?
And next, if you considerate to not compute/draw the invisible parts of the picture?
Title: Re: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: robcfg on 20:47, 27 November 20
Well, on the computation side of things there's the 12-second Mandelbrot and Julia generator for the BBC Micro.


http://forum.6502.org/viewtopic.php?f=2&t=5183


Now, that's some speed!


Once you have the generated 2D image, the only optimisation you can do is render it front to back so to not draw hidden pixels.
Title: Re: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990
Post by: AMSDOS on 23:20, 27 November 20
I'm not sure if I've done the math properly. I took the code minus the loops and timed it, from start to finish it takes 0.08 secs, which doesn't sound like much, but when you multiply that by the resolution of mode 0 screen (160x200), it becomes 32000x0.08 = 2560. Divide 2560/60 and I get an result of 42.6666667 minutes.


Things to remember:


* BASIC is an Interpreted Language, which means everything has to be converted for the machine to understand, which takes time.
* Mandelbrots use Floating Point Numbers (Decimal Numbers), which aren't as fast as Integers (Whole Numbers).
* Compiled Languages such as Pascal may or may not be good with Mandelbrots depending on how good they handle the math. A comparision between Hisoft's Pascal 4t Vs. Turbo Pascal 3 had Hisoft Pascal well in front. A comparision chart was posted within these threads, though I'm unable to find it!  :(
* Can be written in Assembly, though believe it to be difficult.
Powered by SMFPacks Menu Editor Mod