News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ComSoft6128

Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990

Started by ComSoft6128, 10:48, 27 November 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ComSoft6128

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


Links:

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

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

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

http://www.cpcwiki.eu/index.php/Technical_information_about_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.

ervin

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.

Sykobee (Briggsy)

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.

TotO

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?
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

robcfg

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.

AMSDOS

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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod