I’ve always loved the Mandelbrot set and the stock picocalc comes with a Mandelbrot set generator. But it’s slow. Very slow.
Interpreted languages just aren’t good at math intensive code in a tight loop. So I played around trying to optimize the basic but could only get so far.
Then I discovered that you can write code in C and call it from MMbasic. I tried it out and found about a 7-10x speed up.
Making a CSub is a non trivial poorly documented process. So I bundled up what I learned on GitHub along with some versions of a much better Mandelbrot demo.
The code is available here. GitHub - jvanderberg/picocalc_csub_helpers: PicoMite CSub helper scripts
Note that the demo programs embed processor dependent machine code into the CSub definition, so you need to build for the correct mcu, rp2040 or rp2350. There’s premade versions in the ‘builds’ directory.
