Well, I wish to report that this thing has been cracked, and
successfully copied. I have learned a lot, and have a much greater
insight into floppies now. Many thanks to all who bent their minds to
this, and especially to Alain Knaff <[EMAIL PROTECTED]> who basically
sorted this out on his own. What follows is the (LONG) details. Delete
if you don't have an interest.

_______________________________________________________________________________________

        The thing transpired to be an 800k disk, with 80 tracks each side
having 5 1024 Byte sectors on each track. Tracks were numbered 0-79, and
sectors 1-5. How the directory addressed the sectors I haven't figured,
but I have directory clusters and data clusters saved off, and an 800k
file of both sides of the bootup disk of the thing, which I will forward
to anyone who wishes to have a look at them. Just let me know
mailto:[EMAIL PROTECTED] if you want the directories, or the lot. It
appears to be a CP/M like system, maybe even a subset of CP/M commands.
The system disk has a number of .com files. The main processor is a Z80.

Ian on the Linux Laptop list gave me a url for the fdutils which won the
day.

All contributions from the CHIPDIR list proved to be cul-de-sacs - Sorry
lads, but it's true. Dos has 512 byte sectors indelibly engraved on it.
There is the DRIVPARM command for Dos6 (Which I curiously enough
discovered on a LINUX site!). The format is 

DRIVPARM=/D<number> {/C] /F:<factor> /H:<heads> [/I:] [/N:] /S:<sectors>
/T:<tracks> with the following meanings
/D: the drive number (A:=0, B:=1, etc)
/C: Can detect door closed
/F: factor 0=360k, 1=1.2M, 2=720k, 5=HD, 6=Tape, 7=1.44M., 8=optical
disk, 9= 2.88M
/h: heads
/I: 1.44M compatible
/N: non removable
/S; sectors per track (512 byte sectors ONLY)
/t:tracks

Each formatted floppy has a sector,with  start & finish bytes, a gap(at
least one byte but usually more) and more sectors. Norton's diskedit/m
and other good ideas fell over because of the sector size. It caused it
to guess wrong, and end up reading the wrong places on the floppy
looking for start & finish bytes - hence the 'sector not found' errors.
Even when I had the system sort of cracked I came back to Dos to see if
I could set it up, but I couldn't.

Linux has a great advantages:

1. You can e-mail the guy on the help file and HE WILL ANSWER! fancy
e-mailing Microsoft or Symantec about this ;-)

2. It has fewer preconceived ideas about how the universe is. The
universe as Linux knows it is described in about 10,000 script files
which tell it all it needs to know. You can hack these and change the
universe :-) 

I won't bore you with the details of my innefficiency making them, or
failing to patch them properly, etc. Let's hust say suffering was
involved.

>  The most useful program for this kind of situation is fdrawcmd.  It
> allows to issue raw floppy controller commands.  I recommend that you
> use the most recent fdutils (5.2) with the most recent patch (2805),
> as some earlyer versions may have bugs which make some of the
> following tests fail without reason.
> 
>  First, you need to find out the data transfer rate (roughly the
> density: high, double, single).
> 
>  For this, you try out fdrawcmd readid 0 rate=x, where x is 0, 1, 2, 3
> If no rate is supplied, fdrawcmd assumes rate=0
> 
> Example:
> > fdrawcmd readid 0 rate=0 need_seek track=0
> 0: 0
> 1: 0
> 2: 0
> 3: 0
> 4: 0
> 5: 1
> 6: 2
> disk change
> 
> The first 3 output bytes are error codes.  The first byte should be
> below 7 (i.e. the example above succeeded).  The last four bytes is a
> sector header.  Byte 3 is the cylinder (here: 0), byte 4 is the head
> (here: 0). Byte 5 is the sector number (here: 1) of the sector which
> happened to be near the R/W head when the command was issued.  Byte 6
> is the sector size code.  Size code 0 means 128 bytes per sector, size
> code 1 means 256 bytes per sector, size code 2 means 512 bytes per
> sector, etc (i.e. size doubles with each increment).
> 
>  So, you try out all 4 rates until you get one that succeeds (byte 0
> <= 7).  If none matches, try adding the FM keyword (to use FM coding
> instead of MFM).
> 
>  Example: fdrawcmd readid 0 rate=0 fm need_seek track=0
> 
>Excellent! <fdrawcmd readid 0 rate=2 need_seek track=0> gave the result
>0:0
>1:0
>2:0
>3:0
>4:0
>5:1
>6:3 
> 


>  Next we have to find out if the disk is double sided or single sided:
> 
> > fdrawcmd readid 4 rate=x fm need_seek track=0
> 
>  The 4 means to check the other head.  If you get output such as the
> following, then it is ok:
> 
> > fdrawcmd readid 4 rate=0 need_seek track=0
> 0: 4
> 1: 0
> 2: 0
> 3: 0
> 4: 1
> 5: 2
> 6: 2
> disk change
> 
>  If byte 4 is greater than 7, we have an error, and the disk is
> probably single sided.  However, there are some weird formats in
> existence which use a different density at the second side and on the
> following cylinders.  So, in case of failure, it might be worthwhile
> to try out all 8 combinations too.
> 
>  Next, let's find out whether cylinders are doublespaced or not.
> Especially, on older drives, the head had to be moved by two physical
> cylinders instead of 1 logical cylinder.
> 
>  For this, seek to physical cylinder 2, and do again a readid.
> 
> > fdrawcmd readid 4 rate=0 need_seek track=2
> 0: 4
> 1: 0
> 2: 0
> 3: 2
> 4: 1
> 5: 7
> 6: 2
> no disk change
> 
>  Carefully watch byte 3 (logical cylinder).  If this is 1, then we
> have a disk with only one logical track per two physical tracks.  This 
> is for instance the case with double density 5 1/4 disks.  If on the
> other hand byte 3 is 2, then we have a normal disk, where one logical
> track corresponds exactly to one physical track.  Let's call this
> a disk with 'doublespaced track'

>  Same exercise with the number of cylinders.  Seek to track 81, 80,
> 79, 78, 77 until you can read the track.  Use the rate/fm combination
> from track 2: no nead to try out all 8 combinations here, it is very
> rare that density changes again after the first track. N.B. If you
> have a disk with double spaced tracks, try only the even numbers:

>It has tracks 0-79 on each side (of a 3.5" double density disk)with one
>logical track per physical track. This all went smoothly.

In attempting to discover the sector numbering scheme, I never got off
the ground. My hard disk did, but I didn't. I got the commands, entered
them and my pc freaked. But by watching byte 5 on the readid command
above, I decided there were only 5 sectors per track. For others,
fdrawcmd can read sectors.

>  Unformatted double density disks have a capacity of 6250 bytes, which
> is close enough.  In any case, this is enough to house 5 sectors of
> 1024 bytes each. Each sector takes up at least its contents (6250
> bytes), plus the header (62 bytes), plus the gap (variable in size,
> but minimum one byte).  That would be 5*(1024+62+1) = 5435 bytes in
> total, which is less than 6250.
> 

SETFDPRM allows you to use the data in /etc/fdprm (attached) to use all
sort of wierd and wonderful formats. For Dos users on, say, a 720K disk
there are 1,000,000 bytes. 9 sectors of 512 bytes gives 4608 bytes. I
invented the bottom line, which Alain patiently corrected, and BINGO! I
could put in one of these disks, type 

setfdprm /dev/fd0 400/400 

and read the thing with dd. The odd feature is that the first two
figures are expressed in 512 byte sectors, and they had to be doubled
for 1024 byte sectors.
dd if=/dev/fd0 of=image.disk bs=1024 count=800 (Thanks for the syntax
Alain) read the whole disk to the file image.disk, and swopping the 'if'
and 'of' info gave me another copy - which worked!
-- 
       Regards

       Declan Moriarty.
# /etc/fdprm  -  floppy disk parameter table

# Common disk formats. Names are of the form
#  actual media capacity/maximum drive capacity
# (Note: although 5.25" HD drives can format disks at 1.44M, they're listed
#        as 1200 because that's the common maximum size.)

#               size sec/t hds trk stre gap  rate spec1 fmt_gap
360/360          720     9   2  40    0 0x2A 0x02 0xDF     0x50
1200/1200       2400    15   2  80    0 0x1B 0x00 0xDF     0x54
360/720          720     9   2  40    1 0x2A 0x02 0xDF     0x50
720/720         1440     9   2  80    0 0x2A 0x02 0xDF     0x50
720/1440        1440     9   2  80    0 0x2A 0x02 0xDF     0x50
360/1200         720     9   2  40    1 0x23 0x01 0xDF     0x50
720/1200        1440     9   2  80    0 0x23 0x01 0xDF     0x50
1440/1440       2880    18   2  80    0 0x1B 0x00 0xCF     0x6C

# Non-standard disk formats:

# BEWARE: They're incomplete and possibly incorrect. The only reason why
#         they are in this file is to show how such formats are added.

1440/1200       2880    18   2  80    0 ???? ???? ????     ???? # ?????
1680/1440       3360    21   2  80    0 0x0C 0x00 0xCF     0x6C # ?????

# Add user-specific formats here
400/400         1600    10   2   80   0 0x2A 0X0A  0X00     0X52


Reply via email to