Microdrive

Discussion and advice about emulating the QL on other machines.
User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Microdrive

Post by tofro »

;)

Till,

When Sinclair launched the QL, they stated
  • Minimum 100K capacity
  • 3.5s average access time
  • Typical transfer time: 2-3KB/s (When they launched MDs for the Spectrum, they even stated 16KB/s)
In reality, the following figures apply:
  • Tape speed: 28Inches/s (I guess metrics weren't very common that time...)
  • Tape loop length: ~200 Inches (I haven't checked that yet... ;) )
  • Time per tape loop-around: 7.5s - That somehow fits with the above 3.5s - They just assumed we're halveway there on average ;)
That gives us a "best-case" worst access-time of 7.5s - Worst means - We have just passed the sector we need, best case means - We can properly read the wanted sector first time it comes by - If anything goes wrong, we need to wait another 7.5s. And there's a lot that can go wrong....

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
MIST
Chuggy Microdrive
Posts: 51
Joined: Thu Jul 30, 2015 9:37 am

Re: Microdrive

Post by MIST »

Hmm, that doesn't match what i've read so far. Tapes hold ~220 sectors with 512 Bytes each. These are 112640 bytes or 901120 bits (ignoring any headers and GAPs). Reading all of them in 7.5 seconds would result in a bit rate of more than 120 kbit/s. The real value will be even higher due to gaps and headers.

So what's the bitrate of a microdrive?


User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Microdrive

Post by tofro »

The two main figures above (tape loop-around time and length) come from original Sinclair publications back in 1984. Both I have not verified - They've always been a bit optimistic ;) - They also stated the network port to be 100kbps, while it is ~87.5 in reality.....

But:

Minerva sources state:
The nominal time for a single byte on a microdrive is 40us.
(wherever that comes from, couldn't find the original source) and
A nominal variation of 10% is documented, but as it works out, we can cope here with a variation in byte timings from 20us to 80us,
That hints to a maximum raw bit rate of 190-210kbps, or even more.

Again: Not verified, just citing.... ;)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
MIST
Chuggy Microdrive
Posts: 51
Joined: Thu Jul 30, 2015 9:37 am

Re: Microdrive

Post by MIST »

40us would be 200kbit/s and 25kBytes/sec. If a tape loops in 7.5 sec then this equals 187500 raw bytes per type. A tape in reality holds ~220 sectors. So a full raw sector incl. headers and gaps would be ~850 bytes. A header is 14 bytes, a full sector is 610 bytes according to one of your previous posts leaving 125 bytes (or "byte times" if you prefer) for gaps. We have two gaps per sector so each gap is about 62 bytes or 496 bits long. At 200 kbit/s this would be around 2.5ms per gap which is close to the 2800-3580us you wrote in a previous post.

This seems to make sense ...


Martin_Head
Aurora
Posts: 852
Joined: Tue Dec 17, 2013 1:17 pm

Re: Microdrive

Post by Martin_Head »

The 'QL Advanced User Guide by Adrian Dickens' Page 301 has a lot of data on the microdrive tape structure.

Basically -
The sector header comprises of a 12 byte preamble, followed by the 14 byte sector header itself, followed by a 2 byte checksum.

There is then a gap.

Followed by the block header and data block, which comprises of a 12 byte preamble, followed by a 2 byte block header, followed by a 2 byte checksum, followed by a 8 byte preamble, followed by a 512 byte data block, followed by a 2 byte checksum.

There is then another gap.

To quote a bit about the gap. "The minimum length required for the gap is calculated as follows. The worst case erase lead time (2660us) plus the time required to turn erase off (20us) plus the uncertainty in timing of the write and format procedures (always less than 160us). Plus (for the gap between sectors only - the sector header is never rewritten) the maximum variation on the length of the block written, including the pre-block gap (10% of the total length)."

Hope this helps - Martin Head


User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Microdrive

Post by tofro »

Martin, Till,

Let's see what the code says :shock: (I tried to verify with both SMSQ/E and Minerva sources)
  • 12-byte Preamble in front of the Sector header ------- Actually verified after a bit more digging
  • 14 bytes sector header -------------- yes, that's there
  • 2 bytes checksum for sector header ----------- Actually verified after a bit more digging
  • Gap ----------- yes, that's there
  • 12 Bytes preamble ----------- Actually verified after a bit more digging
  • 2 Bytes block header ---------- yes, in the code
  • 2 Bytes block header checksum ------- yes, in the code
  • 8 bytes preamble ---------- yes, in the code (00 00 00 00 00 00 ff ff)
  • 512 bytes data --------- yes, in the code (it better be ;) )
  • 2 bytes data checksum -------- yes, verified
  • And another gap
... some nonsense removed.....

Regards,
Tobias
Last edited by tofro on Wed Aug 05, 2015 11:19 pm, edited 1 time in total.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
MIST
Chuggy Microdrive
Posts: 51
Joined: Thu Jul 30, 2015 9:37 am

Re: Microdrive

Post by MIST »

What Martin describes is exactly the format i see in the GamesCart.mdv i got from this thread
http://www.qlforum.co.uk/viewtopic.php? ... t=10#p6870

This is no surprise as Martin is the one who made that file. And it's the file i am using for testing. From Tobias' explanations this is in Spectum format?

Is this file known to work with any ql emulator? If yes, does it skip those extra preambles? The additional checksum would be ignored by the QL but the two 12 byte preambles would hurt.

I basically just need a byte stream that i can replay just by adding gaps at the correct positions.

Is there any place with mdv images?


MIST
Chuggy Microdrive
Posts: 51
Joined: Thu Jul 30, 2015 9:37 am

Re: Microdrive

Post by MIST »

I found this archve with four QL MDVs for the QLAY emulator.
http://web.inter.nl.net/hcc/A.Jaw.Venema/psion.zip

They are in the format Martin describes which seems to be the spectrum format ... :|


User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Microdrive

Post by tofro »

To make confusion even greater:

After Till had pointed out to me the Spectrum uses byte checksums, the theory above proved wrong.....

I did some more digging and must apologize - Yes, the pre-amble is there & the header checksum seems to be there, just better hidden than I thought. I can verify Martin's format is OK.

Sorry for the confusion - Must have been too hot this afternoon over here ;)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
MIST
Chuggy Microdrive
Posts: 51
Joined: Thu Jul 30, 2015 9:37 am

Re: Microdrive

Post by MIST »

Is the emulator this thread started with available in source code? This would help me compare the things my board does with some debug output I can hack into such an emulator.


Post Reply