delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/30/06:15:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Trace-PostClient-IP: 68.147.131.211
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Read by sector or Read by track more efficient?
Organization: Systematic Software
Message-ID: <e92kg0pdd9f9epsfvcug7utlv8fo68r3aj@4ax.com>
References: <354933d6 DOT 0407292314 DOT b48ea86 AT posting DOT google DOT com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Lines: 57
Date: Fri, 30 Jul 2004 10:08:02 GMT
NNTP-Posting-Host: 24.71.223.147
X-Complaints-To: abuse AT shaw DOT ca
X-Trace: pd7tw1no 1091182082 24.71.223.147 (Fri, 30 Jul 2004 04:08:02 MDT)
NNTP-Posting-Date: Fri, 30 Jul 2004 04:08:02 MDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 30 Jul 2004 00:14:39 -0700 in comp.os.msdos.djgpp,
gohyongkwang AT hotmail DOT com (Goh, Yong Kwang) wrote:

>Hi. I'm currently using _bios_disk function in a simple program to
>explore raw floppy disk content.
>
>To read an entire floppy disk, afaik, there's two way when calling the
>_bios_disk function.
>
>Method 1 is to read the entire track in a single call by specifying
>the number of sectors to read as the number of sectors per track and
>to loop thru all the tracks for an entire disk. Drawback is that it's
>impossible to identify which sector of the track is bad/unreadable
>when the function call fails.
>
>Method 2 is more fine-grained by having an additional loop that loops
>thru all the sector in a track one-by-one, reading in 1 sector per
>function call. Appears to be slower but allows the program to identify
>which specific sector is bad/unreadable.
>
>Which would be faster and more efficient? Theoretrically, method 1
>appears to be faster but given the slow mechanical speed of the floppy
>drive, the boost in microseconds in terms or program execution may not
>be prominent enough to rule overwhelmingly in favor of method 1
>anyway.
>
>Anyone tested out the speed difference using both methods? How
>faster/slower does each one run compared to the other?

If you read sector-by-sector from an HLL, it'll probably take one
rotation per sector, or 2880 revs per 1440KB disk, because you
probably won't be able to issue another request before at least part
of the next sector has passed under the heads, and you'll have to wait
until the sector passes under the heads again (this applies only to
diskette drives without a built in hardware buffer). 
At 300rpm or 200ms/rev those 2880 revs take 576s or 9m:36s.

If you read a track at a time, you'll probably lose a rev between
tracks, as you won't be able to switch heads to the other track in the
cylinder, or seek to an adjacent track quickly enough, but for 160
tracks, you can probably read the disk in 320 revs or 64s. 

DOS/biosdisk() seems to have a limit of max 18 sectors or one track
per request, but if you drop to device level assembler, allocate a
buffer aligned on a 64KB memory boundary, up to 64KB long, to avoid
problems with DMA chip limitations, you could read up to 64KB/128
sequential sectors per rev, which is as fast as is possible on any
drive, and certainly one diskette cylinder of 18KB/36 sectors per rev.
That could take only 80 revs or 16s, plus some time for seeks, which
could be as little as 2s or up to another 16s, if the 3-6ms seek time
and 15ms for head settling means you miss the start of each rotation. 

-- 
Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada

Brian DOT Inglis AT CSi DOT com 	(Brian dot Inglis at SystematicSw dot ab dot ca)
    fake address		use address above to reply

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019