









                           Daves Data LINK
                               (DDLINK)





                                  A
                            Small & Simple

                                  PC
                        File Transfer Program

                              supporting
                        COM, LPT and Ethernet
                             connections















                            Dave Dunfield
                 https://dunfield.themindfactory.com



                                DDLINK

                          TABLE OF CONTENTS


                                                                    Page

1. INTRODUCTION                                                        1


2. COMMAND FUNCTION KEYS                                               2

   2.1 Main (split) screen                                             2
   2.2 A)ttr function                                                  2
   2.3 D)rive function                                                 2
   2.4 M)ulti-file function                                            2
   2.5 O)ption function                                                3
   2.6 V)iew function (ASCII mode)                                     3
   2.7 V)iew function (Hexidecimal mode)                               3
   2.8 String input                                                    3
   2.9 Yes/No prompts                                                  3
   2.10 Server mode                                                    3

3. INTERFACING TO ANOTHER PC                                           4

   3.1 Serial                                                          4
   3.2 Parallel                                                        5
   3.3 Network                                                         6
   3.4 Bootstrapping via serial port                                   6
   3.5 Making cables                                                   8
   3.6 Connection timeouts                                             8

4. AUTOMATION                                                          8


5. MISC. NOTES                                                         9

   5.1 Startup                                                         9
   5.2 Local operation                                                 9
   5.3 File attribute display                                          9
   5.4 Filename matching                                               9
   5.5 Switching directories                                           9
   5.6 Copying directories                                             9
   5.7 V= option                                                      10

6. DDLINK and WINDOWS                                                 11

   6.1 (*) Win64 and other OSs                                        11

7. COMMUNICATIONS INTERFACE                                           12

   7.1 Serial interface                                               12
   7.2 Parallel interface                                             12
   7.3 Network interface                                              13

DDLINK                                                 Table of Contents

                                                                    Page
   7.4 Link protocol                                                  14
   7.5 Command protocol                                               15
   7.6 DDLCMD.C                                                       19

8. DaveD Command Menu                                                 20

DDLINK                                                           Page: 1


1. INTRODUCTION

   Daves Data Link  (DDLINK)  is a utility which allows  you  to  easily
   transfer files  between  PCs  having  only  a  COM,  LPT  or  network
   connection.  It presents a menu interface showing a working directory
   on both PCs,  and provides simple commands to perform  the  following
   functions on either PC:

      Copy files or entire directory subtrees
      Delete files or entire directory subtrees
      Rename files or directories
      Set attribute/timestamp of files
      Create new directories
      Change to another directory
      View files in ASCII or HEX


    Use: DDLINK options

    opts:   /B[speed]       Bootstrap remote (via com)                  [9600]
            /M              force Monochrome video
            /S              Server mode
            B=128-4096      specify Blocksize                           [1024]
            C=1-4[,speed]   specify Com port                     [none,115200]
            E=1-255         cause server to End (errorlevel)            [none]
            K=keys          automate Keycodes                           [none]
            L=1-3|adde      specify Lpt port                            [none]
            P=[ii][,tttt]   specify Packet int,type               [60-80,DD11]
            T=factor        specify Timeout factor                         [5]
            V=n             override protocol Version                   [none]

   DDLINK communicates over COM  (serial),  LPT  (parallel)  or  network
   (ethernet)  interfaces.  (ethernet requires a  "packet driver"  - see
   below)

   DDLINK operates in two parts - the SERVER which runs on the  "remote"
   PC,  and the CLIENT which runs on the  "local"  PC.  All  interactive
   functions are performed from the CLIENT.  You should start the SERVER
   (/S) before starting the CLIENT (no /S).
    Server  E=  causes server to end AFTER one session  \ useful in
    Client              ""           immediately        / automated scripts

   DDLINK offers interactive help when  '?'  is  pressed  by  seemlessly
   chaining to DDLHLP.EXE. This file is NOT required by DDLINK ('?' just
   won't work)  - this means you only need to move DDLINL.COM to use  it
   on a new system!
DDLINK                                                           Page: 2


2. COMMAND FUNCTION KEYS

   2.1 Main (split) screen

        Up/Down     Move selection by 1 item
      PgUp/PgDn     Move selection by 22 items
     ^PgUp/^PgDn    Move selection by 100 items
      Home/End      Move selection to first/last item
      Left/Right    Switch to other computer/screen
          A         set hilighted file Attributes/timestamp
          C         Copy hilighted file or directory to other system
          D         select another disk Drive
          E         Erase (delete) hilighted file or directory
          M         Multi-file menu
          N         create a New directory
          O         set DDLINK Options
          R         Rename hilighted file or directory
          V         View hilighted file
        Enter       Move to hilighted directory
         Esc        Exit DDLINK

   2.2 A)ttr function

        Up/Left     Move to preceeding selection
      Down/Right    Move to next selection
      PgUp/PgDn     Adjust setting
        Enter       Accept and enter new values
         Esc        Quit and discard changes

   2.3 D)rive function

      Left/Right    Move selection
        Enter       Accept and enter new drive
         Esc        Quit and discard drive

   2.4 M)ulti-file function

        Up/Down     Move selection by 1 item
      PgUp/PgDn     Move selection by 22 items
     ^PgUp/^PgDn    Move selection by 100 items
      Home/End      Move selection to first/last item
         C          Copy selected items
         D          select all Directories
         E          Erase selected items
         F          select all Files
         N          select by Name          ('*' and '?' allowed)
         R          Refine selection by name    ('*' and '?' allowed)
         T          Toggle selection
         U          Unselect by name            ('*' and '?' allowed)
       Enter        position to first selected
        ESC         Exit multi-file menu
DDLINK                                                           Page: 3


   2.5 O)ption function

        Up/Dn       Move selection
      PgUp/PgDn     Toggle selection On(+)/Off(-)
        Enter       Accept and enter new options
         Esc        Quit and discard changes

   2.6 V)iew function (ASCII mode)

        Up/Down     Move display by one line
      PgUp/PgDn     Move display by 24 lines (one screen)
      Home/End      Move to first/last line
      Left/Right    Move display by one column
        ^Home       Reset to column 0
         F1         Switch to hexidecimal view
         Tab        Adjust tab stops (8-4-2)
       Esc/F10      Exit viewer

   2.7 V)iew function (Hexidecimal mode)

        Up/Down     Move display by 16 bytes
      PgUp/PgDn     Move display by 384 bytes (one screen)
      Home/End      Move to first/last line
      Left/Right    Move display by one column
        ^Home       Align column to 16 byte boundary
         F1         Switch to ASCII view
       Esc/F10      Exit viewer

   2.8 String input

      Left/Right    Move cursor by 1 position
      Home/End      Move to first/last position
      Backspace     Backup and delete character before cursor
         Del        Delete character under cursor
         Ins        Toggle insert mode
        PgUp        Clear entire field
        PgDn        Clear from cursor to end of field
       Enter        Accept and enter input
        Esc         Quit and discard input

   2.9 Yes/No prompts

      Enter/Y       Accept and proceed
        Esc/N       Quit and stop

   2.10 Server mode

        Esc         Stop server and exit
DDLINK                                                           Page: 4


3. INTERFACING TO ANOTHER PC

   3.1 Serial

      DDLIBK requires a "null modem" serial cable:

                  DB9-DB9   DB25-DB25   DB9-DB25
        -----------------------------------------------
        GND         5-5        7-7        5-7       GND  \
        RXD         2-3        3-2        2-2       TXD   > Always
        TXD         3-2        2-3        3-3       RXD  /
        DTR         4-6       20-6        4-6       DSR  \
        DSR         6-4        6-20       6-20      DTR   > DOS also needs
        RTS         7-8        4-5        7-5       CTS   >  (for /B only)
        CTS         8-7        5-4        8-4       RTS  /

        DDLINK uses the HARDWARE assignments for COM1-COM4:
             COM#   Addr     IRQ
               1    03F8      4
               2    02F8      3
               3    03E8      4
               4    02E8      3

      DOS uses mapping provided by BIOS,  which are the same  as  above,
      except that any uninstalled ports  "bump  up"  what  follows,  for
      example, in a system not having a physical COM2, The COM3 hardware
      device would be called COM2 by DOS.  When using  C=1-4,  you  must
      provide the hardware COM port number.  When  using  /B,  you  must
      select the DOS mapped COM port when prompted for the device to  be
      used on the other system.

      NOTE:  DDLINK doesn't care what the serial data is passing through
      as long as it's a "pure binary" connection.

      You could  (for example)  connect though a modem as  long  as  the
      speeds match, and all-bytes (00-FF) get through. You could use the
      included SDT (or any other TTY program)  to dial and establish the
      modem connection BEFORE running DDLINK.
DDLINK                                                           Page: 5


   3.2 Parallel

      DDLINK requires a "bidirectional data-transfer" parallel cable:

                 DB25-DB25
        ---------------------------
        GND        25-25        GND
        D0          2-15        ERROR   \
        D1          3-13        SLCT     > Must be wired
        D2          4-12        PE       > between  BOTH
        D3          5-10        ACK      > ends (two wires)
        D4          6-11        BUSY    /

      For L=1-3,  DDLINK uses the BIOS provided  LPT  mappings.  For  L=
      values greater then 3,  DDLINK uses the supplied address  directly
      (allowing you to use non-standard parallel ports). The standard PC
      parallel port addresses are:
         LPT1: 03BC
         LPT2: 0378
         LPT3: 0278

      You can use the included DDMODE.COM to view the addresses assigned
      to the LPT ports on your system if you wish.
DDLINK                                                           Page: 6


   3.3 Network

      The network interface is activated when the P= option is used - if
      you do not specify a packet driver  interrupt,  then  DDLINK  will
      scan the standard packet interrupts 60-80 and use  the  first  one
      which contains a packet driver. eg: DDLINK P=

      The network protocol uses raw ethernet packets (not IP) and is not
      routable through a gateway (local network only).

      If you wish to have multiple concurrent  DDLINK  sessions  on  the
      same network,  you must start the SERVER/CLIENTs  in  pairs.  Once
      connected,  client and server communicate  only  with  each  other
      until the client closes.

      Ethernet has a maximum packet payload size of 1500  bytes.  DDLINK
      has an overhead of 6 bytes per packet, so the maximum B= blocksize
      you can use over such a network is 1494 bytes - some networks  may
      enforce smaller packets.

   3.4 Bootstrapping via serial port

      To accomodate situations where you don't have an easy way  to  put
      DDLINK  onto  another  PC  (no  floppy  drive  etc.),  DDLINK  can
      bootstrap via a serial port,  use:  DDLINK /B C=1-4 on the host PC
      and follow the on-screen instructions.

      To use /B,  the only software  (other than DOS)  required  on  the
      target system is the MODE command to configure the serial  port  -
      If this is not available,  you may still be able to bootstrap -  I
      don't know if it is standard,  however most of my  PCs  initialize
      the serial ports to 2400,n,8,1 so I picked that as DDLINKs default
      bootstrap config.  You can force  different  bootstrap  speeds  by
      specifying the speed with the C= operand,  eg:  DDLINK /B C=1,1200
      The important thing is that the port be configured for 8-bits,  no
      parity.

      You may also be able to configure the serial port with DEBUG:
            -O 3FB,83           < COM1 shown, use:
            -O 3F8,30           < COM1: 3FB, 3F8, 3F9
            -O 3F9,0            < COM2: 2FB, 2F8, 2F9
            -O 3FB,3            < COM3: 3EB, 3E8, 3E9
            -O 3F9,0            < COM4: 2EB, 2E8, 2E9

      I have included DDMODE.COM,  a little utility that can be used  to
      configure the  serial  ports,  and  also  to  view  their  current
      configuration.  The '/H'  option can be used to configure/view via
      the hardware assignments, otherwise the BIOS/DOS mapping is used.

      Once the loader is transferred,  It operates the  serial  port  at
      9600...  This works on almost everything, but I have encountered a
      4.77mhz 8088 PC where DOS couldn't handle it - You can change this
      as a /B option, eg: /B4800
         (but DDLINK itself still worked fine at 115200)
DDLINK                                                           Page: 7


      3.4.1 FreeDos

         I have confirmed that this works well with several versions  of
         MicroSoft MS-DOS,  as well as IBM PC-DOS ...  but it  has  more
         trouble with FreeDos! Both MS-DOS and PC-DOS provide an "almost
         binary" transfer when you perforn:

                           COPY COMn: file

         In fact, the only character which can NOT be copied this way is
         0x1A (EOF which stops the copy).

         To be able to copy on a bootloader,  I only had to make sure it
         does not contain the byte value 0x1A.

         FreeDos  however  blocks  more   byte   values.   DDLINK   1.7+
         bootloaders have been modified to contain NONE of the ones I've
         (so far)  identified ...  and it does work *sometimes* if  done
         right after booting!

         I've not found /B to be reliable under FreeDos.

         If you have trouble using /B,  please use the information below
         to try and determine which bytes are being blocked and  contact
         me.



      These are the bytes I've observed that FreeDos blocks/corrupts:
        00 NULL             Often terminates strings
        03 Control-C        Console Interrupt
        0A Line-feed        \ probably related to 'newline'
        0D Return           / difference between DOS & UNIX
        11 XON              resume output  \ used in UNIX
        13 XOFF             suspent output / but not DOS
        1A EOF              Terminate file
      !There is no guarantee these won't change with new releases!

      These are the byte values DDLINK currently COPYs during bootstrap:
        04 05 0C 18 19 1E 1F 21 25 29-2D 31 33 34 37 38 3A-3C 46 47 4A 4B
        4F 51-55 57-5B 5E 5F 61 62 65 67-6B 6D-6F 73 75 80 81 83 85 87-8A
        8F 90 92-94 9D A2 A3 A6 A8-AC AE-B1 B3 BB C3 C7 C8 D0-D3 D6 DB
        DF E0 E2 E3 E8 EA EE EF F6 F8 FB FC FE

      3.4.2 Bootstrap via DEBUG

         If /B won't work with your DOS, try DBBS (DeBugBootStrap)

         If your debugger is not identical to MS DEBUG see:
            DBBS -?U and -?D

         To reduce size,  consider moving DDLCMD,  then using it to copy
         DDLINK.

         Also check out DMFT (DavesMinimalFileTransfer)
DDLINK                                                           Page: 8


   3.5 Making cables

      To help you make your own "null modem"  serial,  or "bidirectional
      data-transfer"  parallel cables,  I've included a couple of  tools
      which allow you to see and manipulate the individual  signals/pins
      on the interface ports:

            SDT.COM         Serial Debug Terminal
            PPDEBUG.COM     Parallel Port DEBUG

   3.6 Connection timeouts

      All communication is timed with the DOS 55ms "tick"  multiplied by
      the T= timeout factor[5] to get timeouts in multiples of 275ms.

      If you have problems with timeouts, try adjusting T=

4. AUTOMATION

   DDLINK was designed as an interactive tool,  however I have  received
   some requests for the capability to completely perform transfers from
   command line options (eg: in .BAT file)

   To at least partially accomodate this,  I have added  an  ability  to
   preset keys to be auto-entered at startup.

                 This is done with the option:   K=keys

                       where keys may contain:

            Any ASCII character             ( use ~~ for single ~ )
            ~u      Up          ~U  pgUp        ~N  eNter
            ~d      Down        ~D  pgDn        ~_  Space
            ~l      Left        ~h  Home
            ~r      Right       ~e  End         ~E  Escape


   To understand how this can work, consider a typical DDLINK session to
   get a file by name from a remote server:

        Right       switch to server
        M           enter Multi mode
        N           select by Name
        file.txt    name of file to transfer
        Enter       accept filename
        C           copy to local system
        Y           Yes to prompt
        Esc         exit DDLINK

   You could accomplish this within a BATCH file using a line like:

                   ddlink C=1 K=~rMNfile.txt~NCY~E
DDLINK                                                           Page: 9


5. MISC. NOTES

   5.1 Startup

      The DDLINK client expects to  be  able  to  communicate  with  the
      server as soon as it starts - you should always start  the  server
      BEFORE starting the client and stop the server AFTER  exiting  the
      client.

   5.2 Local operation

      DDLINK can be used without a remote server (no C=,  L= or P=),  in
      which case it acts between two directories on the local machine.

   5.3 File attribute display

      File attributes are displayed by hilighting part(s):
         Hilighted-Size = READ-ONLY
         Hilighted-Date = HIDDEN
         Hilighted-Time = SYSTEM

   5.4 Filename matching

      Filename matching uses "unix" pattern matching rules:
         * matches any string or substring
         ? matches any single character
         Any other characters must exactly match

      Note: *.* only matches filenames contain '.'! To match ALL, use: *

   5.5 Switching directories

      DDLINK starts in the current directories of both  PCs.  Note  that
      DOS does not allow you to delete the  current  directory,  so  you
      will not be able to delete the directory from  which  you  started
      (or any  directories  containing  it).  The  "Switch  directories"
      option causes DDLINK to 'CD' to directories as you move around, so
      that you can always delete things contained therein  (this is also
      a nice way to use DDLINK to  navigate  to  a  directory  and  stay
      there).

      NOTE that "Switch directories"  can be a little odd when DDLINK is
      operating in LOCAL mode on  the  same  drive  -  the  DOS  current
      directory will be one you selected LAST (in either window).

   5.6 Copying directories

      When  copying  a  directory  tree,  DDLINK  normally  creates  the
      subdirectories BEFORE copying the files in a given directory - the
      "Create dirs at end"  option can be used to cause DDLINK to create
      the subdirectories AFTER copying the files  (thereby  placing  the
      subdirectories at the end).

      When performing long operations,  such as copying large files  (or
      large sets of files),  deleting a large tree,  or indexing a large
      file to view  ...  you  can  use  ^C  (control-C)  to  cancel  the
      operation.
DDLINK                                                           Page: 10


   5.7 V= option

      To avoid potential communications problems with different versions
      of DDLINK,  a  (protocol-version)  number  is  transmitted  during
      LINK_INIT, which must exactly match, otherwise some newer features
      may not work!

      Such  changes  are  almost  always  small  additions,  and   basic
      transfers  will  usually  work.  To  make  it  easier  to   update
      DDLINK.COM over DDLINK,  the V=n option can be used to make either
      end "fake" that it is version n.

      This should not normally be done  (use the same DDLINK version  on
      both ends),  but can be used to move a new DDLINK.COM to a  system
      which does not have it yet.  Note that functions other than  basic
      C)opy may not work correctly!
DDLINK                                                           Page: 11


6. DDLINK and WINDOWS

   DDLINK is a 16-bit DOS program which runs well under 32-bit  windows.
   It will however NOT run under 64-bit windows which does  not  support
   16-bit code (*)

   DDLINK does NOT understand windows  "long"  filenames  (you can  work
   around this by ZIPing the files!)

   DDLINK uses DOS compatible directly accessable  serial  and  parallel
   ports - USB ports and other non-standard devices will not work.
           - Host USB serial work well within DosBox (*) -

   Windows versions >9x prevent access to the parallel port - you may be
   able to use programs such as DIRECTIO or USERPORT to enable access to
   the parallel port  (I've had mixed results),  however be  aware  that
   windows seems to like to  "twiddle"  the LPT pins  randomly  (perhaps
   checking to see if a printer has been connected)  ...  DDLINK doesn't
   like this...  I don't recommend using the  parallel  connection  mode
   under windows.

   Note that Win2K,  WinXP and newer versions of Windows have very  poor
   DOS serial port emulation which loses data at higher speeds.  You may
   need to select a lower COM speed and a smaller  transfer  block.  For
   best results configure a DOS shortcut to open FULL SCREEN,  and never
   let it go "windowed".

   There is a driver available for Win32 that emulates a  packet  driver
   for the DOS box - I've tried it and it works - search for "SWSVPKT".

   6.1 (*) Win64 and other OSs

      Another way to run DDLINK is with  "DosBox"  a free DOS  emulator.
      This is your *only* option if  you  are  running  *nix  or  64-bit
      windows.

      DosBox works with serial  ports,  mine(below)  also  implements  a
      NE2000 ethernet interface  (the best/fastest  way  to  connect  to
      non-DOS systems). **You may need WINPCAP/W10PCAP to enable this.

      I recommend the DosBox version that  I've  made  available  on  my
      site. This is an older one (formerly called "MegaBuild6") - [there
      are newer ones which seem to work ok - but mine is  the  one  I've
      had *years* of experience with, have fixed bugs in,  and not found
      reason to change]
DDLINK                                                           Page: 12


7. COMMUNICATIONS INTERFACE

   This section describes details of the  communications  interface  and
   protocols used by DDLINK - knowlege of this material is NOT  required
   for normal use of the program, however it has been provided to assist
   others who may wish to write software that interfaces with DDLINK.

   7.1 Serial interface

      DDLINK transmits data with 8 data bits,  no parity  and  one  stop
      bit.  The default serial baud rate is 115200,  however this can be
      changed with a command line option.

      The  serial  interface  must  be   wired   in   a   "Null   Modem"
      configuration,  with RXD and TXD crossed.  For  normal  operation,
      only three wires are required (RXD, TXD and GND).  For /Bootstrap,
      the interface to DOS requires that the connection be extended to a
      7-wire configuration,  which also  includes  RTS/CTS  and  DTR/DSR
      (these must also be crossed).

   7.2 Parallel interface

      The parallel interface consists of 5 data bits,  which are  driven
      by the lower 5 bits of the parallel data output  port.  These  are
      cross wired between the two ports  (see  wiring  diagram)  meaning
      there are 10 physical data paths (5 in each direction). These bits
      are assigned the following meanings:

         D4 = Data ready strobe
         D3 = Data bit 7+3
         D2 = Data bit 6+2
         D1 = Data bit 5+1
         D0 = Data bit 4+0 / acknowlege

      When contact is initiated, all bits are set HIGH.

      When reading the parallel port,  it is always read at least twice,
      until the data is stable  -  this  prevents  errors  due  to  race
      conditions when multiple signals are changing together.

      When transferring a data byte,  the sending PC writes bits 7-4  to
      D3-D0 with D4 low to initiate the transfer.

      The receiving PC see D4 drop,  and saves bits 7-4 of the  incoming
      data. Then toggles D0 to acknowlege that it has read the data.

      The sending PC then writes bits 3-0 to D3-D0 with D4 high.

      The receiving PC see D4  go  high,  and  saves  bits  3-0  of  the
      incoming data. Then toggles D0 to acknowlege.
DDLINK                                                           Page: 13


      When sending a byte,  the sending PC always reads the port  first,
      both to note the state of D0  (for acknowlege),  and to see if the
      receiving PC is also trying to send a byte - if it is, it receives
      and buffers that byte, then proceeds with sending.

      There is a "race" condition which can occur if both PCs attempt to
      send data at *exactly* the same time, both will check and see that
      the other is NOT sending, then proceed to send.  This condition is
      very rare,  and does not normally occur with DDLINK  due  to  it's
      request/response nature,  however the software does handle  it  as
      follows:

      The condition is detected by noticing that after dropping  D4  and
      waiting for the other PC to toggle D0, the other PC drops D4. This
      indicates that the other PC has initiated  a  send  while  we  are
      sending - we also know this the other PC will notice  our  D4  low
      and realize the same thing.

      To resolve the condition,  we take advantage of the fact that  the
      other PC must also be in it's  send  routine.  In  this  case,  we
      perform as follows:
         Save bits 7-4 of the other PC's data.
         Wait 10 IO cycles : insure other PC has time to do same.
         Write bits 3-0 with D4 high.
         Wait for D4 high, and save bits 3-0 of the incoming data.
         Wait 10 IO cycles : insure other PC has time to do same.

   7.3 Network interface

      DDLINK uses a DOS  "packet driver",  and has no  knowlege  of  the
      physical network interface.  By default it will scan for a  packet
      interrupt between 60-80 and use  a  packet  type  of  DD11,  these
      parameters can be changed via command line.

      Many common packet drivers for older/DOS systems can  be  obtained
      from my site (look for "PKTDRV").

      You can get additional/newer  drivers,  documentation  and  source
      code at the official packet driver repository: crynwr.com
DDLINK                                                           Page: 14


   7.4 Link protocol

      Each message transmitted by DDLINK is framed in a packet with this
      format:

        <start>             <>  indicates 8-bit BYTE value
        {length}            {}  indicates 16-bit WORD value
        <data ...>          ... indicates variable number
        {crc}

      NOTE:  multi-byte values in the link frame are encoded in standard
      network BIG-ENDIAN (MSB first) format.

      <start>  is a byte indicating the start of a  frame.  This  has  a
      value of 0x90 for the first  packet  transmitted,  and  alternates
      0x91 / 0x90 for subsequent packets.

      {length} is the length  in  bytes  of  the  <data>  block.  <data>
      contains the data to be transmitted.  Note that  {length}  is  NOT
      included in network frames since the  network  interface  provides
      the data block length.

      {crc} is a 16-bit cyclic redundancy check calculated over the data
      block using the CCITT polynomial (x^16 + x^12 + x^5 + x^1) with an
      initial value of all 1's.  NOTE that  {crc}  is  NOT  included  in
      network frames since the network interface provides a  32-bit  CRC
      over the entire frame.

      7.4.1 {crc} calculation

         An efficient way to calculate {crc} is using  a  lookup  table,
         here is 'C' code to generate the table:

                for(i=0; i < 256; ++i) {
                    c = i << 8;
                    for(j=0; j < 8; ++j)
                        c = ((c & 0x8000) ? 0x1021 : 0) ^ (c << 1);
                    CrcTable[i] = c; }

         Then, for each data block, begin with crc=0xFFFF,  and for each
         byte of data processed:

                crc = CrcTable[crc >> 8] ^ (crc << 8) ^ c;

         Note: All variables (i, j, c, crc & CrcTable[256]) are unsigned
         16-bit.

      Each frame received is immediately acknowleged with a single  byte
      <ack>.  <ack> is 0x92 for frames begining with 0x90,  and 0x93 for
      frames beginning with  0x91.  To  negatively  acknowlege  (NAK)  a
      frame,  the receiver sends  the  opposite  <ack>  than  should  be
      expected (ie: 0x93 for a 0x90 frame).

      Network packets have a minimum size of 64 bytes - so the <ack>  is
      carried in a 64 byte packet, however only the <ack> byte itself is
      significant in this case.
DDLINK                                                           Page: 15


      If a negative acknowlege is received, or no acknowlege is received
      within 1/2 second,  the frame is re-transmitted.  A maximum  of  4
      retransmissions are performed  (total of  5  transmits)  at  which
      point the link session is aborted if successful  transmission  can
      not occur.

      Note that the alternating 0x90/0x91 - 0x92/0x93  <start>  -  <ack>
      sequences  provide  automatic  recovery  in  the  event  of   lost
      acknowlege:

         Packet 0x90 is transmitted & received
         Acknowlege is lost, receiver now expects 0x91
         Packet 0x90 is re-transmitted
         Receiver expects 0x91, sends negative-acknowlege (0x92)
         Sender sees 0x92 as ack and proceeds to send 0x91 packet
         Receiver expects 0x91, sends positive-acknowlege (0x93)
         Communication progresses

      Note that a special case exists in the handling  of  <start>/<ack>
      if the first byte of <data> is 0x00 (LINK_INIT command)  - in this
      case,  the receiver accepts either type of  <start>  and resets it
      expectations to toggle with the sender - this allows a link to  be
      initiated at any time without knowlege of  the  receivers  current
      <start>/<ack> state.

   7.5 Command protocol

      All DDLINK communication  is  initiated  as  a  REQUEST  from  the
      client, and in most cases generates a RESPONSE from the server.

      NOTE:  multi-byte values in  command  structures  are  encoded  in
      Intel/8086 compatible LITTLE-ENDIAN (LSB first) format.

      7.5.1 LINK_INIT

         Request : <0x00>{protocol-version}{Blocksize}
         Response: <0x00>{protocol-version}{Blocksize}

         Establishes  or  resets  the   link   with   the   server.   If
         {protocol-version} does not  match  that  of  the  server,  the
         connection is NOT accepted  (the sender will  figure  this  out
         from mismatched {protocol-version} in  the  response).  At  the
         time of this writing, {protocol-version} has a value of 4.

      7.5.2 FIND_FIRST

         Request : <0x01>{search-attribute}<path/pattern...><0x00>
         Response: <0x03>{#files}[file-info...]

         Begins search for a file matching the specified attributes  and
         name pattern.

         file-info: {Size-H}{Size-L}{Time}{Date}<attributes><Name-13>
         repeated until no more files are found, or Blocksize is filled.
         Name always contains a zero-terminator.
DDLINK                                                           Page: 16


      7.5.3 FIND_NEXT

         Request : <0x02>
         Response: <0x03>{#files}[file-info...]

         Continues a file search.

      7.5.4 OPEN

         Request : <0x04>{mode}{attr}{time}{date}<pathname...><0x00>
         Response: <0x05>{handle}

         Opens a file:

            {mode}: xxxxxxxxxxxx0001 = Open for READ
                    xxxxxxxxxxxx0010 = Open for WRITE
                    xxxxxxxxxxxx0011 = Open for READ/WRITE update
                    xxxxxxxxxxxx0110 = Open for WRITE/APPEND
            {attr}: 1xxxxxxxxxxxxxxx = Update attribute on close
                    x1xxxxxxxxxxxxxx = Update date/time on close
                    xxxxxxxxxxADVSHR = New attributes
            {time}: HHHHHMMMMMMSSSSS = New time (Seconds = S*2)
            {date}: YYYYYYYMMMMDDDDD = New date (Year = Y+1980)

      7.5.5 CLOSE

         Request : <0x06>{handle}
         Response: <0x07>{error-code}

         Closes an open file.

      7.5.6 READ

         Request : <0x08>{handle}{#bytes-requested}
         Response: <0x09>{handle}{#bytes-read}<data...>

         Reads data from an open file.

      7.5.7 WRITE

         Request : <0x0A>{handle}{#bytes}<data...>
         Response: <0x0B>{error-code}

         Writes data to an open file.

      7.5.8 CD

         Request : <0x0C><path...><0x00>
         Response: <0x0D>{error-code}

         Changes the current directory.
DDLINK                                                           Page: 17


      7.5.9 GETD

         Request : <0x0E>
         Response: <0x0F><drive:\path...>

         Get the current drive and directory.

      7.5.10 DELETE

         Request : <0x10><path...><0x00>
         Response: <0x11>{error-code}

         Delete (erase) a file.

      7.5.11 RENAME

         Request : <0x12><oldpath...><0x00><newpath...><0x00>
         Response: <0x13>{error-code}

         Renames a file.

      7.5.12 RMDIR

         Request : <0x14><path...><0x00>
         Response: <0x15>{error-code}

         Removes a directory.

      7.5.13 MKDIR

         Request : <0x16><path...><0x00>
         Response: <0x17>{error-code}

         Creates a directory.

      7.5.14 SEEK

         Request : <0x18>{handle}{offset-H}{offset-L}{mode}
         Response: <0x19>{error-code}

         Seeks to an offset within a file:

            {mode}: 0 = Absolute from start of file
                    1 = Signed offset from current position
                    2 = Signed offset from end of file

      7.5.15 DRIVE_LIST

         Request : <0x20>
         Response: <0x21>{error-code}<drive letters...><0x00>

         Obtains a list of available drive letters.
DDLINK                                                           Page: 18


      7.5.16 SELECT_DRIVE

         Request : <0x22>{drive}
         Response: <0x23>{error}

         Selects a drive.

        {error}:    0 = Ok
                    1 = Drive not available

      7.5.17 LINK_CLOSE

         Request : <0x24>
         Response: none

         Closes the link session and releases the server.

      7.5.18 LINK_EXIT

         Request : <0x25><errorlevel>
         Response: none

         Closes the link session and causes server to exit.
DDLINK                                                           Page: 19


   7.6 DDLCMD.C

         Over the years I've received a number of requests to  "release"
      the DDLINK source code - almost always because  someone  wants  to
      interface with it from another/unsupported system.

         So far I have not done this, mainly because:

      7.6.1 The original DDLINK source

            I wrote DDLINK back in the 80's and at the time  one  of  my
         main  "driving factors"  was  that  I  wanted  it  to  be  very
         efficient and small...  I wanted it to fit on a single bootable
         floppy all the while doing good/fast  network  file  transfers,
         and being easy to move and get up and running on new systems!

            For this reason DDLINK isn't an easy source for many  people
         to understand.  It relies quite a  bit  on  "unique"  libraries
         built into my DOS compiler (like communications, text windowing
         etc.), and also has a LOT of assembly language segments.

      7.6.2 The "new" DDLCMD source

            I have instead written DDLCMD.C -  this  is  a  very  simple
         program  to   perform   file   transfers   using   the   DDLINK
         communication protocol.

            It has a much simpler command  line  interface,  using  only
         standard 'C' library functions.

            It does NOT use any assembly language segments.

            It only does serial communications.  This is  the  simplest,
         but  does  make  use  of  my  DOS  compilers  library...  These
         functions are fully documented in the Micro-C/DOS toolset which
         can be downloaded free from my site.

            It should also be  fairly  straightforwardd  to  create  new
         "driver"  code that transfer the DDLINK  messages  via  network
         etc.  This will likely be  very  specific  to  the  development
         toolset you use.

            I have kept the code more oriented  toward  helping  "figure
         out"  how  to  implement  the  DDLINK  communications  protocol
         instead of being as small and efficient as possible.

            DDLCMD.C should be a good  "starting point"  if you wish  to
         implement a version of DDLINK on a different operating system!

            To have a working DDLINK to test against, you can use DosBox
         as a host platform for DDLINK.COM.

            If you need more  assistance,  I  may  be  able  to  provide
         further help - please contact me (via my site).
DDLINK                                                           Page: 20


8. DaveD Command Menu

      As I age,  my vision/co-ordination isn't what it used to  be,  and
   sometimes I find  "getting a command right"  trickier than it used to
   be.

      I've been using DDLINK  "local mode"  (no server)  often,  to more
   easily  copy/view/manipulate  files  ...  but  it  can't   do   other
   operations, run programs etc.

   So...  I've created DDCM (DaveD Command Menu)  - allowing user defind
   commands,  and  prompting  for  various  types  of  arguments  (File,
   Directory, String, Number) as needed.

   For me it makes it easier to do a lot  of  "the  common/usual"  stuff
   with far less typing, getting filenames right etc.
      (think of it as a text-mode/keyboard "windows" for DOS);

   For more information: DDCM -?

   See DDCM.INI for details on how to setup commands (and some samples)
