Player ZX81
A Tune-Playing Program For The Sinclair/Timex
Arthur B. Hunkins,
School of Music,
University of North Carolina,
Greensboro
Player ZX81 is a 1K tuneplaying program available in versions for all Sinclair/Timexes (including 4K ROM). Although each cassette is specific to a single version, the six pages of instructions cover them all. For anyone interested in coding tunes into the Sinclair and playing them back — over and over again if you wish — the $6.95 spent on this program is a bargain.
This is especially true considering the fact that you also get 81 Space Muse-AK, a program that randomly generates and plays 127 pitches and rhythms, generates another set, etc. In short, it's guaranteed to drive you and your neighbors batty — a kind of mindless musical autopilot.
The procedure in Player ZX81 is to code a duration number (all durations are relative) and pitch value (from the handy pitch table) for each note. You can have, even on a 1K machine, up to 127 notes. The limitations are these: 1) The single tone color available is a square wave; 2) Only pitches from the B above middle C on up are available (i.e., high pitches); 3) You can't easily do rests, but I'll describe a fix for this presently.
The external hardware required is a high-gain amplifier/speaker. A Radio Shack mini- or telephone amplifier/speaker at $10-$12 will do the job nicely. Or you can use a regular hi-fi amplifier, connecting to its phono input.
Versatile Modifications
Several program modifications lend further versatility.
All modifications start with two steps: 1) Omit the recommended protecting of high memory while making the modification; and 2) Immediately after loading, POKE 16544,28 and POKE 16600,28 — this renders the BASIC code accessible.
One thing you may want to do is to relocate the note table — according to how much memory you have and what you may want to add to the program. First, POKE 16549 with the same value you'll POKE into 16389, namely the page number for the beginning of the table. The lowest possible number is 67, the top page of 1K. Each additional K of memory is four pages; for example, the top page of a 2K Timex is 71. Whatever starting page you choose, change the memory location in statements 105 and 120 to 256*page number, and to this value + 1 in line 117.
If you want a single play, instead of infinite repeat, delete statement 150. Or insert a PAUSE statement, a do-nothing FOR/NEXT loop, between 140 and 150 in order to space the repeats. Or again, use a statement 145 IF INKEY$ = " " THEN GOTO 145, to wait until you press a key.
If you have more than 1K memory, you may wish to use it to code longer songs. What you have to change here is line 95. The principle is this: a page of memory holds 127 notes; two pages hold 255. Subtract one from these numbers, and multiply by two to get the loop value to plug in line 95. Given available memory, there is no limit to the number of notes you may specify.
I mentioned the problem of rests. Here we have to modify the machine language routine itself, by changing statement 10 (in the process you can lop off the final zero in the statement, if you like). Be sure to follow these instructions precisely; any mistakes or omissions will cause a system crash. The idea is to reserve the frequency value of 255 as a flag for the rest specified as the duration value. In other words, every time a frequency of 255 is specified, you get a rest instead.
Bring statement 10 down to the bottom of the screen for editing. Locate the < = character. Add the following sequence of three characters immediately before < =: a lower left quarter square graphic, a C, and an upper right quarter square graphic. (Graphics characters are shifted, and must be preceded and followed by pressing the graphics key.) Then, after the RETURN that follows < =, insert a left half square graphic. In addition, change the following three characters: LOAD to FOR, DIM to FAST, and the last PEEK to INT.
INT is a function, and is prepared by pressing the function key. FOR and FAST are keywords, and are registered by pressing THEN, the keyword, and finally deleting THEN. Double check the code, and SAVE the program before RUNning it. If all is well, a frequency of 255 should now produce a (clickless) rest!
Finally, I recommend substituting the following list of "Pitch Nos." for those given by the author. Note that names duplicate Mr. Maples', but add two pitches on the top end: 250, 235, 222, 210, 198, 186, 176, 166, 157, 148, 139, 131, 124, 117, 110, 104,, 98, 93 or 92, 87, 82, 77, 73, 69, 65, 61 (B2), and 58 (C3). These values have been checked with a frequency counter.
Player ZX81 is a most useful program; the above modifications can make it even more so. Anyone interested in a "voice" for the Sinclair/Timex will find this a real value.
Player ZX81
Wm. Maples
688 Moore St.
Lakewood, CO 80215
$6.95