Click Here To Go To The Your Computer Archive



Written By Fintan Culwin


Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Interrupt Music

In this, the first part of his article, Fintan Culwin details a BBC editor with a simple background music facility

This started off as a seemingly simple editor. What I wanted was a means of preparing a data file which could be used by an assembler program to produce an interrupt-driven tune. Once the code produced by the assembler had been installed, the tune would repeat itself until it was deactivated or the Break key pressed.

The problem with preparing a musical data file is that there needs to be a method of specifying the pitch and duration of the notes. Standard musical notation turned out to be the most sensible system to produce the file. Although this editor is based upon musical notation it is not presented as a music processor. It has a limited range of notes and, in particular, no capacity for a rest. It is, however, capable of producing simple tunes for accompanying games etc.

To make full use of the BBC's sound capacity it is not only necessary to manipulate the SOUND command but also the ENVELOPE command. Consequently, an envelope editor has been added to the system. Provision for a screen dump was included to allow the editor to produce sheet script.

What started out as a supposedly simple editor to produce a small data file became a fairly sophisticated project in its own right. The editor can cope with up to 200 notes over a one and a half octave range. The envelope can be modified over its full range, and will be saved with any data file produced.

Piano Type Envelope

To use the system, enter listing 1, Intload and listing 2, Inttune. Running Intload will define the characters needed for the main program and produce a default piano type envelope. The characters are printed as a check and the second program loaded. For disc users the name of the second program will have to be defined for tape users a blank CHAIN"" statement will load the next program on the tape.

When loaded the editor presents the user with a blank page. To define a note its pitch and duration have to be selected. The pitch of the note is controlled by the cursor's position on the stave. The cursor can be moved up and down the stave using the up and down arrow keys. The left and right arrow keys move the cursor backwards and forwards through the tune.

The duration of the note is indicated by the symbol in the lower right hand corner. The duration can be increased with the f0 key and decreased with the f1 key. A note is entered at the current cursor position by pressing Return. If the cursor is in the middle of a tune all succeeding notes will be shifted along to make space for the note being inserted.

It a note needs to be deleted, pressing the Delete key will remove the note from underneath the current cursor position and move back any succeeding notes. There is space on a page for 20 notes. Moving before or beyond this automatically takes you onto the next page. If this is too pedestrian then keys f4 and f6 will move backward and forward one page at a time. Pressing f2 will play all the current tnes using the current envelope.

After coming to terms with the musical setting, the envelope editor can be invoked by pressing the f7 key. To understand the screen it is necessary to consult the User Guide. Page 245 identifies the effects of the 13 parameters and labels them. These labels are reproduced on the screen, alongside the current value of the parameter. The currently selected parameter is highlighted in inverse video.

A table of 13 numbers is almost impossible to comprehend. Above the table the settings of the parameters are indicated by 12 bar-graphs split into four clusters. They are grouped as the PI parameters, the PN parameters, the AA, AS and AR parameters and the ALA and ALD parameters. A description of the effects of changing these parameters is given in the User Guide.

A practical appreciation can be obtained by experimentation. A parameter to be changed is highlighted using the left and right arrow keys. The value is changed within its limits using the up and down arrow keys. Pressing the Return key will sound the envelope; when you are satisfied, pressing the Escape key will return to the music editor. The current envelope specification will be saved and recalled with any tune.

Pressing f8 causes a printer dump to be performed. In the configuration given page 10 of memory - &A00 to &AFF - is assumed to be available for use. This is acceptable for disc users, tape users will have to use page 14 - &D00 to &DFF. Examining listing 2 shows a dummy RTS code has been inserted.

If you want to use this facility then the Remmed *LOAD command will have to be activated to load into memory your own screen dump code; and the dummy RTS command removed. This can be omitted if screen dumps are not required. When you are ready to leave, the system f9 will cause an orderly return to Basic.

The basis of the editor is a list of note codes held in memory. Each note requires two bytes to define its duration and pitch. These are held in memory in the reserved byte array labelled tune%, defined and initialised within PROCprepare. The only obscure parts of the preparation are the definition of an OSWORD area which will be used to obtain character definitions for the double height plotting routine.

Retrieved From Memory

There is no legitimate method to obtain an envelope definition within the Operating System. Consequently the envelope parameters have to be retrieved from memory into the envelope% array using Peeks.

The first part of the main listing, as far as PROCMAIN contains various procedures concerned with screen operations. The most transportable procedure is PROCbigchar, whose parameter identifies a character to be plotted on a screen in double height. Using this procedure mollifies the effect of being forced to work in 20 column mode.

The procedure works by obtaining a character definition with an OSWORD call. The definition obtained is used to redefine character 254 twice using the VDU 23 command; and sent to the screen.

The main routine is fairly straightforward; the keypresses are trapped and used to select a routine from the second part of the program.

When loading a tune from disc or tape there is an option to load from the start of memory overwriting the tune in memory or appended to the end of the tune in memory. The envelope editor PROCenvel and associated procedures are extractable and can be used alone to investigate the ENVELOPE command.

As the program is reasonably structured, the routines are well Remmed and the variable names are sensibly chosen implementation should be fairly easy. I have not tested it but it should transfer directly to the Electron.

As mentioned at the beginning this was conceived as a simple editor that would be used to produce a file for an assembler program. The editor has grown into a more sophisticated system than I envisaged; but it still performs its intended function.

Keep hold of your data files, next month's program will use them as input to a system which will install the tunes into the micro. Consequently, the tune will repeat itself indefinitely until switched off or the machine is reset. This has obvious if rather tedious applications.