


dmk2cw(1)                                               dmk2cw(1)


Name
       dmk2cw  -  Write  a DMK floppy disk image file onto a disk
       using a Catweasel controller

Syntax
       dmk2cw [options] filename.dmk

Description
       The dmk2cw program uses  the  Catweasel  universal  floppy
       disk  controller to write a floppy disk image to an actual
       disk.  The image file is expected to be in the DMK  format
       first used by some TRS-80 Model I/III/4/4P emulators.  The
       image is exactly reproduced on disk, so far  as  possible,
       including  the  positioning and spacing of sectors and the
       content of gaps, so that  even  so-called  copy  protected
       disks  can  be  written  correctly  and should work on the
       hardware they were made for.  Currently, dmk2cw can  write
       all  formats  that  can  be written by the Western Digital
       177x/179x disk controllers used  in  the  original  TRS-80
       machine,  all  formats  that  can  be  written  by the NEC
       765-compatible floppy disk controllers used  in  PCs,  and
       the  Digital Equipment Corporation RX02 format.  Even for-
       mats that mix FM (single  density)  and  MFM  (double/high
       density) on the same track can be written.

       The dmk2cw program usually guesses the drive type and disk
       format to be written by measuring the rotational speed  of
       the  drive  (300 or 360 RPM) and checking the track length
       and other fields in the DMK file,  but  you  can  override
       this  with  command line arguments if needed.  The program
       does not automatically double-step if you  are  writing  a
       40-track  disk  in  an 80-track drive, however; see the -m
       flag for this.

       Versions of dmk2cw exist for both Linux  and  MS-DOS.   On
       Linux, dmk2cw must be run as root.  If the program is made
       setuid to root, it drops its root privileges as soon as it
       has  obtained access to the block of I/O ports it needs to
       directly access the Catweasel.  On Windows 95,  dmk2cw.exe
       can  be  run  in  an  MS-DOS Prompt box.  On plain MS-DOS,
       dmk2cw.exe requires a DPMI host to be loaded  first.   You
       can  obtain a suitable, free DPMI host from ftp://ftp.sim-
       tel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi4b.zip.
       Unzip  this file and follow the simple instructions before
       running dmk2cw.

       dmk2cw accesses the hardware directly, so it must  not  be
       used at the same time as any other Catweasel software.  In
       particular,  on  Linux,  do  not  load  Michael   Krause's
       "cwfloppy"  driver at the same time, and on MS-DOS, do not
       load the "catbase" driver that comes with the Catweasel.

       For more information about the  Catweasel  controller  and
       other software that works with it, see:
           http://www.jschoenfeld.com/
           http://apd2.tripod.com/catweasl.htm
           http://www.soundtracker.org/raw/

       For  information  about the DMK file format and the emula-
       tors that use it, see:
           http://discover-net.net/~dmkeil/
           http://www.tim-mann.org/xtrs.html

Options
       -p port
          ----
              Set the Catweasel I/O port base.   The  default  is
              the factory setting, 0x320.

       -d drive
          -----
              Specify the drive unit number, 0 or 1.  Default: 0.

       -v verbosity
          ---------
              Specify how much output is printed.  Larger numbers
              select more output.  The default setting is 2.

              0      No output.

              1      Print progress information.

              2      Also dump the bytes being written, prefixing
                     each with the encoding used.  This option is
                     primarily  for debugging purposes.  The pre-
                     fixes used are as  follows:  "-"  means  the
                     byte  is  skipped (it was padding in the DMK
                     file), "F" encoded as FM data,  "I"  encoded
                     as  an FM index address mark, "A" encoded as
                     an FM data address mark or ID address  mark,
                     "M"  encoded  as MFM data, "J" encoded as an
                     MFM pre-index address mark, "B"  as  an  MFM
                     pre-data  or pre-ID address mark, and "X" as
                     RX02-modified MFM data.

              3      Like 2, but also dump the Catweasel  samples
                     generated  for  each  byte.   This option is
                     primarily for debugging purposes.

       -k kind
          ----
              Specify the type of drive and type of media in use.
              This  option  is usually not needed, as dmk2cw will
              typically guess correctly.

              1      5.25" SD/DD disk in 1.2MB drive

              2      5.25" SD/DD disk in  360KB/720KB  drive,  or
                     3.5" SD/DD disk

              3      5.25" HD disk, or 8" SD/DD disk

              4      3.5" HD disk

       -m steps
          -----
              Step multiplier, 1 or 2.  A step multiplier of 2 is
              used when writing a 40-track (or 35-track) disk  in
              an  80-track  drive.   Default: 1.  If you set -m2,
              you should bulk-erase the media first to  eliminate
              residual magnetization from the odd numbered tracks
              that may cause problems when the disk is read in  a
              40-track drive.

       The  remaining  options  usually do not need to be changed
       from their default values.

       -c clock
          -----
              Catweasel sample rate.  0 selects fast (14.161 MHz;
              period  about  70  ns);  1 selects slow (7.080 MHz;
              period about 140 ns).  Default: 0.

       -o precomp
          -------
              Specifies the number of nanoseconds to  advance  or
              retard  transitions for write precompensation.  The
              actual  distance  between  transitions  is   always
              rounded to a multiple of the Catweasel clock period
              (-c option), so it is pointless to make adjustments
              much finer than that value.  Default: 140 ns.

              Exactly  what  does  this  option do?  The magnetic
              flux transitions on a  floppy  disk  tend  to  move
              slightly  farther  apart  if they are recorded very
              close together, thus lengthening the  short  inter-
              vals  and  shortening  the  long ones, a phenomenon
              sometimes called  bit-shifting.   When  a  disk  is
              recorded,  the  disk  controller ordinarily applies
              write precompensation to reduce this  effect;  that
              is,  it  makes  the short intervals extra short and
              the long ones correspondingly longer, especially on
              the   inner,   higher-numbered  tracks.   Currently
              dmk2cw uses a  very  simple  write  precompensation
              algorithm  that  is  not dependent on track number.
              If the shortest legal interval appears  immediately
              to the left (right) of a longer one, the flux tran-
              sition between them is moved to the left (right) by
              precomp Catweasel clocks.

       -h hd  Set  the HD line on the floppy bus to the indicated
          --
              value.  If hd=2 (the default),  the  value  is  set
              according to the disk kind (see -k flag).

       -g ign Causes  dmk2cw to ignore the first ign bytes in the
          ---
              DMK image of each track.  If ign  is  negative,  an
              extra  -ign  bytes  of  padding are inserted at the
              beginning of each track.

       -i ipos
          ----
              If this option is given, dmk2cw  forces  the  first
              IAM  (index address mark) encountered on each track
              to be exactly ipos bytes from the physical start of
              the  track,  by ignoring bytes or adding padding at
              the start of the track as with the  -g  flag.   The
              default is -1, which disables this feature, instead
              recording the gap exactly as in  the  image.   Note
              that  if  you set ipos too small, there will not be
              enough bytes in the initial gap for the IAM  to  be
              recognized when the disk is read.

       -y testmode
          --------
              Set  various undocumented test modes for debugging.

Diagnostics
       dmk2cw: Error reading from DMK file!
              The DMK file was opened successfully,  but  a  read
              from it failed.

       dmk2cw: No access to I/O ports!
              On  Linux, dmk2cw must be made setuid to root or be
              run as root, or it will not be able to  access  the
              Catweasel's  I/O  ports and this error message will
              appear.

       dmk2cw: Failed to detect Catweasel!
              A Catweasel card was not detected at the  specified
              I/O ports.

       dmk2cw: Failed to detect drive!
              The   specified  drive  (see  -d  option)  was  not
              detected.  Cabling and drive selection can be  con-
              fusing, so try the other drive number before giving
              up, especially  if  you  saw  some  drive  activity
              before this message was printed.

       dmk2cw: Disk is write-protected!
              This  message  usually  means what it says.  A 3.5"
              disk should have its write-enable slider closed.  A
              5.25" disk should not have a write-protect tab cov-
              ering its notch.  An 8" disk should have  a  write-
              enable  tab  covering  the  appropriate  notch.  It
              might also appear in some cases if the drive is not
              connected  properly,  the  door  is not closed, the
              disk is inserted upside-down, etc.

       dmk2cw: Failed to guess drive kind; use -k
              This message is printed if  drive/media  autodetec-
              tion  fails.   Either  the drive speed could not be
              measured, or the track length was not  one  of  the
              common  values  used  in  most  DMK files.  You can
              specify the kind of drive and media in use with the
              -k flag.

       dmk2cw: No disk in drive!
              This message usually means what it says, that there
              is no disk in the drive.  It might also  appear  in
              some  cases if the drive is not connected properly,
              the door  is  not  closed,  the  disk  is  inserted
              upside-down, etc.

       dmk2cw: Write error!
              Either  the  drive  reported  that it was not ready
              when the Catweasel tried to  write  to  it,  or  no
              index  hole  was  detected.   This  message usually
              means that there is no disk in the drive.  It might
              also  appear in some cases if the drive is not con-
              nected properly, the door is not closed,  the  disk
              is inserted upside-down, etc.

Authors
       dmk2cw was written by Timothy Mann <tim@tim-mann.org>.  It
       uses  low-level  Catweasel  access  routines  written   by
       Michael  Krause.   dmk2cw is free software, released under
       the GNU General Public License.  Thanks to Jens Schoenfeld
       for  providing  documentation on programming the Catweasel
       hardware.  Thanks to David Keil for  designing  and  docu-
       menting the DMK file format for floppy disk images.

       $Id: dmk2cw.man,v 1.3 2001/08/30 06:42:02 mann Exp $




                                                                1










