Magazine Archive

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

BeeBMIDI (Part 3)

Software listings that enable owners of our BBC Micro MIDI interface board to view the internal workings of the Yamaha DX7 on screen, with a cassette available from E&MM for the finger-sore.

Last month's article was intended to set readers building our interface unit for the BBC Micro on the path to writing some software of their own for MIDI. This month Jay Chapman provides a full listing of a comprehensive voice dump program, written in BBC BASIC and 6502 Assembler, for the Yamaha DX7.

Even if you don't have the necessary DX7-BeeBMIDI interface-BBC Micro combination, you should still find that there is something in this article for you. In particular, analysing the programming techniques used to convert the MIDI data from numbers into something readable - for example, the keyboard note numbers into the note name and octave - should be of interest. DX owners will be pleased to find a routine for converting the Fixed Frequency Coarse and Fine parameters into a meaningful frequency value, which is a problem all the other dumps I've seen have ignored! Last but by no means least, the dreaded checksum byte is dealt with. I feel this is much called-for since the checksum idea seems to have foxed quite a few people.

Using the Program

Having typed both the BBC BASIC programs in (cooling your blistered fingertips in a bowl of ice) and checked them carefully, you should then run the 6502 Assembler Source program. Note that I always save such a program before running it, in case the machine code assembles on top of the residence source program (due to one of my fate-tempting typing errors). I strongly suggest you follow my example!

You have now assembled the four assembler routines into the part of RAM usually reserved for the User Defined Character Definitions - since we don't define any characters this area is free.

The point to bear in mind is that we are not in any way interfering with BASIC memory area, and BASIC won't interfere with the machine code either.

You must now save a copy of the assembled code which will be loaded in later by the main program. To do this type in: *SAVE MC CA3 CFF

The significance of the 'CA3' and 'CFF' will become apparent later. If you are working with tape rather than disk, you should do the *SAVE onto tape immediately following the save of the main program.

Next chain 'DX7DUMP' (or whatever name you saved the main program under) which will automatically load the machine code and present you with a menu asking you to make a choice. Have a look at lines 1080 to 1130 for the menu. As you can see, it's possible to receive or send a program to/from the DX7 or disk/tape as well as displaying the voice parameters on the screen or printing them out.

The printout format is intended to mimic that of the 'YAMAHA DX7 VOICE DATA LIST' forms, as shown in the DX7 manual and used by the DX Owners' Club. Analysis of voices is greatly aided by being able to see all the voice parameters at the same time (rather than one at a time as on the DX7 display) and a great deal of time transcribing voice parameters onto paper need no longer be wasted. The ability to save voices on disk effectively extends the number of 'on-line' program memories available in the same way as the Yamaha RAM packs, but is a lot cheaper if you already have a BBC Micro.

The program is more or less self-explanatory in use, but you may well find it worthwhile (re)reading page 22 of your DX7 manual ('Using MIDI') which should explain some of the prompts you get whilst sending to or receiving from the DX7.

It is unfortunate that there is no way of asking the DX7 to transmit data from MIDI. All transfers have to be initiated at the DX7 end, and because of this the Function parameters have not been dealt with as their transfer would be impracticable (unless you want to spend 10 minutes pushing keypads in sequence for each voice transfer!). Also, these parameters are voice-independent - unless you own a DX1 - and will generally not all apply anyway.

I sincerely hope Yamaha are updating the DX7 software to respond to transmission requests over MIDI - it really is an important feature and I for one am rather surprised to find it missing.

Figure 1.

Machine Code

The addresses of the routines below (which are called in the main program) were picked off the assembly listing and set up in line 1000 of the main program. You should also see from the assembly listing that the routines start at &CA3 and finish at &CFF - remember the *SAVE MC?

The rx_midi routine has been discussed in previous articles, so we'll move on. The dx7dmp routine listens on MIDI In and checks whether the streams of bytes it receives correspond to a DX7 voice data transmission on MIDI channel 1. Lines 1200 to 1320 of the Assembler Source program check for the sequence in Table 1. ('&' indicates a HEX number)

If you generally have your DX7 on a different channel, say number 4, then you should alter the check for the third byte (line 1280) to &03 - don't forget that MIDI thinks of external channels 1 to 16 as internal channels 0 to 15.

If the header sequence is OK, then the rest of the 162 bytes are received and stored (by lines 1330 to 1350) in the buffer area called (ie. addressed by) pg0, which is in the machine code RAM area before the actual code. The 162 bytes consist of the four header bytes above, followed by two bytes counting the number of data bytes in the message, followed by the 155 voice data bytes, followed by 1 checksum byte(!)

The dxsnd routine simply sends the current voice's 162 data bytes (ie. the data in pg0) back to the DX7.


This byte seems to be a source of anguish for an awful lot of would be MIDI programmers, but the chksum routine should solve all your problems. All you have to do is add up all the data bytes whilst happily ignoring an overflow. The checksum byte sent over by the DX7 was calculated in the same way and then negated before transmission, so when you add it in, your overall result should be zero if the data (and checksum) made it across OK. Note that since only seven checksum bits were sent across, your result need only be zero in its least significant seven bits - see line 1480, which chops off the unwanted bit.

Conversion Techniques

This is where you have to do some work!

The BBC BASIC functions in lines 2270 onwards of the main program are responsible for the conversion and formatting of MIDI data. The symbol 'par' is used to address the start of the 155 voice data bytes, and these bytes are 'peeked' as required. For example, the main formatting function, FNpg0, line 2290, simply 'peeks' the data byte asked for by the parameter pgn, passed into the function by doing 'par?pgn', and then ensures that the format is always exactly two characters long by using STR$ and RIGHTS.

You should find the methods employed in FNpitch using MID$ and MOD and the predefined strings notes$ and sharps$ particularly edifying, and have a good look also at FNfreq, for the secrets of fixed frequency parameter conversion. In case you're wondering where the magic number 1.023293 comes from, I can tell you it's not given in any of the DX7/MIDI documentation I've seen. It's actually the 99th root of 9.772 to exactly the right degree of accuracy - see if you can work out where it comes from.

(Click image for higher resolution version)

(Click image for higher resolution version)

(Click image for higher resolution version)

(Click image for higher resolution version)

Software on Cassette

For those readers unwilling - or unable - to spend long hours keying in the dump program, E&MM is offering this software on cassette, price £7.95. Send cheques/POs (payable to Music Maker Publications Ltd.) to EmmSoft, (Contact Details). Please allow 28 days for delivery.


DX7DUMP (E&MM August '84)

The *SAVE command for the machine code should have been as follows: *SAVE MC CA3 D00

You can thank an error in the Watford DFS manual for that one - but the rest of the DX7DUMP errors are all the author's (Chapman hangs his head in shame!). He's also set the keyboard links on his BBC Micro so that the beast boots up in screen MODE 3 - if you haven't, you might like to add the following line to DX7DUMP: 10 MODE 3 Finally, alter the lines below to read as shown below:


Read the next part in this series:
BeeBMIDI (Part 4)

Also featuring gear in this article

BBC Micro
(ES Feb 84)

BBC Reverb
(ES Feb 84)

BeeBMIDI (Part 1)
(EMM Jun 84)

BeeBMIDI (Part 2)
(EMM Jul 84)

BeeBMIDI (Part 4)
(EMM Nov 84)

BeeBMIDI (Part 5)
(EMM Dec 84)

Soft Music
(ES Mar 84)

(EMM Feb 84)

(EMM Mar 84)

(EMM Apr 84)

(EMM May 84)

(EMM Jul 84)

(EMM Aug 84)

(EMM Feb 85)

(EMM Apr 85)

(EMM May 86)

(EMM Jun 86)

(EMM Aug 86)

(EMM Sep 86)

(MT Nov 86)

(MT Dec 86)

(MT Jan 87)

(MT Mar 87)

(MT Apr 87)

(MT May 87)

(MT Aug 87)

(MT Oct 87)

...and 19 more Patchwork articles... (Show these)

Browse category: Computer > Acorn

Browse category: Synthesizer > Yamaha

Previous Article in this issue


Next article in this issue

Modular Synthesis

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


Electronics & Music Maker - Aug 1984





Part 1 | Part 2 | Part 3 (Viewing) | Part 4 | Part 5 | Part 8

Gear in this article:

Computer > Acorn > BBC Model B

Synthesizer > Yamaha > DX7

Gear Tags:

Digital Synth
FM Synth
FM 6-Operator

Feature by Jay Chapman

Previous article in this issue:

> Stagefright

Next article in this issue:

> Modular Synthesis

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 2020
Issues donated this month: 0

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

Funds donated this month: £30.00

All donations and support are gratefully appreciated - thank you.

If you're enjoying the site, please consider supporting me to help build this archive...

...with a one time Donation, or a recurring Donation of just £2 a month. It really helps - thank you!

Small Print

Terms of usePrivacy