EXERCISE PACER
--------------
A copy of this file (README.TXT) is bundled with the main program zip download.
INTRODUCTION
------------
The purpose of this program is to provide an audible prompt for exercising. This might be for cycling at a particular rpm, rowing at a certain cadence, or doing other types of exercise that require timed intervals.
This small program is written in 16-bit Turbo Pascal for DOS. The reason for this is that I began work on it about 30 years ago when there was nothing quite like it available in the public domain — indeed, nothing quite like it at all, so far as I could discover. No doubt today that situation has changed, and the program has become in many respects obsolete. But it still does what I want; I still use it. I have refined it, on and off, over a long period of time. It would not be an exaggeration to say that I learned computer programming in order to write it. But producing something more modern would require me to learn a whole new set of skills, the prospect of which no longer excites me.
If you have an old PC in a cupboard somewhere (even a 286) that will boot from a floppy drive, you can run this program on it. It's tiny. You don't need a hard drive. Failing that, format a bootable USB stick with FreeDos (using something like Rufus) and run it as a stand-alone from there. It also runs fine in DosBox on Linux.
If you start the program without a command file present (see below for more on command files) it will run for 99 minutes on default settings, a bit like a metronome. You can start/pause by hitting SPACEBAR and change the frequency of the beep with < and >. That's about it, and might be all you need — in which case stop reading now!
COMMAND FILES
-------------
The default command file is a plain text file called "CMD.TXT". This should be created or edited with a DOS editor like FreeDos Edit. (See Program Errors below.)
If CMD.TXT is present in the same folder as PCR.EXE there is no need to specify a named file on the command line. To keep things simple just use CMD.TXT and FreeDos Edit.
The example CMD.TXT file (supplied as CMDMODEL.TXT) is also a cryptic guide to running PCR.
Lines starting with # are ignored comment lines.
Each instruction to the program is in the form of a command pair: that is two adjacent lines.
Line 1 should be a crpytic message/reminder consisting of any text (except for a few reserved characters, which cannot be the first character; see LIMITATIONS). E.g., "Cycling for 15 minutes at 70 rpm"
Line 2 is a sequence of five numeric instructions separated by spaces. Eg., "3 300 70 0 0"
Put them together (do not use quotes in actual command files) and you get
Cycling for 15m at 70rpm
3 300 70 0 0
So, how do those five numeric instructions work? You can read the above as "3 time-units of 300 seconds (3 x 5 mins = 15mins in total); at a cadence of 70 rpm; no change to cadence; use default maximum cadence. Those last two are there because the program always has to read off five instructions, even if only three of them really do anything.
A rowing example might be
Rowing 21mins start at 23 pulls/min increasing by 1 every 3 mins until reach 28 pulls/min
7 180 23 1 28
(That message line, btw, is far too long to display properly! so don't use it for real.)
The instruction line reads "7 time-units of 180 seconds (7 x 3 mins = 21mins in total); starting at 23 pulls/min; increasing by 1 every 3 mins; but maxing out at 28 pulls/min." So the final 6 mins are done at 28 pulls/min.
The golden rule is: DO NOT SEPARATE A COMMAND PAIR. So be careful not to interpose comment lines or refrains between command pairs.
LIMITATIONS
-----------
The longest possible time unit (the second of the five instructions) is 327 seconds (5 mins 27 secs). This comes about because a signed 16 bit integer cannot exceed 32767 — and the clock, though it doesn't show on the screen, is counting in milliseconds. However, if required you can set 255 of these (the first of the five instructions, which rarely in my experience ever goes much above 20) which should make time for anything; besides ...
The clock only shows minutes and seconds, not hours, so will flip back to zero at 100 minutes.
Message lines cannot be blank. Always put something for a message line, if only a dot — or a colon which can usefully be combined with a refrain (see below).
Message lines (including any added refrain) are limited to 40 characters. Anything longer and the line will be cut off and only the first 40 characters displayed. So keep refrain and message content short and cryptic.
I have tested PCR.EXE against a stopwatch on numerous (mainly older) computers, including a Lenovo X200 laptop, and have been satisfied with its accuracy. I once had a 286 (which was not very old at the time) that ran fast; this was a fault with the 286. In the event the program does not run to time on a given machine I'm afraid there is no provision for adjustment. You could maybe tweak the time units by tenths of a second (see /T switch below and in CMDmodel.TXT).
Unless you run in DosBox, you cannot adjust the beep volume. This is because the program was originally designed to work with the PC speaker, which has a fixed volume. Alternatively you can change the duration of the beep (see switches in CMDmodel.TXT) which has the effect of reducing the volume.
Some types of routines are fiddly to program. Let's say you want to do 40 sit ups in batches of ten, to a cadence of 26. You need 20 beeps for your first 10. This is not as straight-forward as the two examples above.
20/26 * 60 = 46.15 so let's try. (I've added a 3 sec count down.)
count down 3s
1 3 60 0 0
sit ups x 10
1 47 26 0 0
The only way to fine-tune these is by trial and error. I've allowed 47 seconds, but 46 or 45 might be better.
LOOPS
-----
To get the above to repeat 4 times, add the following.
@4
count down 3s
1 3 60 0 0
sit ups x 10
1 47 26 0 0
* end of loop
The loop ends when it encounters '*'.
Loops may be nested one level, but not more. So an outer loop can contain an inner loop or a series of inner loops.
Loops may include comment lines or refrains, provided they do not separate a command pair.
REFRAINS
--------
If you start a new line beginning with $, any text you type after is added to all subsequent message lines. You can put a refrain line anywhere in a command file except between a command pair.
You can change the "refrain" by inserting a new $ line of text or turn it off by putting a solitary $.
The idea is to make command files shorter and neater, and offer a kind of running commentary as the program executes without having to repetitively insert lots of reminder messages.
NON-DEFAULT COMMAND FILES
-------------------------
Anything other than CMD.TXT, you need to give it as the first parameter without a switch. Like this
PCR.EXE CMD2.TXT
So long as any command-file name is first, other switched parameters (see below) can follow in any order. Like this: "PCR.EXE CMD2.TXT /T" . Or just "PCR.EXE /T" if the command file in use is CMD.TXT.
OTHER FEATURES AND COMMAND-LINE SWITCHES
----------------------------------------
Study the supplied CMDmodel.TXT to see examples of loops, refrains, etc. Rename CMDmodel.txt to CMD.TXT to have the program automatically use it.
You can skip to the next command pair by hitting 0 (numeric zero). Useful when testing.
F1 puts a cryptic help line on screen. Try out the keys listed to discover 'useful' features.
CMDmodel.TXT contains an aide-mémoire for settings and lists available command-line switches with a brief description.
Note the /T and /C switches, which allow time units and cadence respectively to be expressed in tenths.
These are written on the instruction line in the normal way, except you must add an extra digit. There is no decimal dot when writing these, so 60 secs is given as 600; 2 mins 1.4 secs would be 1214. (Note only whole seconds, rounded up or down, are displayed.)
If using /C a cadence of 72.3 beeps/min would be written as 723, and the last two instructions (which are cadence adjust and maximum cadence), if not 0, must be written the same way, so 1 becomes 10 and 120 becomes 1200.
Switch /U retains the clock time when it jumps to the next command pair in a given command file. This allows you to see the cumulative time with, for eg, a rowing routine, but may cause undesirable outcomes. See Example 2 in the next section.
BATCH FILES and/or NESTED LOOP ROUTINES
---------------------------------------
By calling a batch file at the end of AUTOEXEC.BAT (or FDAUTO.BAT in FreeDos), you can automate the boot process straight into a chosen routine.
Example 1
Let's say you've devised a 10-station circuit, fine-tuned the timings for the various exercises, and included a number of loops. Your CMD.TXT details one lap of this circuit, but you want to repeat the circuit three times.
The required effect can be achieved with a short FreeDos batch file. The following will run PCR three times using the default CMD.TXT.
@ECHO OFF
FOR %%A IN (1 2 3) DO PCR.EXE /X
As of version 86 the same effect can be achieved with a single command-file using a series of nested loops. This feature is experimental. A single nested loop can be written in accordance with the usual rules. A series of nested loops requires a minor workaround. See bundled file LOOP.TXT for an outline example.
Example 2
Let's say you wanted to do a rowing warm-up and see the cumulative time, but then continue with combined cycle intervals and rowing "rests"; this continuation would not work well with the /U switch set.
You might achieve this with three invocations of pcr.exe using a batch file like the following. The REM lines suggest the possible contents of the associated command file.
@ECHO OFF
REM a short silent delay to accommodate fast boot time of a modern machine, exit on completion
PCR.EXE CMD0.TXT /X
REM rowing warm-up, show cumulative time, exit on completion
PCR.EXE CMD1.TXT /U /X
REM the remaining routine set in a loop (nothing to do with a batch file loop).
PCR.EXE CMD2.TXT
PROGRAM ERRORS
--------------
Turbo Pascal programs expect text-file line-endings to be terminated in a particular fashion, so command files created entirely with a Linux editor, for example, may not run correctly. Minimal re-editing with FreeDos Edit seems to correct the problem.
If PCR.EXE does not run okay on its defaults without a command file, then something about your installation or operating system is not suiting it. I have been successful using a dedicated FreeDos partition, also DosBox in Linux, and various bootable media.
Command files larger than 16K or loop-structures with more than 800 command pairs exceed design capacity.
There is limited error trapping of the two most common errors made when writing command files. If the program freezes reporting 'runtime error 106', this is Turbo Pascal's built-in error trapping catching a file-read error. (And will likely force a hard reset.) You may be able to step through the commands (by repeatedly pressing numeric zero) and note the point of the crash.
CHANGES FROM VERSION 76
-----------------------
Command-line switches /N and /M are removed.
In command files (i.e., cmd.txt, etc) lines beginning '~' are no longer comment-lines (use '#'). Loops no longer conclude with '#' (use '*').