Not only does it have a five octave range that corresponds roughly to scale, the ROM has routines which support decay and pitch changes. It goes from A110 to A3520, but after five octaves it doesn't have enough precision to stay on scale.
First, get a copy of the coding guide:
http://www.geocities...oding-guide.zip
I don't know how much of that was from Coleco and how much of that was from Daniel B. I have my own different names for most of the symbols because I disassembled it on my own years ago.
The scale chart is on page 193. The sound format is shown on pages 190-191. (Note that the first line of "NOISE" on p191 should be all zeros.) In the musicbox demo, all the tunes are broken up by channel, but there are still some noise notes mixed with regular notes. Note that the rest, end, and repeat notes may ignore the channel number. Also, I found what appears to be a bug with the "special effect" note that nobody used, and made a note of that in my musicbox disassembly.
All I did was copy existing music just to get things working. Writing a new tune from scratch will depend on understanding the wierdnesses of the sound routines, plus having a good ROM disassembly handy. In my disassembly of musicbox demo, notice how some sounds just add in three or four lists and are done with it, but others muck around with the first byte of the channel tables, maybe to chain two lists together.
In the musicbox demo, you may notice how the NMI checks some flags; this is to avoid VDP problems. You have to read the VDP status to acknowledge the NMI so that you can get another NMI, but if you read it while a VDP address is being loaded, things will go on the screen at the wrong place. (I've seen this happen with the Bejeweled demo.) It also defers the sound update, but never calls the AddSound routine with the NMI protection. I put the sound update directly into my NMI, but now I have to wonder how good an idea that was.
Also, you can download a copy of my Z-80 assembler from this page:
http://xi6.com/hacks/ Here are the commands which will assemble a file:
asmz80 -l -o -w -e $file
makerom <$file.hex >$file.bin
FWIW, I started work a long time ago on an optimized BIOS ROM, and was able to save over 1K (out of 8K!), and still remain compatible with most stuff. While looking into the sound routines the other day, I actually found six or seven more bytes to save, and possibly another couple more. It's absurd how loose that code was.
Edited by Bruce Tomlin, Thu Mar 16, 2006 8:30 AM.