
     messydisk.device()    Amiga Programmer's Manual     messydisk.device()



     1mSYNOPSYS 
          0m#include <exec/io.h>
          #include <devices/trackdisk.h>
          #include <dev.h>

          OpenDevice("messydisk.device", Unit, IOExtTD, Flags);
          BeginIO(IOExtTD);
          CloseDevice(IOExtTD);

     1mUSAGE 
          0mMessydisk.device  can  be  used instead of trackdisk.device.
          All current trackdisk.device commands are  supported.    The
          only  functional difference is the format of the disk, which
          is compatible with messydos systems.  

     1mCOMMANDS 
          0mSupported commands are: 

          = CMD_INVALID     = CMD_RESET       * CMD_READ
          * CMD_WRITE       * CMD_UPDATE      = CMD_CLEAR
          = CMD_STOP        = CMD_START       = CMD_FLUSH
            TD_MOTOR        = TD_SEEK         * TD_FORMAT
            TD_REMOVE         TD_CHANGENUM      TD_CHANGESTATE
            TD_PROTSTATUS     TD_RAWREAD        TD_RAWWRITE
            TD_GETDRIVETYPE   TD_GETNUMTRACKS = TD_ADDCHANGEINT
          = TD_REMCHANGEINT * ETD_WRITE       * ETD_READ
            ETD_MOTOR       = ETD_SEEK        * ETD_FORMAT
          * ETD_UPDATE      = ETD_CLEAR         ETD_RAWREAD
            ETD_RAWWRITE

          The commands marked with * are handled in its own format  by
          messydisk.   The  commands  marked  with  =  are  handled by
          messydisk in the same way as trackdisk supposed  is  to  do.
          The  other  commands  are sent straight through to trackdisk
          and are subject to all its flaws and features.  
          The extended commands support the disk  change  count  only.
          The  sector  label pointer (iotd_SecLabel) is ignored, since
          messy formatted disks don't have any label areas.  

     1mOPENDEVICE FLAGS 
          0mTDF_ALLOW_NON_3_5: Allows opening 40 track drives.  Ignored,
          since it is the default behaviour which cannot be disabled.  

     1mIO REQUEST FLAGS 
          0mThe io_Flags field of an IOStdReq or IOExtTD  structure  may
          contain the following flags: 

          IOF_QUICK: This flag is supported for only a few commands.  

          IOTDF_INDEXSYNC: For ETD/CMD_RAWREAD and _WRITE.  

          IOMDF_40TRACKS:  This  flag  is  for  ETD/CMD_READ,  _WRITE,
          _FORMAT, and _SEEK.  If set, treat the disk as  40  cylinder
          media.   If  it happens to be in an 80 cylinder drive, every
          other cylinder will be skipped to use the same  cylinders  a
          40-cylinder drive  would.    Normally  you set or clear this
          flag once at the time you read the bootblock and examine its


     Rhialto, KosmoSoft               -1-                 Version 34.8/1.30


     messydisk.device()    Amiga Programmer's Manual     messydisk.device()


          layout information.  It is guaranteed that  messydisk  won't
          change this  flag.    IOMDF_40TRACKS  is  not  supported for
          ETD/TD_RAWREAD and _RAWWRITE, since these are considered  to
          be  "diagnostic" functions and therefore should be as raw as
          possible.  

     1mDISK FORMAT 
          0mThe disk format used is compatible  with  messydos  systems.
          Both 40  and  80  cylinder  media  are supported.  There are
          normally 9 sectors per track and two  tracks  per  cylinder.
          (Outdated)  single-sided  disks  can  only  be  read  if the
          driving  software  is  prepared  to  treat  them  as  normal
          double-sided disks, and skip the sides that are not actually
          present.  On the other hand, the number of sectors per track
          may vary from 8 to 10. If the number of sectors is different
          from  the  default value (9), then track 0 on side 0 must be
          read first before this is recognized.  It  is  then  assumed
          that  all  tracks on the entire disk have the same number of
          sectors.  So, all position calculations  are  based  on  the
          layout of the very first track.  

          --- Index pulse  ------------------------------------.
                                                               |
              40 * $4e    GAP 1A  ($9254 encoded)              |
              12 * $00            ($AAAA encoded)              |
               3 * $c2    SYNC    ($5224 encoded)              |
               1 * $fc    index mark           ($5552)         |
                                                               |
              40 * $4e    GAP 1B  ($9254 encoded)              |
                                                               |
          --- First Sector -----------------------------.      |
                                                        |      |
              12 * $00    GAP 2   ($AAAA encoded)       |      |
           |   3 * $a1    SYNC    ($4489 encoded)       |      |
           |                                            |      |
           |   1 * $fe    ID-Address Mark   -. ($5554)  |      |
           |  track                          |          |      |
           |  side                           |          |      |
           |  sector                          > ID      |      |
           |  length (0=128,1=256,2=512 etc.)|  Field   |  S   |
           -> CRC 1                          |          |  e   |  T
           -> CRC 2                         -'          |  c   |  r
                                                         > t    > a
              22 * $4e    GAP 3A  ($9254 encoded)       |  o   |  c
              12 * $00    GAP 3B  ($AAAA encoded)       |  r   |  k
           |   3 * $a1    SYNC    ($4489 encoded)       |      |
           |                                            |      |
           |   1 * $fb    DATA-Adress Mark  -. ($5545)  |      |
           |  512 bytes data                  > DATA    |      |
           -> CRC 1                          |  Field   |      |
           -> CRC 2                         -'          |      |
                                                        |      |
              78 * $4e    GAP 4   ($9254 encoded)       |      |
           or 40 * $4e    GAP 4   ($9254 encoded)       |      |
          ----------------------------------------------'      |
                                                               |




     Rhialto, KosmoSoft               -2-                 Version 34.8/1.30


     messydisk.device()    Amiga Programmer's Manual     messydisk.device()


           ...... 8 or 9 more sectors .......                  |
                                                               |
              rest  $4e up to 6250 bytes       ($9254)         |
          -----------------------------------------------------'

     1mDEVIATIONS 
          0mThe TD_REMCHANGEINT command works.  (It doesn't with the 1.2
          or 1.3 trackdisk.device).  

          The   messydisk   Unit   structure   does   not   look  like
          TDU_PublicUnit at all.  

          In some situations, error returns may be different  or  less
          specific.  

          Data  buffers  to be read or written currently don't need to
          be in Chip memory.  This might change in the  future.    For
          future  compatibility  and  with  the  trackdisk.device  you
          should not depend on this.  

          In order to be able to format a  track  with  a  nonstandard
          number of sectors (from 8 to 10), you must use the TD_FORMAT
          command  with  less than 40 sectors (20480 bytes) at a time.
          (If you whish to format tracks with less than 8 sectors, you
          can only do this one track at a time.) Since you must always
          format entire tracks at a time, this uniquely determines the
          number of sectors you want  on  each  track.    The  current
          number  of  sectors per track, which will be used later when
          reading from the same disk, is updated accordingly.  If  you
          specify  40  sectors  or  more,  messydisk.device  does  not
          attempt to guess what you want but  simply  uses  the  value
          that was  already set.  So, you may choose to first format a
          single track to indicate the desired number of  sectors  per
          track,  and  then  in one call format the entire rest of the
          disk.  

          When a disk with more or less than 9 sectors  per  track  is
          read,  you must first issue a CMD_READ command for the first
          sector(s) of  the   disk.      When   track   0   is   read,
          messydisk.device  determines how many sectors there are on a
          track.  This number is then used afterwards when calculating
          the tracks and sides of other sectors.   So,  this  is  very
          important.  But for those (virtually impossible) cases where
          not  all tracks have the same number of sectors, all sectors
          (up to the maximum supported) that were read  on  any  track
          will be written back.  Fortunately, all currently known file
          systems  have  a  bootblock  at track 0, side 0, so they all
          adapt transparently.  

     1mCAVEATS 
          0mThe (outdated) TD_REMOVE command is routed to trackdisk.  As
          a result of this, only one disk remove interrupt (per  unit)
          may  be  installed  (with  this  command),  whether  through
          trackdisk or messydisk.    (This  seems  to  have  been  the
          original   intention   of  TD_REMOVE.)  Of  course,  current
          programs should use TD_ADDCHANGEINT.  




     Rhialto, KosmoSoft               -3-                 Version 34.8/1.30


     messydisk.device()    Amiga Programmer's Manual     messydisk.device()


     1mUTILITIES 
          0mA separate program called  Ignore  is  supplied,  which  may
          suppress the CRC check in any currently open unit.  When the
          unit is definitively closed and later reopened, ignoring CRC
          mismatches again has its default value of No.  

          Usage: ignore <unitnr> <YES/NO>

          If  you only give the unit number, ignore will output either
          Yes or No, reflecting whether CRC mismatches  currently  are
          ignored.  

          This  program  can  be  useful when you wish to recover data
          from a damaged or marginal disk.  Sometimes text  files  may
          be usable even if there are a few errors in them.  

     1mAUTHORS 
          0mMessydisk  is written by 3mSourcerer 0mOlaf 3mRhialto 0mSeibert. The
          low-level  writing  part  was  originally  done  by   Werner
          Gόnther. Used with permission.  








































     Rhialto, KosmoSoft               -4-                 Version 34.8/1.30

