02 May 2016, 21:46 | #1 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Minimum sector gap
Hi!
I am looking into writing a floppy track loader with minimum CPU usage (for loading in the background of a demo). I have read this interesting track loader thread, which is focused on code size: http://eab.abime.net/showthread.php?t=45654 I also found this reference very useful: http://amigadev.elowar.com/read/ADCD.../node015B.html The MFM decoding itself can be done very efficiently using the blitter. So the bottleneck then becomes traversing the sector gap to look for the first sector after the gap. It occurred to me that maybe there is a minimum gap size that can always be skipped, so I can save some time by not traversing the whole gap. The AHRM specifies 2 microseconds per MFM bit and a rotation speed of 300 RPM, corresponding to 6250 MFM words per revolution, i.e. a gap of 6250-(32+512)*11 = 266 words. Of course this can vary depending on the precise bit rate and motor speed of the disk drive that wrote the disk. I performed some tests. On my A600 disk drive, the gap was between 340 and 350 words for all the disks I tried. Similar numbers were seen in WinUAE from an ADF floppy image. The HxC on my A1200 showed a gap of 416 words. But I guess this depends on how the HFE file is formatted (the files I tried were created using the standard HFE utilities). Based on the tests, it should be safe to skip the first 300 or so words. But is this too optimistic? Which gap sizes can occur in practice? Last edited by Blueberry; 02 May 2016 at 23:48. |
02 May 2016, 21:55 | #2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
what about writing the disk as whole tracks and use the hw sync detection when you read it.. wouldn't that give you all 11 sectors back to back? (provided you have only one sync word per track, of course)
edit: also provided that you don't need the format to be compatible to trackdisk.device.. Last edited by hooverphonique; 02 May 2016 at 22:13. |
02 May 2016, 22:26 | #3 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Yes, it needs to be in standard format. Much easier to distribute that way, not to mention creating it in the first place.
|
02 May 2016, 22:38 | #4 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,209
|
|
02 May 2016, 22:40 | #5 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
ok.. well, according to this info about the amiga bit length
PAL 506699.285714286Hz 1973.5571535103ns NTSC 511363.636363636Hz 1955.5555555556ns you would get a gap of around 348 words for a PAL amiga, which is closer to your empirical numbers. The gap gets even bigger for NTSC. I guess this also relates to how many words to read to be sure to get the whole track, which was different for each trackloader I ever saw, back in the day ;-) |
02 May 2016, 23:04 | #6 | |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Quote:
I think this would work well for most effects, but there will be exceptions of course. Last edited by Blueberry; 02 May 2016 at 23:39. |
|
02 May 2016, 23:15 | #7 | |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Quote:
The other question is then how precise the motor speed is. Even a 5% speed increase would stay within the gap, so one could imagine that some drives are pretty far off without anyone noticing. |
|
02 May 2016, 23:36 | #8 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
Quote:
If my amiga wasn't in bits atm, I would take a look at my different mfm decoders to see, what minimal gap I anticipated back in the early 90's - I probably just brute forced it, though ;-) |
|
03 May 2016, 01:21 | #9 | |
Registered User
Join Date: Feb 2016
Location: Homeless
Posts: 61
|
Quote:
In all other cases, the gap size should be more or less constant per disc, so you could probably detect if it's a disc with 416 word or 340 word gaps (or other size), and then subtract something like 30 from that value - and hope that it's working. There may be some fluctuation because floppy drives are probably permanently adjusting the rotation speed whenever they notice the motor being too fast/slow, the worst case would be if the disc was spinning too fast at time when writing a track, and spinning too slow at time when reading the same track (or vice-versa). If you know that all sectors (or sector headers) contain continous non-zero bytes then you could also speedup searching by skipping each some bytes. I don't know if sync values are written to memory? If they are, then each sector would start with two sync words, plus one word containing odd bits of the format/track value, which should be all non-zero (aka non-AAAAh in MFM notation). The fourth word should contain odd bits of sector/remain values, usually either sector or remain should be odd, but I think that isn't 100% guaranteed, so better don't trust on that. |
|
03 May 2016, 10:16 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Just count length of one track/motor speed and use it calculate approximate safe gap skip value
|
03 May 2016, 11:07 | #11 | |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Quote:
So the gap scanning can skip ahead at least 10 bytes at a time and test a word. One caveat: the "zero" words in the gap might end up being read as either $AAAA or $5555, so it will need to sample one word from the gap and compare against that. |
|
03 May 2016, 11:23 | #12 | |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 40
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Minimum Bootable Workbench Disk | atrionfo | New to Emulation or Amiga scene | 14 | 25 August 2022 07:23 |
Minimum Utilities to get up and running | allanmb | Amiga scene | 3 | 30 September 2015 16:08 |
minimum requirents for whdload... | gntavelis | support.Hardware | 13 | 10 March 2014 15:10 |
Minimum requirements for MFMWarp? | andreas | project.WHDLoad | 4 | 28 October 2005 23:18 |
WinUAE Minimum System Req's? | Unregistered | New to Emulation or Amiga scene | 10 | 15 December 2004 17:15 |
|
|