Mirage Microdriver

From Sinclair Wiki
Jump to navigation Jump to search

The Mirage Microdriver is a peripheral that allows loading and saving of ZX Spectrum snapshots from/top tape, and if a ZX Interface 1 with Microdrives is attached, Microdrives.


There are two versions. Version 2 contains an 8k ROM, 2k RAM (decoding is incomplete, so it is mapped at $2000, $2800, $3000 and $3800) and an NMI button, and can only be used if an Interface 1 is attached. Version 1 has a 4k ROM instead, and may be used without an Interface 1.

A changes list was provided with version 2 interfaces.

Memory paging

When the NMI button is pressed, the Microdriver is paged into the bottom 16k of the address space. At the end of the NMI handler, it is switched out by an instruction fetch at $2000.

During the NMI handler, the Microdriver makes calls to the Spectrum ROM by calling $3800 (the instruction fetch switches the Microdriver out), calling the ROM routine, and calling $386D (the instruction fetch switches the Microdriver back in).

Snapshot format

Microdriver snapshots are saved either to tape or to Microdrive. A tape snapshot is saved as two or three separate blocks; a Microdrive snapshot is a single file.

The first block is $0588 bytes long:

$0000  Magic number: 'Microdriver © 1985 M.B.Daniells'
$001F  Either $20 (screen is included) or $00 (screen is omitted)
$0020  Always 0
$0021  I
$0022  HL'    
$0024  DE'
$0026  BC'
$0028  AF'
$002A  HL
$002C  DE
$002E  BC
$0030  IY
$0032  IX
$0034  IFF2    [Only bit 2 is defined: 1 for EI, 0 for DI]
$0035  R
$0036  AF
$0038  SP
$003A  Interrupt mode: 1 or 2
$003B  Interface 1 paged flag: $C9 if Interface 1 paged in, $71 if 48k BASIC ROM paged in
$003C  Maximum address used by compressed snapshot.
$003E  Compression table. Used to replace up to 8 runs of bytes with a single byte. 
       Each entry: 
         dw address of byte in compressed snapshot
         dw uncompressed length
$005E  Memory from $5B00-$6029

The second block, if present, is the screen, not compressed: $1B00 bytes.

The third block is memory from $602A to the address given at offset $003C. Once the block has been loaded, the compression table is expanded, starting with the last entry and working back.

The Microdriver snapshot format forms the basis of the SNA format used by emulators.

ROM layout

The address and data lines are connected to the Microdriver's ROM chip in an order that makes the physical layout of the circuit board easy, rather than matching signals. This means if the ROM is dumped using an EPROM programmer, its contents need to be decoded.

Note: these mappings are for the version 2 and version 3 Microdriver. Mappings for version 1 are not yet known.

Spectrum Microdriver
D0 D2
D1 D4
D2 D1
D3 D6
D4 D7
D5 D0
D6 D5
D7 D3
A0 A0
A1 A1
A2 A2
A3 A10
A4 A9
A5 A5
A6 A4
A7 A3
A8 A6
A9 A7
A10 A8
A11 A11
A12 A12