Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Interrogate your Prophet 600 with MIDI

Interrogate your Prophet synthesiser with this unique program that lets you display the patch settings on screen!

The object of this article is to describe a practical example of some MIDI software. MIDI, which stands for Musical Instrument Digital Interface, is a communication system allowing synthesisers to be connected to each other or to a computer. For further details see 'Introducing The MIDI' E&MM May '83.

The program shown allows a Sinclair Spectrum, when connected to a Prophet 600 (via the MicroMIDI), to request and receive preset information for any program in the synthesiser and display on the screen, in a readable format, all control settings and switch conditions.

Although the version shown has been written for the Prophet 600, the methods used could be transferred to suit any MIDI-equipped keyboard, provided that the required information has been supplied.

MIDI Information

Information can be transmitted in one of five categories. These categories are: Channel — key information, control changes and program select; System Exclusive — data which relates to only one manufacturers equipment; System Real Time — synchronising codes for real-time control; System Common — information relating to all channels in the system and System Reset — an initialisation command.

The program described here uses the second category, System Exclusive. Sequential Circuits use this format to dump and load program or preset data and, since this can only apply between machines of the same type, is ignored by any other equipment.

MIDI Interrogation

First stage in the program is to tell the Prophet to stop what it is doing and supply a program dump. To do this data must be sent from the Spectrum in the following format.

1) F0H — status — System Exclusive data follows.
2) 01H — data — manufacturers ID (SCI).
3) 00H — data — program dump request.
4) XXH — data — program number.
5) F7H — status — end of System Exclusive data.

Figure 1. Machine code routines for the Mididump program.
(Click image for higher resolution version)

Machine code routines are shown in Figure 1. To output the required bytes we must go to location 32114 which is labelled OUT. First register C is loaded with 191, which is the IO location of the MicroMIDI transmit register (see May '83 P.85) and HL is loaded with PROG, the address of a location containing the program number which has to be dumped. Register B is then loaded with the first byte to be transmitted, ie 240 (F0H — System Exclusive data follows) and the transmit subroutine, labelled TX, called. This subroutine examines the transmit register status and checks to make sure it is empty before loading the byte in B. After the call B is loaded with 1 (manufacturers ID), transmitted by TX, loaded with 0 (program dump request) transmitted by TX, loaded with the number in PROG, transmitted by TX, loaded with 247 (F7H — end of System Exclusive data) and finally transmitted by TX.

On receiving this request the Prophet will transmit a program dump in the following format.

1) F0H — status — System Exclusive data following.
2) 01H — data — manufacturers ID (SCI).
3) 02H — data — program dump follows.
4) XXH — data — program number.
5) 0XH — 32 bytes of data — program information transmitted in 4 bit nibbles.
6) F7H — status — end of System Exclusive data.

Our machine code program is currently at IN where it loads register HL with the address of DUMP. This is the first location of a table 17 bytes long which will hold the program number and 16 bytes of program data in the format shown in Figure 2.

Figure 2. Details of the program dump for the Prophet 600.

The receive subroutine RX is then called in readiness for the first byte from the Prophet. Subroutine RX first jumps to another routine, this time in the Sinclair ROM, which checks if the Break key is pressed and clears the carry flag if it is. This provides an escape from the receive routine should there be a problem in the interface. Next, the receive register status is checked to see if a byte has been received. When it has, the byte is loaded into the accumulator. On returning to the IN routine the carry flag is checked again to see if it is a return from a Break in which case a jump is made straight back to the Basic monitor.

Otherwise, the byte in the accumulator is checked, using the compare instruction, to see if it is 240 and a return to IN if not. If the first byte is 240, RX is called again and the next byte checked to see if it is 1. If it is 1, RX is called and the next byte checked to see if it is 2. If any of the compares are false then the routine starts again. The next byte received is then loaded into the location pointed at by DUMP, HL incremented and LOOP entered.

A check is made for 247 (End of System Exclusive) which provides an exit from the Loop. Otherwise, register C is loaded with the byte received in A and the following byte received shifted four bits to the left then added to the value in C. This converts two consecutive four bit nibbles into one byte. The byte is loaded into the location pointed to by HL and HL incremented. Looping continues until 247 is received and a jump made to SORT.

We now have 16 bytes of program data transferred into the Spectrum's memory. In the synthesiser the data is stored in this compressed form to save memory since some of the parameters are only 1 bit long. However, to allow the information to be displayed by a simple basic program it must be expanded to 37 bytes, 22 representing control settings and 15 representing switch settings (see Figure 2).

Shift and Sort

Labels PLEN and DATA point to two tables, one holds the Parameter LENths and the other the final sorted DATA. Note that both labels are pointing at the bottom of their respective tables since data will be shifted from right to left and bottom to top starting at the bottom of the DUMP table.

Register B is loaded with the number of parameters, DE with the address of PLEN and HL with DATA. The value of B is then pushed onto the stack and B reloaded with the first length. FILL is the routine which will shift data one bit at a time from DUMP into DATA the number of times required by PLEN. First SHIFT is called, this pushes the values of B and HL onto the stack, loads B with 16 (number of bytes in DUMP) and loads HL with the first byte. The whole 16 byte block is then shifted one bit to the left by rotating each byte in turn through the carry flag. After the 16 shifts HL and B are retrieved from the stack. This leaves the most significant bit of the highest byte in the carry flag. On return to FILL it is rotated into the location pointed to by HL. B (value of PLEN) is then decremented and SHIFT called again if non-zero. If zero, B (number of parameters) is pulled off the stack, DE decremented (address of next parameter length up), HL decremented (address of next data location up) and B checked to see if it is zero. This will continue until the values in DUMP have all been shifted and sorted into DATA.

Typical preset display.

BASIC display

Figure 3. Basic program for the Mididump.
(Click image for higher resolution version)

The Basic program used to display the values is shown in Figure 3.

Line 10 moves RAMTOP to 31999 while 12 and 14 initialise the MicroMIDI board.

The machine code routine is then read in by line 20 assuming it was saved using SAVE 'midicode' CODE 32000, 250.

When loaded a preset number is requested and poked into location 32000 (which is read by the MC as PROG). Line 60 calls the machine code program at OUT.

On return the labels for the controls and switches are printed by lines 100-300.

The loop to read the 22 control parameters starts at line 440 by assigning a variable valp, to the values in bytes 32055-32076 (the first 22 locations in the DATA table). Three variables are then read in from the Data statement in line 500. These are: Len, the length of each parameter - x the display line and y the display column. Since the parameter data is not in the order required by the display a position on the screen must be assigned to each value. Also, several of the parameters have different numbers of bits, therefore rather than print a value between 0 to 127 for a 7 bit parameter or 0 to 16 for a 4 bit parameter, the values are 'normalised' by line 470 to give a value between 0 and 10.

Line 480 clears the location and prints the normalised value of the parameter at x,y. This continues until all of the control values have been printed.

A second loop is entered at line 700 which prints out the other 15 bytes of the DATA table representing the switch positions. These are normally 0 for OFF and 1 for ON but for the Filter KBD switch they are OFF, HALF and FULL and for LFO waveshape SQUARE and TRIANGLE. Line 820 resets the READ statements. Before another preset can be read the DATA table must be cleared to prevent the information contained being shifted further and therefore, create false values. This is accomplished by lines 900-920.

Four statements at the end of the program allow one of three options to be input. The preset display can be printed — if a printer is connected, a new preset selection made or an exit to basic.

In conclusion, this program should prove a useful insight into the power of the MIDI buss.

MicroMIDI board modification.

MicroMIDI modification

Our prototype MicroMIDI board was powered from a 16K Spectrum which could supply the current required. However, in a 48K extra memory loads the internal regulator to capacity. Therefore, when used with a 48K the board should have its own regulator fitted. The modification can be seen in the photo.

Drill a 1mm hole in line with the edge connector, beyond the earth track, which will accept the third pin of a 7805 regulator. Next, remove the track from the positive side of C2 and link the input pin to the +9V pad, which is first right of +5V. C2 can then be soldered directly to the pins of the 7805 to smooth and decouple the output.

A cassette tape of the MIDIDUMP for use with the Prophet 600/Spectrum is available from E&MM, (Contact Details). The tape costs £9.95 including VAT and P&P. Please order as: MIDIDUMP Datatape. The MicroMIDI PCB is also available at £4.25 including VAT and P&P. Please order as: MicroMIDI PCB.

More from these topics

Browse by Topic:



Also featuring gear in this article

Previous Article in this issue

Advanced Music Synthesis

Next article in this issue

Yamaha SG200

Electronics & Music Maker - Copyright: Music Maker Publications (UK), Future Publishing.


Electronics & Music Maker - Aug 1983

Feature by Kenneth McAlpine

Previous article in this issue:

> Advanced Music Synthesis

Next article in this issue:

> Yamaha SG200

Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for August 2022
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £136.00

All donations and support are gratefully appreciated - thank you.

Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!

Small Print

Terms of usePrivacy