RanSID -- A program for analyzing C64 tunes by Stephen L. Judd Since ransid is a pretty straightforward program, this is a pretty short document. Ransid is a tool for analyzing SID tunes -- how the tune is constructed, how instruments are constructed, etc. If you're one of these people who worries that their "secrets" might be discovered, well, get over it! A major reason this was written is that it is so hard to find information on desinging instruments! If you'd just write up your techniques instead, you'd be famous, there would be more composers and more advanced instruments, flowers would bloom, Microsoft would go out of business, bell bottoms and body piercings would forever vanish, etc. etc. Well, okay, another reason this was written was to figure out how the Rob Hubbard Commando tune and instruments work. Technically, ransid works pretty much the way you'd expect: it maps RAM into the $d400 area, calls the player, then copies the result into a buffer. Once the specified number of SID "frames" are captured, it then provides a set of analysis tools for examining frames and registers, playing the tune, etc. To use ------ Load the tune, load ransid, and start ransid (sys $4000 or whatever). Easy. The first screen you encounter is the "capture" menu. From here you can set - the Init and Play addresses for the player, - the value of .A that should be used when calling the Init routine - the frame to start capturing at - the number of frames to capture - the location of the capture buffer For example, the tune "Commando", by Rob Hubbard, has its init routine at $5000 and play routine at $5012. To capture this tune, you'd set Init to $5000, .A to whichever tune you wanted to capture (0-2), and Play to $5012. To hear the first part of the song, you would set the start frame to 0. To hear a later part, you might set it to $100 or $400 or whatever. You set values by cursoring to the appropriate number, pressing RETURN, and entering a new value. Pressing <- will exit the capture menu and capture the appropriate frames. Note that each frame is 25 bytes ($d400-$d418). If you capture too many frames and it runs into the $d000 area, you will get garbage. If you put the capture buffer below the program and capture too many frames, you will overwrite ransid and get a crash! But as long as you have the buffer in a safe area and don't make it ridiculously large, you'll be fine (large captures aren't very useful, anyways). Tune Analysis ------------- The analysis screen is also straightforward. There are two main functions of this screen: examining frames and examining registers. The upper part of the screen displays a captured SID frame. The commands for moving forward/backward a frame etc. are listed at the bottom of the screen. Below that display is the register display, which displays the time-series of data for that register, starting from a specific frame. Again, the commands are listed at the bottom of the screen. The one thing that needs explanation is the "@" display toggle. Register data can be displayed in one of three modes. Absolute mode displays the raw data. The two "delta" modes display the _difference_ between frames; that is, lots of effects are done with a loop like register = register + 10 or register = register - 15 Delta+ displays (frame+1 - frame), and delta- displays (frame - frame+1); alternatively, delta+ displays the values to _add_ to the previous value, whereas delta- gives the value to _subtract_ from the previous value. Tune playback ------------- As you've no doubt noticed, ctrl-p will play the recorded frames. Pressing it while a tune is playing will stop the playback at the current frame. Normally, it updates the screen during playback. On non-SCPU systems this can cause a slowdown in the playback, so the '=' update display toggle is provided for that purpose. Note also that key repeat is active, so holding down "+" will do a slow playback. The keys 1/2/3/4 toggle whether voice 1/2/3 or the filter/volume controls will be written to SID during playback. This is useful for singling out one or two voices, etc. (or turning off the volume while analyzing frames)> You might also note that the playback is really pretty accurate, including hard restarts and such. The playback routine monitors the sustain/release value for changes; any time it changes, the routine does a hard restart (00 -> SR and 08 -> $d404, plus an all-crucial delay to let SID settle). This seems to work quite well (and took an appalingly long time to get working right!). And that's about it. Comments, questions, etc. are always welcome!