
                             TRACKSALVE

    TrackSalve is made to improve the Trackdisk device.  TD has some
    problems and lacks some options.  As far as I know there are three bugs,
    from which one is very bad if more than one drive is connected.
    SetPatch 1.3.2 tries to do something about it, but it is not enough.
    There are people who do not like the sound of an empty drive.  Trackdisk
    cannot handle a track with an error on it.  Then all data on that track
    is lost.  We never know whether the just written data is well stored on
    disk.  Some programs do not switch off the motor.  And yet we are poking
    in Trackdisk, we can just as well make a drive optional readonly.


                             FUNCTIONS

    As already stated, TrackSalve can perform six functions:

 1. Standard modification of Trackdisk existing of:  Bugs patched.  The
    patch of the bugs (as far as I know them). These are the
    TD_RAWREAD/TD_RAWWRITE bug and the NoDisk routine (oef!). Now it is save
    to do I/O on one drive and let all your other drives empty.  Write to
    protected disk returns an error, and leaves the unit undisturbed.
    Prewrite mfm update.  Before a track is written back to disk, all timing
    bits are validated again.  This is to prevent the declining of never
    updated sectors on much used tracks.  New coding routines.  Now it is
    possible to use fast memory to do I/O.  This has no obvious function
    now, but imagine the effects when adopted by Commodore and the
    Filesystem with AddBuffers.  If you have fast memory, you can use the
    FastFileBuffer program to change the buffertype.

 2. Noclick.  Can be switched on and off for each drive apart.  I think the
    situation is as follows:  Some drives have an electrical switch at the
    home position to prevent stepping below zero.  Other types have a
    mechanical stop.  These you cannot get completely silent.  I think it
    is save to use noclick on the first.  For those with a mechanical stop
    I would not switch noclick on.

 3. Readonly simulation.  Each drive can act as if the tab of the inserted
    disk is open.  This is not as simple as it sounds.  The FileSystem
    (DOS) keeps track of disk swapping.  And it asumes that you are not
    able to shift the tab while a disk is in the drive.  Therefore IF there
    is a disk in the drive AND its tab is closed (write-enabled), and the
    drive is swithed over to read-only or read/write, a DiskChange is sent
    out.  This is very unfriendly during a write, so this is delayed until
    the motor is switched off.  Nevertheless, switch a drive from r/w to ro
    or back only when it is quiet.

 4. TrackSalvage.  If Trackdisk gives up on a track, this function (if
    enabled) comes to action.  The track is read again and analised.  All
    unsuspicious data is recovered and stored in Trackdisk's buffers.  If
    the requested data is recovered, no error is passed to the calling
    task.  But an attempt to write to this track is denied and results into
    a diskerror.  So faulting tracks are readonly.

 5. Verify.  TrackSalve can read back a just written track to check whether
    the data well arrived on disk.  It reads the track into a special
    buffer which is compared with the original write buffer.  Since the
    Amiga is multitasking, it is not possible to know which task should be
    notified about an error.  Therefore it is the user who must decide
    about this.  He can choose between rewrite and ignore.  Rewrite writes
    the original buffer again to disk, and ignore as if we never knew about
    the bad track.  It may be that subsequent rewrites does not lead to a
    good result.  At least the fact is known that something is wrong.  It
    is possible to read-retry by repeating the command:  v read only once,
    vv twice and vvv triple, subsequent v's are ignored.  Multiple reads
    for verify may be useful for usage with very bad drives.

 6. Auto update.  The write to disk is delayed until the trackbuffer is
    needed for another track or until an update command is received.  The
    motor also keeps running until a motor off command is received.
    TrackSalve can both do by itself if this function is enabled.  It is
    delayed for about five seconds, that is, the track is updated five
    seconds after the last write command.  The motor is switched off five
    seconds after the last disk access.  Especially Sectorama (which was
    intended for harddisks) will be helped with this function.  But there
    are more. (Diskcopy:  try to diskcopy to a write protected disk).


                                COMMANDLINE

    If anywhere on the command line one of the chars h, H, or ? are found,
    the whole command line is ignored and nothing is done but a small usage
    explanation is printed:

    Syntax: TrackSalve  {[!]<unit>|a {<unit>} {<Command>}}
    Function: Modify a Trackdisk device unit addressed by its unit number
     <no args>         Show present status
    Units:
     0-3   Unit(s)     Succeeding commands are applied to listed units
      a    All         Succeeding commands are applied to all TD units
      !    Warning     Suppress error if the following unit does not exist
    Commands:
    <none> TD in RAM   No special functions (.=default), improved reliability
      o    Original    Let TD execute in its original ROM code
      s    SectorDisk  Let Trackdisk only give errors from bad sectors
      t   .TrackDisk   Normal: Let TD give errors from bad tracks
      n    NoClick     Perform noclick on the unit(s)
      c   .Click       Normal: No noclick
      r    ReadOnly    Make unit read-only, simulate open disk-tab
      w   .WriteEnable Normal: Unit is read/write according to disk-tab
      v    Verify      Read written track back and compare (vv, vvv)
      b   .Believe     Normal: Asume track is written well
      u    Update      Flush track and stop motor after 5 sec idling
      e   .ExtUpdate   Normal: External update and motor off
      /    Separator   E.g. "0/2n"  Units 0 and 2 in RAM, noclick only on 2
     h ?   Explain     If given (anywhere), no commands are executed

    Comma's, spaces and dashes are completly ignored.  Characters which are
    not defined lead to an abortion of the program without executing any
    function.  This will be emphasised by a message via standard out.
    Abortion always has a return value of 20.

    Units

    You must address an unit by its number instead of its DOS-name.  This
    is because we are modifying an Exec-device and not a DOS-device.  This
    device has nothing to do with DOS.  DOS uses it, and builds a system
    around it.  The name of this system is for example "DF0:". Valid
    numbers are 0, 1, 2, 3, a and A or any combination of them. 'A' means
    all units.  Commands are single characters.  Before you give a command
    you must specify one or more units to apply the command to.  A command
    will be passed to all directly preceding listed units.  If a unit is
    given that does not exist, then this is an error and nothing will be
    done at all.  It can come handy if it is possible to give a unit that
    does not exist.  Normal would be aborted with return code 20.  But if
    a '!' is put before a possible non-existing unit, a message is printed
    and the program continues normally, but returns 5.

    Commands

    Just a list of units and no commands results in the execution of
    Trackdisk in RAM with repaired bugs. "TrackSalve a" or "TrackSalve
    023". Commands are applied only to preceding units.  F.e. TrackSalve
    01n lets units 0 and 1 stop clicking.  Now you can add new unit numbers
    like:  TrackSalve 01n2r1s.  This results into noclick on units 0 and 1,
    unit is 2 readonly and unit can salve tracks.  It is also possible to
    give contradictory commands:  TrackSalve an1c lets all units except 1
    noclicking.  The separator '/' is a donoting command or "unit list
    reset". TrackSalve 012/2n lets the units 0, 1 and 2 execute in ram, but
    noclick is only performed by unit 2. Reset to a defined state can be
    done by TrackSalve ao followed by the new state.  TrackSalve without
    any parameters prints the present situation and changes nothing.


                              HOW TO USE IT

    Although Disksalv works well without, both programs work very well
    together.  Disksalv with TrackSalve will generally operate faster and
    more clearly.  It also is possible (not yet happened) that the
    combination can salve more data.  Sometimes only one file is the effort
    of salvage worthy, like the latest modification not yet on a backup.
    Now there is a chance that the file can be saved with copy.  Might save
    some time.  Then it is possible that immediately after disk insertion a
    requester appears with "unreadable" and "diskdoctor" or so.  There is a
    fair chance that with TrackSalve these requesters stay away and the
    disk will be accepted as a DOS disk.  You can do more in that case.


                             IMPLEMENTATION

    The Trackdisk code will be copied from the operating system program and
    modified and extended.  For each unit apart, the unit task can execute
    this code or stay with the original in ROM.  If a unit cannot be brought
    to execute the patched code, this is told in a message on standard out
    and the program will continue normally but its return value will be 10.
    There are two functions which use a buffer of about 26k.  If not
    available at the moment of enabling, every .5 second this is tried to
    allocate again.  Until the allocation is successful, the function
    becomes not active.  This is reported through a message and the return
    value will be 10. Execute TrackSalve without parameters to be sure the
    function became active.  This buffer is shared among all tasks.
    Normally this will work smoothly and without delay except when a
    requester is displayed.  The requester is used when a verify error has
    been detected.  If for some reason it is not possible to pop up a
    requester, TrackSalve will loop rewriting the track and blink the
    drive's led until the conditions have changed.  These are:

    1. The disk is removed.
    2. The track is found well on disk.
    3. There is enough memory to display the requester.


                              PERFORMANCE

    The mfm revalidation costs some time.  It is not an exact value, but it
    will stay well under 2 procent.  The encoding routines and track
    maintenance became much faster because these can now ignore the timing
    bits.  Track verify takes a lot of time, but it is done very efficient
    this close to the object.  I measured an average increase of 30 procent.
    To get these results, I did a file level diskcopy of a 70 procent full
    disk to a duplicate.


                                HISTORY

    Version 1.0 had a guru 3 type bug, but the faulting code was (almost)
    never executed.  This version could be updated to 1.01 by a patch
    program PatchTS.
    Version 1.2 had multiple reads with verify implemented for users with
    very bad drives.
    Version 1.3 had mfm revalilidation adopted from Pcopy, new coding and
    decoding routines allowing fast buffers and auto update implemented.
    Also a write to a write protected disk is denied.  Verify comparision
    is now done by the blitter.  And a unit is more likely to be caught.


                               COPYRIGHT

    Copyright (c) 1990 D.W.Reisig.  This program may be distributed on
    non-commercial base.  This program may not be distibuted on commercial
    base without my permission.

    D.W.Reisig
    Woudweeren 10
    1151 AV  Broek in Waterland
    Holland
