Overview ======== This wondrous suite of programs will allow you to transfer programs from the ZX Spectrum to the ST (for use with the Spectrum emulator) via MIDI, if you have the Ram Music Machine for the Spectrum, and a MIDI cable. If you have a different interface, you will need to alter the Spectrum program supplied. The ST program should work on any flavour of TOS. Instructions ============ 1. List Z80.TXT (or better still, print it out) and type the listing into the Spectrum. Your ZX Printer should not be connected or Bad Things will happen. Run it, and be ready to save the resulting program. 2. If the code has saved correctly, switch off both machines and plug in the Music Machine interface. Connect MIDI OUT on the Music Machine to MIDI IN on the ST with the cable. Switch your Spectrum on again, and the ST. 3. Enter LOAD "midixfer" CODE on the Spectrum, and load the program. (When I type blind I use LOAD "midixfer" CODE: BEEP .5,12 so I know it's OK.) 4. Double-click on MIDIXFER.TOS on the ST. The floppy disk should be write- enabled! Watch the nice colours (not sure what happens in mono though). 5. On the Spectrum, enter RANDOMIZE USR 23296. This invokes a short machine code program which loads the first thing it finds on tape and shoves the whole lot down the MIDI cable, suitably modified to load into the emulator without any editing. Whether the program will run or not... 6. When the ST screen starts to flash in different colours, this means the MIDI transfer is taking place. You should stop the tape now, especially if you are transferring a multi-part program. The flashing will go on for 10 seconds at most, and then the file will be written to disk. 7. If you have more stuff to transfer, return to step 4. If not, you might as well switch off the Spectrum (see Troubleshooting Q&A). Start up the emulator, put in your disk with the new progs on it and enter LOAD "". Then press the function key for Rescan so it can find the new progs and write a contents file (INHALT.INF). Troubleshooting Q&A =================== Q. When I switch on my ST the desktop comes up but I can't do anything. A. MIDI data was probably being sent to the ST when it was switched on. Unplug the cable and reboot. Q. I could have sworn I transferred two programs but I can only find one. A. They must both have had the same name. You'll need to rename the one you have (which will be the second one) and re-transfer the first. Which leads us on to.. Q. I renamed a program on disk but it wouldn't load into the emulator. A. You'll have to take a disk editor to it. The name within the file (byte 0 is file-type, bytes 1-11 are name (padded with spaces)) must correspond to the name of the file on disk. Q. I can't transfer this hyperload/full-length/headerless etc. program. A. You can only transfer "normal" programs less than 41K. Anything more complex than a few LOAD "" CODEs will probably need to be hacked. Q. The tape has played through to the end but nothing happened on the ST/ the transfer started too early/the program won't load into the emulator. A. There was either a tape loading error, or the program is protected. How It Works ============ The Spectrum program loads the first thing it finds, header then data. It uses the file length specified in the header to work out how much data to load, and also how much to send (plus 17 bytes for the header) via MIDI. When the file has been loaded, two bytes are sent giving the file length, then the whole file is transferred. The ST program waits for bytes to arrive via the MIDI port. The first two represent the length of the following file. That amount of bytes are then read from the port and written to disk, using the name contained in the header. Anything too long or illegal is usually dealt with sensibly by TOS. The file format required by the emulator is simply the original file header plus data. The RAM Music Machine conveniently uses the same ACIA (6850) as the ST. All the source code is in the archive, although modifications should only be necessary for those with a different interface. Even if the ACIA is the same (which is very probable), the I/O ports used might be different. Transmission speed with my setup seems to be about 38Kbaud and I have yet to see a single transmission error (not having tried anything stupid like injecting maple syrup into the MIDI ports beforehand). The Emulator In General ======================= The documentation claims full implementation of Interrupt Mode 2. This is a teensy fib, because in that case even the most complex programs should run. They don't - Turbo Esprit and Match Day both freeze mysteriously. In the latter case, I went through the code disabling stuff left, right and centre, but only got as far as having the teams running (er, strolling) out. The R register isn't implemented properly. Many games use this as a primitive kind of random number generator - like Glass and Jetpac. I had to write my own for the latter game (couldn't be bothered with Glass though). Binary Coded Decimal has been kludged somewhat. The DAA instruction always rounds up, instead of taking the Add/Subtract flag into account. This meant the on-screen timer in Arcadia counted down to 90 and then back to 96! The only keyboard ports read are those mentioned in the orange manual. Manic Miner and Jetset Willy both use undocumented ports. Finally, I found that if you hack games and remove all their sound routines, you can speed them up quite dramatically. I had Manic Miner running at about 90% of the speed of the original (this on a plain 1Mb STE) and Horace Goes Skiing actually running faster. All the code is PD, but before you get bored with the emulator, I'd quite like to receive your (complimentary) comments on a postcard - even if you have no comments to make, I'd still like a postcard! - sent to: Stephen K Mulrine 132 Kingswood Drive King's Park Glasgow G44 4RB SCOTLAND