Publication
Publication Details
Volume: 3 Issue: 6
Date
Pages
Lots of Pi
8K ROM; 16K RAM
This program computes the value of Pi to 8, 16, 32, … up to 8192 decimal places! It uses base-100 arithmetic rather than decimal arithmetic and puts the numbers in character strings rather than arrays of five-byte numbers. It uses long-division to get the terms of Taylor’s series expansion of the arctangent, and long-addition to get the algebraic sum until the term vanishes.
But do not wait with baited breath for the answer. It takes about 60 hours (FAST mode, naturally) to compute Pi to 2048 decimal places! If you do not have a printer, modify the subroutine at 6000 to PRINT a page and STOP before continuing.
Explanation???
8K ROM; 1K RAM
Type in the following lines. For best results use SLOW mode. Press RUN and ENTER. Observe the results. How does this one work?
Richochet Revisited
8K ROM; 1K RAM
One of the pleasures of the “Just for Fun” column comes from typing in the program, playing around with it, and coming up with something new or different. This particular program started out as James John Hollandsworth’s “Ricochet” (SYNC 3:2) and evolved into something rather different with only a few changes. Run in SLOW mode. Be patient. If the first pattern does not please, try again.
INPUT Anywhere
8K ROM; 1K RAM
If you have ever wanted to INPUT variables from somewhere other than the bottom left hand corner of the screen, “INPUT Anywhere” is the answer.
The program allows any number between and 9999 to be INPUTted anywhere on the screen. Negative numbers cannot be used.
To change the INPUT location, change the PRINT AT statements in lines 15 and 40. Be certain that the Y coordinate in line 15 is one less than that of line 40. When INPUTting numbers less than 1000, be sure to add preceding zeros, e.g., 0020, not 20.
The ENTER key need not be pressed after the number is typed in. On the last keystroke, the entire number automatically goes into variable A, and the program continues.
COPYing Lines 23 and 24
When I got my TS2040 printer, I found that it would COPY the top 22 lines of the display. Quite a few programs use the bottom two lines, yet these are not available to the printer by the COPY command.
All 24 lines can be COPYed with the short machine code routine below. Type in the following line:
1 REM -/LN HiTPN
Type in the immediate mode POKE 16517,107
Then any where in the program that you want to COPY the screen, add the following line preceded by the appropriate line number:
(line number) RAND USR 16514 This line should come immediately after the screen looks like you want it to on paper. Voila! All 24 lines of the display!