Perfect FDS read-rewind cycle timing

Started by Cluster, April 22, 2021, 12:19:44 am

Previous topic - Next topic

Cluster

April 22, 2021, 12:19:44 am Last Edit: April 22, 2021, 08:31:23 am by Cluster
Hi.

I just wrote the script for Famicom dumper to measure FDS read-rewind cycle time:

DateTime? lastCycleTime = null;
dumper.WriteCpu(0x4025, 6); // reset
dumper.WriteCpu(0x4025, 5); // enable motor without data transfer
// wait for non-ready state
while ((dumper.ReadCpu(0x4032, 1)[0] & 2) == 0) ;
while (true)
{
  // wait for ready state
  while ((dumper.ReadCpu(0x4032, 1)[0] & 2) != 0) ;
  // calculate and print cycle duration
  if (lastCycleTime != null)
  {
    Console.WriteLine("Full cycle time: {0} ms", (int)(DateTime.Now - lastCycleTime.Value).TotalMilliseconds);
  }
  // remember cycle start time
  lastCycleTime = DateTime.Now;
  // wait for non-ready state
  while ((dumper.ReadCpu(0x4032, 1)[0] & 2) == 0) ;
}

So I can calibrate an FDS drive speed. But what is the perfect value? The article on wiki.nesdev.com says that it's about 7 seconds. One of my FDS drives has ~7850 milliseconds, another has ~8100 milliseconds. Also, there are different values with and without a disk in the drive. But maybe there is some info about the exact "perfect" value? Thanks.

Cluster

After some tests with the original licensed disk, I found that 7600 milliseconds is the fastest possible speed to read the disk correctly and 8700 milliseconds is the slowest possible speed.
So seems like the optimal value is (7600 + 8700) / 2 ~= 8150 milliseconds. But I'm not sure about it.

MWK

Hey Cluster, that's awesome, you just never cease to amaze me  :bub: