A downloadable calculator

Have you ever been stuck in the situation where you need a screenful of pi but can't afford an SD card with a capacity of even a couple kilobytes? Look no further, my friend, for in the blink of an eye* this program will calculate it for you!

* "Blink of an eye" is defined as the duration the eye is closed for whilst sleeping.

Benchmark

The number of digits generated depends on the screen mode your Commander is in when the program is run. A larger number of digits takes significantly longer to generate, so you may wish to adjust your screen mode before running.

Note: This section is based on version 1 of the program. Version 2 is a little faster, e.g. screen mode 0 I now estimate to be 4h14m.

Screen mode
CharactersTime
048005h28m*
1, 2
24001h22m*
3, 128
120020m30s
4, 5
6005m07s
63001m17s

* Calculated from Box16 warp mode. Timing may be inaccurate, but should still be a decent ballpark.

How does it work?

Honestly, I don't know. But it's open source on GitHub, if you want to try and find out. It was inspired by the below video and is fundamentally the same, though requires more 24-bit routines due to calculating up to 4800 digits rather than 960.


I was tempted to call this PI.PRG, but that uninspired name is already taken.

Download

Download
4800PI.PRG (2024) 798 bytes
Download
4800PI-V1.PRG (2023) 697 bytes

Install instructions

  1. LOAD "4800PI.PRG"
  2. (Optional) Set screen mode, e.g. SCREEN 6 – see above table.
  3. RUN

After running, you may press the RESET button on your Commander X16 (Ctrl+R in emulator) to return to BASIC.

Note: In screen mode 0 (80 columns, 60 rows) it takes about 11 seconds for the first decimal place to appear. Please be patient with it. But if it takes longer, I guess it's broken.

Development log

Leave a comment

Log in with itch.io to leave a comment.