disk2d64 0.0.1 (C)1999 Michael Steil
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Abstract
~~~~~~~~
disk2d64 is a tool that transfers 1541 disks from a C64 connected
through a PC64 cable to a Linux PC.

Requirements
~~~~~~~~~~~~
C64/C128 with 1541/1571 or 100% compatible
Computer running Linux with an IBM PC compatible parallel port
PC64 cable as used by the PC64 emulator

Installation
~~~~~~~~~~~~
Untar the file and run "make" as root. chmod +s disk2d64. copy the
file somewhere into your PATH. Note that disk2d64.prg must always
be in your current working directory when running disk2d64.

Usage
~~~~~
Connect the Commodore to the PC's parallel port and run the startup.prg
program (LOAD "STARTUP.PRG",8,1; SYS 49152), which you must have
transferred to the Commodore before.
Now run disk2d64 on the PC, redirecting the program's output into a
.d64 file, like this:
  disk2d64 > testdisk.d64

Error Messages
~~~~~~~~~~~~~~
Timeout
  If the Commodore doesn't respond within 10 seconds, d64trans quits
  with this error message.
  Check whether the cable is properly connected and the port address
  is correct.
Transfer program file read error
  disk2d64 needs the disk2d64.prg file to work. This file contains the
  Commodore disk reading routines that are being transferred at the
  beginning.
  This file must be in the currect working directory.
ioperm() failed
  disk2d64 could not access the parallel port. Make sure that you're
  either root or the program file's owner is root and the s bit is set,
  and that no other program is accessing the parallel port.

Performance
~~~~~~~~~~~
It takes about 50 seconds to copy a disk image from a C64/1541 to a
PC. The program is faster when connected to a C128 (~40 sec.).

Internals
~~~~~~~~~
disk2d64 has been optimized for speed. It is faster than any X1541
solution, for one simple reason: a PC and a 1541 cannot communicate
as fast as a C64 and a 1541, because they do not have the same clock
frequency. Therefore disk2d64 works differently: it transfers a whole
track from the 1541 to the C64 - at full speed - and the C64 then
transfers the track to the PC, which is also quite fast.
The C64/1541 routines can transfer a whole disk in about 30 seconds
(thats ~23 blocks/sec) and the second part needs additional 20
seconds (10 seconds on a C128).
First, the PC program copies the fast disk routines into the
Commodore's memory and runs it. These routines make the 1541 start
reading the first track immediately. This way, the reads and sends
track by track. For the PC, this is just a stream of 174848 bytes
which are being written to stdout.
To achieve better performance, the fast disk routines always read
a whole track in the following way: every sector that passes the
head and hasn't been read before will be read and transferred, until
all sectors of the track have been read. This is faster than any
interleaved method.

Command line
~~~~~~~~~~~~
-V       only print version number and exit
  this is useful if you want to use disk2d64 as a backend for
  other programmes
-p PORT  use the specified parallel port (default: 0x378)
  you might want to connect a second parallel port to your PC,
  so you can specify its address here
   DOS   Linux 2.2  port address
   LPT1: /dev/lp0   0x378
   LPT2: /dev/lp1   0x278
   LPT3: /dev/lp2   0x3e8
   LPT4: /dev/lp3   0x2e8
-q       quiet operation
  do not send any messages to stderr
-v       increase verbosity level by one   
  use this if you want to debug your connection
   -q    nothing
         init, transfer, track number
   -v    blocks
   -vv   bytes
   -vvv  every action concerning the parallel port

Restrictions
~~~~~~~~~~~~
- For some strange reason, the 1541 must have been active since the
  last reset of the Commodore. So, if you have to reset the C64,
  type OPEN 1,8,15,"I" before tring to transfer any disks.
- On some PCs, the parallel port behaves strangely and data is
  being corrupted during transfer. I have seen that on a Pentium MMX
  with an unknown mainboard chipset (Intel TX?) and on a VIA MVP3
  board. If you have the same problems, please contact me!
- The fast disk routines do not care about read errors at all. So
  make sure that the disks you want to transfer are okay.

TODO
~~~~
- the disk2d64.prg file should be in /usr/lib/disk2d64...
- better makefile
- rewrite the fast disk routines:
  * to have source code
  * to make it handle disk errors
- write a nice frontend

Author
~~~~~~
Michael Steil <mist@c64.org>
Alternative e-mail address: michael.steil@writeme.com

Copyright
~~~~~~~~~
You may use this program under the terms of the GNU General Public
License. However, this does _not_ apply to the fast disk routines
in the file disk2d64.prg and to the startup code in the file
startup.prg. Think of this file as "freeware", since I cannot release
source code for it.

