MIDI IN via the Music 2000

R J Bettis
Some time ago (AMPLINEX issues 006 and 007) a couple of articles by Scott Mackie described the construction and use of a MIDI interface for the BBC running AMPLE.
This article describes a modified version of that interface, which I have adapted to work with the Music 2000. It also works with my master keyboard (a Cheetah) which uses the MIDI 'running status' system in its data output.

1) History

Shortly after the interface articles appeared I acquired a Music 2000 interface, and since then my MIDI system has grown, while the Music 500(0) has lost out as a sound source. This is mainly because of the increased expression available from a touch-sensitive keyboard (and the sound quality of relatively cheap MIDI units).
Some of the Music 5000 facilities, such as a wide range of readily programmable sounds have been tempting me back every now and then, and eventually I decided to try and incorporate the Music 5000 as a MIDI expander (as opposed to using the Music 2000 as its controller).
I remembered Scott's articles, dug out the discs, and examined the software. There were three programs, a main AMPLE control program, a machine code program to run the interface, and a BASIC source program for the machine code.
I then made the modifications needed to run the program with my system - these were almost all in the machine code.

2) Technical details

The original hardware and software used the (rather drastic) NMI interrupt, whereas the Music 2000 uses the normal interrupt system. Hence the program had to be altered to (a) use this interrupt, (b) set itself up in the interrupt chain and (c) avoid acting upon or corrupting other interrupts using the same system.
The result was that I replaced the whole of the original interrupt handler with a new section of code. This then made the program too long for its original location (page &900) so I had to expand downwards to start at &8D0. This area is used by the operation system for sound envelopes 2-4, so seemed fair game in an AMPLE environment.
The second problem I discovered was that my keyboard uses 'running status'. A typical MIDI message consists of a command byte followed by (usually two) data bytes; however, the specification allows for just the two data bytes to be sent if the command hasn't changed.
For example, a 'note on' message might be three bytes:
<note on> <note number> <velocity>
but with running status a three note chord could be sent as:
<note on> <note 1> <velocity 1>
          <note 2) <velocity 2>
          <note 3> <velocity 3>
saving a couple of bytes in transmission.
This means that the receiver now has to keep a note of the last command so that this can be employed.
The BASIC program for the new code is in file U.MXbasic, and the code this produces is called U.MXcode.

3) In AMPLE

The AMPLE program ('U.MXample') is largely the same as Scott Mackie's original (on the principle of 'if it works, don't mess with it'). It has a quite comprehensive 'help' facility written into it.
Calls to the code have been altered to reflect the new locations, and two new commands have been added:
'go'  gives a list of all available instruments and ask for a choice
      to be made before using MIDI
'ins' sets up to use an instrument 'inst', so that new sounds can be
      tried easily (alter 'inst', MAKE and run 'ins')

Related files on this disc:
U.MXbasic - Basic program to produce U.MXcode
U.MXample - AMPLE program to enable use of Music 5000 as MIDI expander

Published in AMPLINEX 019, September 1990