This cartridge works on the following PCBs and with the following models of Spectrum:
This 128K cartridge for the ZXC3 PCB mimics the behaviour of a ZX Microdrive, using a FLASH ROM to simulate a Microdrive cartridge. There are two variations of this emulator - one for use with a standard Interface 2 ROM cartridge style socket and the other for use with the ROM cartridge socket of the SPECTRA SCART interface when configured to behave as a shadow ROM. Both variations include a modified version of the Interface 1 ROM, with the load, save and erase routines patched so that they can operate on the FLASH ROM as well as with real Microdrives. The version for use with the SPECTRA interface operates with the Spectrum's internal ROM, just as an Interface 1 would do. However, the Interface 2 version cannot page back and forth with the Spectrum's ROM and so it is necessary to include a modified version of the Spectrum's ROM in the emulator. In either case, two versions of the emulator exist that mimic the edition 1 ROM and the edition 2 ROM of the Interface 1.
For the Interface 2 version of the Microdrive Emulator, it is necessary to explictly include a modified ROM for the desired model of Spectrum, e.g. 48K Spectrum, Spectrum 128, Spanish Spectrum 128. Patches are required to replace the Interface 1 and Spectrum 128 ROM paging mechanisms with the ZXC3 ROM paging mechanism. This has the interesting side effect of allowing a 48K Spectrum to run one of the 128K Spectrum versions of the Microdrive Emulator, providing access to the various menus and 128 BASIC editor mode. In this respect, the Microdrive Emulator can be thought of as an extension of the Interface 1 versions of the Spectrum 128 Emulator and Spanish 128 Emulator cartridges. Since a patched version of the Spectrum ROM must be used, it also allows the opportunity to add support for other ROM based devices and so versions exist that include support for the Currah uSource assembler / FORTH extension ROM.
The SPECTRA version of the Microdrive Emulator has a number of advantages over the standard Interface 2 version:
- It supports a higher capacity virtual microdrive cartridge since it is not necessary to include a modified version of the Spectrum ROM (90K as opposed to 45K - 75K).
- It is more compatible with existing programs since the Spectrum ROM does not need to be patched with the ZXC3 paging mechanism (the character set bitmaps do not require relocating, as described in the Limitations section).
- Since the real Spectrum ROM is used, the emulator will operate correctly with alternate language versions of the Spectrum.
- The Z80 I register does not need to be set to a specific value (as described in the Limitations section).
However, the SPECTRA version of the Microdrive Emulator cannot support devices such as the Currah uSource since this requires patching to the Spectrum ROM. If such support is required then the standard Microdrive Emulator must be used instead.
The Microdrive Emulator can be used even if a real Interface 1 is not connected. However, if one is present then the Microdrive Emulator will correctly control the RS232 socket, Network ports and Microdrives (although only up to 7 units, as detailed in the Program Compatibility section). When a SPECTRA interface is connected, the Microdrive Emulator will also control its Interface 1 compatible RS232 socket (if enabled). The lead wiring required to a PC is identical to that shown for the Spectrum RS232 ROM cartridge.
|Virtual Microdrive Cartridge|
The 128K FLASH ROM is divided into eight 16K banks. One of these banks contains the patched Interface 1 ROM. Another is used as a temporary buffer when writing / erasing data to the virtual microdrive cartridge. For the Interface 2 version of the Microdrive Emulator, one bank is used when mimicing a 48K Spectrum or two banks when mimicing a 128K Spectrum, and a further bank used if emulating the Currah uSource. Whatever banks remain are used to hold the virtual microdrive cartridge, and are formatted into sectors just like a real microdrive cartridge. Each sector follows the same format used on real cartridges, with the exception that there are no preamble bytes stored. Due to the ZXC3 ROM cartridge paging mechanism, only 16320 bytes of each 16K bank can be used for storage. A microdrive sector occupies 543 bytes, and this is augmented with one further byte to act as a flag to indicate whether this sector has been formatted. A sector in the emulated cartridge therefore occupies 544 bytes, and this means that a 16K bank can hold 30 sectors. Of these 544 bytes, 512 bytes are the actual file data with the remaining 32 bytes holding sector status information. A 16K bank can therefore store 15K of file data. The SPECTRA version of the Microdrive Emulator uses 6 banks for the microdrive cartridge and hence provides a capacity of 90K (which exceeds the 85K minimum capacity advertised for real microdrive cartridges). For the Interface 2 version of the Microdrive Emulator, the 48K Spectrum version uses 5 banks for the microdrive cartridge and hence provides a capacity of 75K. If the Currah uSource is also emulated then the capacity drops to 60K. When mimicing a 128K Spectrum, 4 banks are used to hold the virtual microdrive cartridge and hence produces a capacity of 60K. If the Currah uSource is also emulated then the capacity drops to 45K.
The FLASH ROM allows individual bytes to be written, but only allows erasures of whole 16K banks. Therefore, to erase a microdrive sector requires copying all sectors that are to be retained into the temporary bank, then erasing the main bank, and finally copying all saved sectors back from the temporary bank. This therefore leaves a 'blank' area where the sector to erase resides. The Microdrive Emulator interprets any such blank area as an unused sector.
The patches to the Interface 1 ROM routines means that all BASIC and most machine code programs will operate correctly with the emulated Microdrive. The only exception are machine code programs that contain their own low level control routines, e.g. a higher capacity format routine. Any attempt to directly control the Interface 1 I/O ports will not function with the emulated Microdrive but will instead attempt to access real Microdrive hardware.
By default, the emulated Microdrive responds to commands destinated for drive 1 since this is probably the drive most often used. However, if a real Microdrive is also connected then it will be deemed to be drive 1 by the Interface 1 hardware. However, the patched ROM routines will direct all commands to the emulated Microdrive and as a result the real Microdrive will not be accessed. Commands for Microdrives 2 to 8 will correctly access these drives if they are present, and hence the Microdrive Emulator can coexist with up to 7 real Microdrives. To overcome this clash of drive 1 accesss, it is possible to change the drive number that the emulated Microdrive responds to. It can be changed to any valid Microdrive number, i.e. between 1 and 8, irrespective of how many real Microdrives are connected. To change the drive number that the emulated Microdrive responds to, the Drive Set utility is used.
The Microdrive Emulator mimics the functionality and performance of a real Microdrive as best it can. However, there are some limitations imposed by the ZX Interface 2 ROM cartridge mechanism which may cause existing Microdrive programs to fail with the emulated drive.
The routines to read, write and erase the FLASH ROM used to mimic a Microdrive cartridge must reside in RAM. Although these routines are small (just over 200 bytes), they can upset some programs that assume full control over the available RAM, e.g. programs that severely lower RAMTOP. Existing Microdrive snapshots taken using a Multiface interface will also fail since these will overwrite the FLASH routines. The FLASH routines are inserted into RAM between the system variables introduced by the Interface 1 and the channel information area. The use of this region should not cause a problem for the majority of programs, and is likely to only affect those that access the channel information area directly instead of via the system variable CHANS.
The FLASH programming mechanism of the ZXC3 PCB requires that there be no extraneous memory reads to the ROM region of the memory map whilst a write operation is in progress. Such reads are most likely to occur as a result of the automatic refresh reads performed by the Z80 CPU. To ensure this does not happen, the Z80's I register must be set to a value above $3F. In a 16K/48K Spectrum, it would by default have a value of $3F and in a 128K Spectrum in 128 BASIC mode it would have a value of $00. The Interface 2 version of the Microdrive emulator therefore sets the I register to hold a value of $8F (it cannot be between $40 and $7F else 'snow' appears on the screen due to contention between the ULA and the Z80). The SPECTRA version of the Microdrive Emulator overcomes this limitation by only temporarily changing the value of the I register while a FLASH write operation is in progress.
The paging mechanism provided by the ZXC3 PCB operates using the last 64 bytes of the ROM region. For the Interface 2 version of the Microdrive Emulator, this causes a problem with the modified version of the Spectrum ROM that must be included since this region normally contains the bitmaps for the last eight characters of the character set. The solution employed is to shift the entire character set down in memory by 64 bytes. Programs that determine the location of the character set using system variable CHARS will operate correctly but those that use a hard-coded address will fail. This issue does not apply to the SPECTRA version of the Microdrive Emulator since the ZXC3 paging mechanism is disabled whenever the Spectrum ROM is active.
Machine code programs that attempt to format a Microdrive cartridge to higher than normal capacities will not operate on the emulated Microdrive, but will instead operate on the real Microdrive of the same drive number. The virtual Microdrive cartridge has a fixed capacity of 90K for the SPECTRA version of the emulator, and for the Interface 2 version the capacity is 75K when mimicing a 48K Spectrum and 60K when mimicing a 128K Spectrum. If the Currah uSource is also being emulated, then the figures for the Interface 2 versions drop from 75K to 60K, and from 60K to 45K respectively. All of these limits are dictated by the capacity of the 128K FLASH ROM used by the ZXC3 ROM cartridge.
The emulated Microdrive cartridge does not support any form of write protection.
It is not possible to have in use eight real Microdrives units and the emulated Microdrive. One of the real units would be overridden by the emulator.
Bit 7 of the Z80 R register must not be set when the Interface 1 ROM of the SPECTRA version of the Microdrive Emulator is invoked otherwise the ZXC3 paging mechanism will inadvertently be activated.
The emulated Microdrive cartridge is pre-formatted with the following utilities:
- The Drive Set utility allows the drive number assigned to the emulated Microdrive to be changed.
- The Microdrive Copier utility allows files to be transferred between real Microdrives, the emulated Microdrive and cassette.
- The ZXC3 Flash Programmer utility allows the ROM cartridge to be completely re-programmed with a new compilation.
A simple launch menu written in BASIC is also included and has the file name of run allowing it to be loaded at power on simply by typing RUN. To use the menu, simply type the number corresponding to the utility to run.
The Drive Set utility is used to change the drive number that the emulated Microdrive responds to. When the utility is run, the following menu is displayed:
The utility shows the drive number currently assigned to the emulated Microdrive. To change the drive number, select the Change Microdrive Number option from the menu and then type the new drive number. The utility will then take a couple of seconds to update the Microdrive Emulator.
This utility allows files to be transferred from microdrive to microdrive, microdrive to cassette, cassette to microdrive, and cassette to cassette. It supports both editions of the ZX Interface 1 ROM. The utility requires that the ROM cartridge PCB is populated to support paging out to the Spectrum ROM.
The cartridge is primarily intended for archiving files from microdrive to cassette, thereby providing a more reliable method for storing programs, and for allowing such archived files to be restored to a new microdrive cartridge. Files are not modified as part of the copy process and so programs that load in multiple parts from microdrive are unlikely to load directly into a Spectrum from the archived cassette files. Note that all cassette files use the standard cassette format.
The program uses the bottom two thirds of the display file to store program routines and hence the user interface is restricted to the top third. The up and down cursor keys (or just keys 7 and 6) are used to navigate the menu and the ENTER key used to select the highlighted option.
The Microdrive to Microdrive option allows files to be transferred between any of the 8 possible microdrives. First it asks for the name of the file to load. A case sensitive file name of up to 10 characters can be entered, or all files on the drive can be selected by pressing ENTER on its own. The source and destination drives are then requested, and these can refer to the same drive if only a single microdrive is available.
The requested file(s) are then read in from the source microdrive and automatically written out to the destination microdrive. If using a single drive for the source and destination then prompts will be displayed instructing the cartridges to be switched. If a file is too large to load into memory, then it will be transferred in parts. The display will count the parts as they are being transferred.
At any stage of the transfer, the BREAK key can be pressed to abort the process. Should a file not be found or the destination cartridge become full then an error message will be displayed, and the transfer process will abort. If the destination file already contains an identically named file then a prompt will be displayed requesting whether to overwrite the file. Pressing key Y will overwrite the file and pressing key N will ignore the transfer. If multiple files are being copied then pressing N will skip to the next file. A third option will also be presented and pressing key A will cause all subsequent files to be overwritten automatically.
The Microdrive to Cassette option allows files to be transferred from any of the 8 possible microdrives to cassette. First it asks for the name of the file to load. A case sensitive file name of up to 10 characters can be entered, or all files on the drive can be selected by pressing ENTER on its own. The source drive is then requested, followed by a delay to wait before saving files to cassette. The delay can be between 1 and 7 seconds, or 0 which will cause a wait until the user presses a key. If a non-0 delay is requested then the border colour counts down the delay. Pressing any key will abort the delay and will immediately begin the save.
Only files that can be loaded completely into memory can be transferred to cassette. An error message will be displayed if a file is too large, and pressing any key will cause the transfer process to continue with the next file (if there is one). In addition to programs, bytes, numeric arrays and character arrays, microdrive data files can also be transferred to cassette. Spectrum BASIC does not support data files for cassette, and so a new header type index of 4 is used to denote these.
The Cassette to Microdrive option allows files to be transferred from cassette to any of the 8 possible microdrives. First it asks for the name of the file to load. A case sensitive file name of up to 10 characters can be entered, or all files can be selected by pressing ENTER on its own. The destination drive is then requested. If all files were selected for transfer then the display will show that 'ALL FILES' are required. The program will continue to load and transfer files until either the destination microdrive becomes full or the BREAK key is pressed.
The Cassette to Cassette option allows files to be transferred from one cassette to another. First it asks for the name of the file to load. A case sensitive file name of up to 10 characters can be entered, or all files can be selected by pressing ENTER on its own. Next the length of delay to wait before saving is requested, ranging from 1 second to 7 seconds, or a value of 0 which will cause the program to wait until a key is pressed. If all files were selected for transfer then the display will show that 'ALL FILES' are required. The program will continue to load and transfer files until the BREAK key is pressed.
The program has a number of limitations, which stem from the fact that it uses the microdrive routines within the Interface 1 ROM. When transferring all files from a microdrive cartridge, if a file can not be loaded then a 'file not found' error will be produced and this will terminate the transfer process. When transferring all files from a cartridge, the catalogue routine within the Interface 1 ROM is used to generate the list of files to copy and this routine has a limit of 50 files.
The SPECTRA version of the Microdrive Emulator can be downloaded below. Versions exists that emulate the edition 1 and edition 2 ROMs of the Interface 1. Configuration switch 3 of the SPECTRA interface must be set to the enabled position when using this version of the Microdrive Emulator. Note that if the Flash Programmer utility is loaded from the emulated Microdrive, configuration switch 3 must then be set to the disabled position in order to allow the FLASH ROM to be reprogrammed.
|Click here to download the SPECTRA version of the Microdrive Emulator (Edition 1) ROM cartridge.||128K FLASH|
|Click here to download the SPECTRA version of the Microdrive Emulator (Edition 2) ROM cartridge.||128K FLASH|
All variations of the Interface 2 version of the Microdrive Emulator are available for download using the following drop down lists.
|Model||Emulate a 48K Spectrum, a Spectrum 128 or a Spanish 128.|
|ROM 0 (Editor)||Include bug fixes to the resolve errors present in the 128 Editor ROM.|
|ZX Interface 1||Specify the version of the Interface 1 ROM to include.|
|Click here to download the selected Interface 2 Microdrive Emulator ROM cartridge.||128K FLASH|
The utility programs can also be downloaded separately as TZX files. They all apply to both the Interface 2 and SPECTRA versions of the Microdrive Emulator.
|Click here to download the Drive Set utility in TZX cassette file format.|
|Click here to download the Microdrive/Cassette Copier in TZX cassette file format.|
|Click here to download the Microdrive/Cassette Copier in Z80 snapshot format.|
|Click here to download the ZXC3 Flash Programmer utility in TZX cassette file format.|
|Click here to download the ZXC3 Flash Programmer utility in ZX Interface 1 binary file format.|
|Click here to download the Run menu program in TZX cassette file format.|