Faster 4800Pi

I saw that today is Pi Day, so I published some changes to my world-renowned 4800Pi program for the Commander X16.

The main change was to offload the bulk of the multiplication and addition from the CPU onto the VERA module. A while back there was this “FX” update to its bitstream, inspired by the SNES Super FX coprocessor no doubt, given one of the demos for it is mode 7-style graphics.

One of its features is that it can help with bulk multiplication and addition, which is part of what 4800Pi does — it does a couple multiplications and sums them up a whole bunch of times for each digit.

It’s especially useful since I need a 24-bit answer, which isn’t the most efficient thing in the world to accomplish on an 8-bit CPU. Fortunately, the VERA FX feature allocates 32 bits for this purpose.

Not so fortunately, it doesn’t appear to do anything to help in regards to division. So that’s still a rather slow step in 4800Pi’s loop.

There aren’t any other particularly interesting changes in this update. I found I can replace a couple for loops with repeat, which saves some bytes. I don’t remember why I used for in my when to begin with.

It’s not an insane difference. Let’s be generous and call it a 30% increase — my patience doesn’t stretch far enough to time it properly.

Still, someone might find it to be a useful example or have ideas as to how it could be improved. See the code changes or download the new release.


Comment on this article at itch.io

See the original post: Celebrating Pi Day on the Commander X16