[comp.os.msdos.programmer] Turbo-C 2.0 absread

emmonsl@athena.ecs.csus.edu (L. Scott Emmons) (11/30/90)

I am experiencing problems using absread() / abswrite() to access raw
(not-neccessarily-msdos) floppies.  I am unable to read side 1 of
disks...  reads walk down side 0 from track 0 to track 359 with no
problem (360K drives...); however the second side of the disk does not
seem to be accessible.  It would seem to me that absread/abswrite could
reasonably try reading from other heads on the device (like after the
last track on side 0 or something).  What's the point of this system
call, besides accessing single-sided devices ONLY?  Guess I will have
to use biosdisk(), which I wanted to avoid...

Thanks,
Scott
				L. Scott Emmons
				---------------
    emmonsl@csus.edu  <or>  ...[ucbvax]!ucdavis!csusac!athena!emmonsl
			Packet: kc6nfp@kg6xx.#nocal.ca.usa.na

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (11/30/90)

In article <1990Nov30.071240.8847@csusac.csus.edu> emmonsl@athena.ecs.csus.edu (L. Scott Emmons) writes:
>
>I am experiencing problems using absread() / abswrite() to access raw
>(not-neccessarily-msdos) floppies.  I am unable to read side 1 of
>disks...  reads walk down side 0 from track 0 to track 359 with no
>problem (360K drives...); however the second side of the disk does not
>seem to be accessible.  It would seem to me that absread/abswrite could
>reasonably try reading from other heads on the device (like after the
>last track on side 0 or something).  What's the point of this system
>call, besides accessing single-sided devices ONLY?  Guess I will have
>to use biosdisk(), which I wanted to avoid...

According to my manual, absread uses the DOS absolute read service.  As
far as that service is concerned, disks don't have sides:  they're just 
a bunch of sectors, running from 0 to 719 on a standard 360K disk.  If
you can read sectors 0 to 359, you're reading both sides of the disk, tracks
0 to 19.  You seem to be having trouble reading tracks 20 to 39, which
is a completely different problem. 

Unless TC is really messed up (it's shelfware for me, so I have the manuals,
but I don't really know how well it works), 
I'd suspect your problem is somewhere else.  Perhaps something has happened to
the boot sector of your disk, so DOS thinks it's single sided? 

Duncan Murdoch

valley@uchicago (Doug Dougherty) (11/30/90)

(If I understand the original posting correctly, he is trying to read
non-msdos disks)  Since absread() uses DOS, I doubt it could read
non-DOS disks.  Or am I missing something???

emmonsl@athena.ecs.csus.edu (L. Scott Emmons) (12/01/90)

In article <1990Nov30.141911.5076@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes:
>According to my manual, absread uses the DOS absolute read service.  As
>far as that service is concerned, disks don't have sides:  they're just 
>a bunch of sectors, running from 0 to 719 on a standard 360K disk.  If
>you can read sectors 0 to 359, you're reading both sides of the disk, tracks
>0 to 19.  You seem to be having trouble reading tracks 20 to 39, which
>is a completely different problem. 

I thought of this (reading a sector reads from both sides of a disk
[i.e. a cylinder]), however calling absread with a 1K buffer (i.e. two
sectors) didn't result in reading both sides of the disk.  As it is an
absolute read/write, it should _not_ know enough to read a track from
side 2 after reading a track from side 1 (because to do that it would have
to know the topological format of the disk, which it would get off the
boot sector (or fat...wherever it is); but, this can't be since abs
read/write should be independent of disk topology.  Or, it could start
with side 2 after reaching the end of side 1 (could be done w/o regard
for topology), or (as you suggest and I tried) it could read full
cylinders (problem with buffer size, though, as this is device
dependant [i.e. the same routine would work only for devices with the same
number of heads]).

>I'd suspect your problem is somewhere else.  Perhaps something has happened to
>the boot sector of your disk, so DOS thinks it's single sided? 

It can't be this, because I am using diskettes with raw data (no boot sector,
no fat: nothing but raw data); without regard to _ANY_ format, beyond a disk
"oriented by cylinders, with 40 tracks, 2 sides, and 9 sectors per track".

Thanks for your response,
Scott
				L. Scott Emmons
				---------------
    emmonsl@csus.edu  <or>  ...[ucbvax]!ucdavis!csusac!athena!emmonsl
			Packet: kc6nfp@kg6xx.#nocal.ca.usa.na

tjr@cbnewsc.att.com (thomas.j.roberts) (12/01/90)

From article <valley.659978709@gsbsun>, by valley@uchicago (Doug Dougherty):
> (If I understand the original posting correctly, he is trying to read
> non-msdos disks)  Since absread() uses DOS, I doubt it could read
> non-DOS disks.  Or am I missing something???

Almost correct.

TC absread/abswrite use the DOS functions to read DOS' idea of what the
disk looks like. DOS reads (on a floppy) sector 0 to get the layout
of the disk; sector 0 is correctly set up (on a floppy) by the
DOS FORMAT command. You can use absread/abswrite on a non-DOS floppy,
as long as sector 0 contains the proper BIOS Parameter Block in bytes
11-28 of sector 0; this might well prevent reading diskettes written
by other operating systems. You can use absread/abswrite ONLY (i.e.
no open/fopen) on sectors 1-up to abswrite directly to the disk, and
absread it back again, without problems; you get no filenames, etc.

On a hard disk, sector 0 contains the partition table (I think), and
each partition contains its own BPB as on a floppy (values are 
different!).

Tom Roberts
att!ihlpl!tjrob  TJROB@IHLPL.ATT.COM

emmonsl@athena.ecs.csus.edu (L. Scott Emmons) (12/01/90)

In article <1990Nov30.183106.29270@cbnewsc.att.com> tjr@cbnewsc.att.com (thomas.j.roberts) writes:
>TC absread/abswrite use the DOS functions to read DOS' idea of what the
>disk looks like. DOS reads (on a floppy) sector 0 to get the layout
>of the disk; sector 0 is correctly set up (on a floppy) by the
>DOS FORMAT command. You can use absread/abswrite on a non-DOS floppy,
>as long as sector 0 contains the proper BIOS Parameter Block in bytes
>11-28 of sector 0; this might well prevent reading diskettes written
>by other operating systems.

Ah ha! Thanks for this information; just the information I needed...I have
since dropped using abs read/write and am using the biosdisk() call instead.
non-msdos-formatted diskettes are now being read/written properly...all
cylinders, all sectors, and all sides...biosdisk() does _not_ assume a dos
formatted disk, so this is perfect for my application (it puts the burden of
disk topology on the programmer, instead)...

Thanks to those of you who responded!
Scott

				L. Scott Emmons
				---------------
    emmonsl@csus.edu  <or>  ...[ucbvax]!ucdavis!csusac!athena!emmonsl
			Packet: kc6nfp@kg6xx.#nocal.ca.usa.na

pete@wlbr.imsd.contel.com (Pete Lyall) (12/08/90)

I'm glad this thread started (reading non-DOS diskettes)....

I have been toying with trying to get my PC/AT to read OS9 diskettes.
Os9 typically uses 256 byte sectors, and also has a description
of the media in sector 0 of the disk (although I would bet it's
not in DOS edible format). Is there any mechanism (short of directly 
diddling the disk controller) for reading 256 byte sectors?

To throw in a worse curve, some formats of OS9 floppy disks have a
single density track on side 0, track 0 to support prehistoric boot
EPROMS on several machines. Will PC class disk controllers even DO
single density?

Thanks for any help or hints!

Pete

-- 
Pete Lyall                                                   Contel Corporation
Compuserve: 76703,4230              OS9_Net: (805) 375-1401 (24hr 300/1200/2400)
Internet: pete@wlbr.imsd.contel.com     UUCP: {hacgate,jplgodo,voder}!wlbr!pete 

trier@cwlim.INS.CWRU.Edu (Stephen C. Trier) (12/09/90)

BIOS options exist to read 256-byte sectors.  When I initially got a C
compiler for a PC, one of my first projects was to try to read an OS-9
disk.  I was never able to get the transfer to work right.  (On the
other hand, I hadn't got used to PC programming yet back then!)

So the answer is "yes, it's possible, at least in theory."

There was a package from OwlWare a while ago that ran on MS-DOS and read
and wrote Disk BASIC and OS-9 floppies.

-- 
Stephen Trier                              Case Western Reserve University
Work: trier@cwlim.ins.cwru.edu             Information Network Services
Home: sct@seldon.clv.oh.us               %% Any opinions above are my own. %%

ericr@hp-vcd.HP.COM (Eric Ross) (12/11/90)

I just wrote a rough program to read a non-dos 1.2 Meg disk.  It uses
int 10 subfunction 2 to read from the disk.  I will send sources upon
request.
 

Eric Ross
ericr@vcd.hp.com

edwill@earth.lerc.nasa.gov (Glenn L. Williams) (12/13/90)

In article <1400002@hp-vcd.HP.COM>, ericr@hp-vcd.HP.COM (Eric Ross) writes...
>I just wrote a rough program to read a non-dos 1.2 Meg disk.  It uses
>int 10 subfunction 2 to read from the disk.  I will send sources upon
>request.
> 
> 
>Eric Ross
>ericr@vcd.hp.com


Does anybody have a routine to read (read only is ok) Amiga 880k 3.5"
diskettes on a DOS 3.5" drive, in order to "just" get the textfiles
and things off of them????

mikey@shuksan.UUCP (Mike Fields) (12/13/90)

In article <1990Dec8.182707.28401@usenet.ins.cwru.edu>, trier@cwlim.INS.CWRU.Edu (Stephen C. Trier) writes:
> BIOS options exist to read 256-byte sectors.  When I initially got a C
> compiler for a PC, one of my first projects was to try to read an OS-9
> disk.  I was never able to get the transfer to work right.  (On the
> other hand, I hadn't got used to PC programming yet back then!)
> 
> So the answer is "yes, it's possible, at least in theory."
> 

I had problems getting absread and abswrite to work - things were not
where they were supposed to be.  I finally figured out that absread adn
abswrite refer to logical sectors which are calculated from the current
drive parameters which ------ here's the gotch had to be set by first
doing a dir on a disk formatted to the correct density!!!  I was writing
disks on my SUN at work and could not figure out why I could only get
chunks of them.  I finally wrote a little unix util which wrote a bunch
of sectors (sequential) to disk which contained in ASCII what sector it
was..  TC was getting blocks and skipping blocks.  Finally figured out
that the disk sort of defaults to 360K if it has not been set!.
biosread() and bioswrite() allow you access to the exact sector you want
but you have to fill in the head,track and sector number.

I have since (read the pax doc) found that that is how other people set
the density - have a blank disk formatted with dos at the correct density,
do a dir on it THEN use the drive as you see fit.  It works.


-- 
Mikey (yes "he likes it!")
=======================================================   Mike Fields
==>  uunet!bcstec!shuksan!mikey  (206) 657-6136 [work]    12022 NE 138th Pl.
uw-beaver!ssc-vax!shuksan!mikey  (206) 821-3492 [home]    Kirkland, Wa. 98034

goldstein@arecibo.aero.org (Fogbound Child) (12/14/90)

In article <367@shuksan.UUCP>, mikey@shuksan.UUCP (Mike Fields) writes...
>In article <1990Dec8.182707.28401@usenet.ins.cwru.edu>, trier@cwlim.INS.CWRU.Edu (Stephen C. Trier) writes:
>> BIOS options exist to read 256-byte sectors.  When I initially got a C
>> compiler for a PC, one of my first projects was to try to read an OS-9
>> disk.  I was never able to get the transfer to work right.  (On the
[massive deletion]
> 
>I have since (read the pax doc) found that that is how other people set
>the density - have a blank disk formatted with dos at the correct density,
>do a dir on it THEN use the drive as you see fit.  It works.
> 
>



Anybody had any success with TRS80 Mod I DSDD (360K) disks? The sectors are 
all numbered differently than MSDOS.

Specifically, I'd like to be able to read NEWDOS 80 v2 disks.

Anyone?


Thanks,
___Samuel___
goldstein@aerospace.aero.org