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.
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.
* 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.
- (Optional) Set screen mode, e.g.
SCREEN 6– see above table.
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.
- Celebrating Pi Day on the Commander X16Mar 12, 2023
Leave a comment
Log in with itch.io to leave a comment.