Skip to main content
Home Forums 68kMLA Floppy Emu: an SD Card Floppy Emulator — #13
Post #13 by bigmessowires
Source Forum68kMLA
CategoryTroubleshooting
Post DateTue, 22 Nov 2011 - 20:22
Original URLhttps://68kmla.org/bb/threads/floppy-emu-an-sd-card-floppy-emulator.24248/
Post
OK, I think I've fixed the bug that was causing all the retries and reseeks to track zero, bloating the read times. Now it reads through an entire floppy image without any retries-- hooray! But it's still slower than a real floppy: 57 seconds to read a 800K disk, vs 41 for a real floppy in my most recent test.

I'm wondering if this has something to do with how the sectors are interleaved and organized on a real floppy. On my emulated floppy, the sectors in each track appear in consecutive ascending order, and every time the drive steps or switches sides, it jumps to the first sector on that track. I'm wondering if real floppies are formatted with a 2:1 interleave, so sectors appear in order like 0 4 1 5 2 6 3 7 instead of 0 1 2 3 4 5 6 7. I also seem to remember reading somewhere that a real floppy offsets the location of the first sector in each track from the location of the first sector in the previous track.

There are a bunch of tricks like that which can help reduce the number of times the disk must make a complete rotation before the Mac reads all the sectors from a track, basically trying to match the access pattern of the Mac with the organization of the sectors on the disk. In a perfect world, the Mac would always read all the sectors from a track in one pass, with the disk only making a single rotation. My debug info shows this does happen with my emulated floppy, but only rarely. With a real floppy this should be rare too, because it would require the lucky chance of a read operation beginning just as the first sector of the track approached the read head. With a random starting position, two rotations of the disk should always be enough to read the whole track, assuming the Mac is fast enough to keep up. But my debug info shows that most of the time, it takes about three "rotations" of the emulated disk to read a whole track. My measured disk read times of 57 vs 41 seconds make roughly a 3:2 ratio, so maybe there's something to that.

mp.ls