Author Topic: Locomotive BASIC - "3D" Mandelbrot Generator - Amstrad Action Type-in from 1990  (Read 558 times)

0 Members and 1 Guest are viewing this topic.

Offline ComSoft6128

  • ..................................
  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.850
  • Country: scotland
  • CPC THEN CPC NOW
    • index.php?action=treasury
  • Liked: 1940
  • Likes Given: 4071
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.
« Last Edit: 15:27, 27 November 20 by ComSoft6128 »

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.417
  • Country: au
    • index.php?action=treasury
  • Liked: 1110
  • Likes Given: 1320
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.
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline Sykobee (Briggsy)

  • 6128 Plus
  • ******
  • Posts: 811
  • Country: gb
  • Liked: 305
  • Likes Given: 470
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.

Offline TotO

  • 6128 Plus
  • ******
  • Posts: 3.850
  • Country: fr
    • ?area=showdonations;u=4
  • Liked: 2948
  • Likes Given: 1776
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)

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.380
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1072
  • Likes Given: 2603
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.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
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