MUSIprint

Developer(s): Eric Boisvert
Date: 1988
Type: Program
Platform(s): TS 2068
Tags: Music

This music utility will allow you to play music using the LPRINT (PRINT #3) command. Once it is switched on with LET L=USR and its address, a line such as LPRINT "t10 o3 -c1 b+1 +a-2 p3" is played as music instead of being printed. t sets the tempo (0 fast to 50 slow), o the octave (0 to 6), a - or + in front of a note drops or raises it an octave, a - or + after it makes it flat or sharp, p is a rest, and the number after a note or rest is its length (1 to 16). Entries are separated by spaces.

MUSIprint was written by Eric Boisvert and published, not copy-protected, on the February 1988 tape (Issue 9) of Byte Power. The magazine says it works on both the TS2068 and the Spectrum. The tape holds a BASIC “customizer” and the 540-byte machine code; MUSIC Demo on the same tape plays five tunes with it.

Program Analysis

The Customizer

The BASIC program (auto-runs at line 1) sets CLEAR 30000, asks for the address to load the code at (default 64828), loads the MUSIprint code block there and relocates it. It then offers a menu: A switches the utility on and plays a test scale through every octave, B saves the relocated code under a name you choose, with an optional VERIFY, and C stops. After saving, the screen gives the LET L=USR call to use in your own programs.

Relocation

Lines 1110–1200 patch 16 two-byte addresses inside the code. Each DATA pair is an offset into the code and the value to store there; values smaller than the load address are taken as offsets and have the load address added. Several pairs give the target as the letter A, which READ evaluates as the current value of the variable A, so the previous target is reused without being written out again.

Notable Techniques

  • Music commands are sent through the printer stream (LPRINT or PRINT #3), so a tune is just a string
  • A relocation table in DATA lets the code run at any address the user picks
  • DATA items written as the variable name A repeat the last value read
  • Line 9999 saves both the customizer and the code at the chosen address

Potential Issues

  • The address you type is not checked. The program has already done CLEAR 30000, so an address below that, or one above 64996 (where 540 bytes would run past 65535), will not work.

Appears On

Tape-based magazine. The February 1988 issue (Issue 9) of Byte Power, the TS2068 tape magazine of Eric and Kristian Boisvert.

Related Products

Related Articles

This music utility will allow you to play music using the LPRINT (PRINT #3) command.

Related Content

Image Gallery

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.