If you are unfamiliar with the old BASIC computer language, then
please read this first. But if you are an expert in BASIC, then
just skip down to the programs.
Below are some old freeware science programs for PCs, written in the old
BASIC language, that I wrote many years ago (around 1989). They range
from ridiculously simple to almost sophisticated. I recently rediscovered
the programs when I was cleaning my house. Rather than throw them away,
I thought I'd put them on the web. Best of all, they are guaranteed
to be virus free and they won't cost you a cent! I hope you enjoy using
them.
PLEASE NOTE: You will not be "downloading" these programs. Instead,
you will be copying them to your clipboard. You must do the following:
1) You must have a PC with an operating system that can open a DOS
window (or a PC that can boot to DOS).
2) Make sure you have a copy of GWBASIC.exe, BASICA.exe, or QBASIC.exe
installed on your computer. You need one of these to run BASIC programs.
If you don't have one of them, you should be able to find a copy on the
Web. If you are using Qbasic and are having trouble getting the programs
to load and run, read how to easily fix
the problem.
3) SELECT (highlight) all of the program code on the page, and COPY it
to your computer's clipboard.
4) Open NOTEPAD and create a new (empty) text file (.txt).
Example: eventti.txt
Warning: Do not use a word processor that word-wraps lines!
5) PASTE the BASIC code into the text file and then SAVE the file into the
same folder or directory where your BASIC interpreter program
(GWBASIC.exe or BASICA.exe) resides.
6) Carefully look over the program code and make sure that each numbered
line is on one line. If a numbered line occupies two lines, then
edit it so that all of the code is on one line.
7) RENAME the file with a .bas extension. The file name can be up to 8
characters long (that's because of DOS's archaic file-naming limitations!).
The .bas extension is the important part. Example: You should change
eventti.txt to eventti.bas
8) To RUN the program, you must first open a DOS window and then run the
BASIC interpreter. In the case of GWBASIC, open a DOS window and then
type: gwbasic.exe and press (ENTER).
(Or you can create a Windows shortcut to GWBASIC. Then all you have to
do is click on the GWBASIC icon).
9) After the GWBASIC interpreter program has started, type FILES and press
"ENTER". BASIC will then show you a list of your programs.
10) To RUN a program, type:
load "filename.bas"
and then press (enter). (include the " " marks around the program's name).
11) Then type: run
12) To exit BASIC and return to Windows, type: system
and press (enter). Some of my programs automatically do this.
13) To exit a BASIC program while it is running: While holding down the
CTRL key, press the PAUSE key. After the program stops, type: system
and press (enter).
You should now be back in the Windows environment.
14) TROUBLESHOOTING:
If you are using Qbasic and are having trouble getting the programs
to load and run, read how to easily
fix the problem.
If the program still does not run, it is probably because one or more
program lines have word-wrapped when you pasted the code into the text
editor (see steps #3, #4 and #5). Note: When the program is loaded
into GWBASIC.exe, any long lines will automatically word-wrap. This is
normal and okay. The problem is actually back in steps #3-#5. You must
go back and repeat the process and check the original .txt file. Now do
you understand why you must use NOTEPAD, instead of an advanced
word processor? ;-)
If you try to load the program and BASIC says that the program cannot
be found, make sure that your file resides in the same folder or
directory as your BASIC interpreter program (BASICA.exe, GWBASIC.exe or
QBASIC.exe). Also be sure that your program has a .bas extension. If
it doesn't, then rename it with the .bas extension.
In some cases, GWBASIC will show you the offending line of code when
you attempt to RUN the program. If so, simply make corrections to that
line and press (enter). The cursor must be placed on the line of
code when you press (enter). Then RUN the program again and see if that
solves the problem. If everything works, be sure to SAVE the program
to preserve the changes. To SAVE a program when running GWBASIC, type:
save "filename.bas"
and then press (enter)
GWBASIC/BASICA and Qbasic allow a maximum of only 8 characters in
the file's name.
Both QuickBasicTM (which is not the same as QBasic)
and the old Visual BasicTM for MSDOS can compile these
programs into a DOS executable (*.exe) code that doesn't need the BASIC
interpreter to run!
Unfortunately, all versions of Visual
BasicTM for Windows can not compile these programs into
an executable. (sorry).
HERE ARE THE BASIC PROGRAMS
(these programs will run on BASICA, GWBASIC, and Qbasic)
(be sure to rename the file exensions of the programs, below,
from .txt to .bas)
gr-circl.txt
This program computes great circle distances between any two points on the
earth if their latitudes and longitudes are known. It also calculates
the antipode for any location on Earth, and it can compute the Earth's
rotational velocity for any latitude.
appa-dip.txt
A structural geology program that calculates the "true dip" angle of a
rock bed if you know: 1) the "apparent dip" angle of the bed (as seen in
a highway road cut or outcrop); 2) the strike of the dipping bed; and 3)
the strike of the road cut on which the "apparent dip" angle is
observed.
eventti.txt
This program will record the date and time of any event or events whenever
a key is pressed. The program saves the events and their times to a
text file. It is useful for recording and tabulating events. It also makes
an "okay" stopwatch (accurate to one second).
g-calc.txt
Do you have a laboratory centrifuge and you want to know the 'g' for a given
RPM? Or do you want to play around with artificial 'gravity' experiments?
This nifty little calculator will calculate acceleration (and 'g') for
any given radius of rotation and rotation rate.
timer.txt
This is a simple timer/alarm clock program. You can set the alarm for
weeks or months in advance (of course, your computer must be running
continuously (duh)). The timer/alarm is accurate to one second. The alarm
now includes DB-9 serial port (on COM 2) output as an option! (in order
to utilize the serial port output option, your computer must have a serial
port, or if you have a PC with the newer USB bus, then you will need to buy
a USB card that emulates the old serial port).
point-co.txt
This geology program uses the computer's keyboard as a tabulating device
for point counting sedimentary rocks in thin section (each key is programed
to represent a specific mineral). The program also gives ternary percentage
summaries and other statistics, and it saves the results to a
text file. With a little tweaking, it could be adapted for point counting
volcanic rocks in thin section. Very useful!
prime-no.txt
A neat little program that uses a simple "brute force" algorithm to determine
if an input number is a prime number. Really simple code. Can you
improve it?
x-ray.txt
This X-ray diffraction (geology) program will convert d-spacing (in
angstroms) into 2-theta (in degrees) or from 2-theta into d-spacing.
antipode.txt
This program will calculate the antipode for any point on the Earth. (The
antipode is on the opposite side of the Earth from the input point. A
straight line drawn through the center of the earth would connect the two
points).
bivariat.txt
This program computes simple statistics (mean, standard deviation, and a
correlation coefficient, and it computes a linear regression equation)
for a bunch of X and Y data. The program saves these data and results to
a text file.
h2o-pres.txt
This program computes ocean (salt water) pressure, in pounds per square
inch, at any chosen depth.
sierpins.txt
Sierpinski's Triangle. This program demonstrates how some chaotic systems
(such as a throw of a gaming die) can show structure when their effects
are graphically plotted (graphical representations of chaotic systems,
showing strucuture, are often called "attractors"). Sierpinski's Triangle,
first described around 1900, is also a good example of a fractal.
A useful demo program for math classes, statistics classes, and introduction
to chaos theory.
tern-plt.txt
This geology program takes percentage results from point counts and plots
them on a ternary graph.
tern-ran.txt
This is a program that plots randomly-generated trivariate data onto a
ternary diagram. It is an example of a Monte-Carlo simulation. What I
find interesting is that, with less than a few thousand plotted data points,
the graph shows a clear structure (possibly an attractor??), but if
millions of points are plotted, the graph will completely fill, indicating
that the algorithm is indeed generating random numbers. I am at a loss
as to what is going on. Do you have an explaination?
wave-en.txt
This program converts a given electromagnetic wavelength into its
corresponding energy (in eV) or a given energy into its
corresponding electromagnetic wavelength.