Hello PoFo-fans,
----------------

Here is a PoFoCF v0.02 distribution. I've packed the entire
thing in a .ZIP file to make transportation easier.

The complete package contains the following files:
--------------------------------------------------

mdextern.com    The program from Klaus to install an external
mdextern.txt    MkDir command (ATMD.COM mostly) that it will
                take charge of making directories on multi-sector
                clustered disks. mdextern.txt is the
                documentation.

atmd.com        The external make-directory command for use with
                a PoFo when a more-than-one-sector-per-cluster
                partition is used.

pofocf.asm      The source file for the PoFoIDE driver. This is
                open-source software. That implies that for each
                executable that I wrote for this interface you
                also get the source.

pofocf.sys      The ready-made driver.

pofocf.sch      A circuit diagram of the CompactFlash interface
pofocf.gif      hardware. The hardware part of the interface is
                quite simple, a single 74HC138 and a connector
                and some wires do the work.

cfclosed.jpg    A series of pictures made with my not-so-very-
cfbot.jpg       good digital camera showing how a pofo looks when
cfbot2.jpg      a CompactFlash interface is wired inside.

mkfs.asm        The program that you can use to create a file-system
mkfs.com        on the disk. This program will do the equivalent
                of a DOS 'FORMAT' only much faster. This thing
                makes a filesystem for each drive letter. I do
                *not* believe in 'are-you-sure' questions. I'm
                always very sure about what I enter as a command.
                The doubt -in my experience- always comes when
                you see the result of the command when it is
                finished executing.

ddiag.asm       A diagnostics program for the driver. I write
ddiag.com       most of the driver's static storage to the
                IoCtlRead buffer. This program provoces such an
                IoCtlRead, then dumps the relevant data. I think
                you'll need the source of both the driver and the
                ddiag program to make sense of it. This has
                proved to be very helpful in he debugging.

dfs.asm         Another diagnostics program. This one dumps the
dfs.com         file-system information of the partition you'd
                give as a command-line parameter. It's a little
                easier to make sense out of the results of this
                program that ddiag. Ddiag was most helpfull when
                PoFoIDE was designed and tested, dfs put me on
                the track of the only change from v0.01 -> v0.02
                of PoFoCF: the file-system configuration that
                PoFoCF decided to use in v0.01 did not make me
                happy. V0.02 fixed that problem

ddt.asm         The debugger i wrote to have a hope in hell of
ddf.com         getting this driver to work on a pofo in the
                first place. It's quite a nice debugger, the only
                one I know of that was designed for the PoFo. If
                you're fit for working with a debugger of this
                kind, you're also fit to find out how this one
                works by inspecting the source. Don't be put off
                too much by this brave remark: it *is* a very
                simple debugger that looks a lot like the DOS
                program DEBUG in many ways. It has (simple) help
                functions (? command) and a pseudo-symbolic
                disassembler, a single-stepper function and all
                other things that are essential for debugging.
                The debugger is also quite unique in the fact
                that it has full support for debugging device
                drivers. Perhaps I'll make some sort of a manual
                of this program separately someday.

cftest.asm      A testprogram that i've used to check out the
cftest.com      basic I/O mechanism of the PoFoCF hardware
                interface. This program was not intended to be
                'self-explaining'. Expect to do some source code
                studies if you wan to use it. The program is not
                so easy to use, but has all the funcions of a
                'block-in/block-out' disk editor. It has bazooka-
                like power, so it should be used with caution.

COPYING         A copy of the GPL. Should be sent with each and
                every open-source package. It is worth your while
                to read this one if you've never done that
                before.

The use of these files is as follows:
-------------------------------------

MDEXTERN & ATMD: I think you already know what to do with these
files, for completeness: You you have to enter the following
command in your autoexec.bat (or do it by hand at any time you like..):

        MDEXTERN <drive>:<full path name>\ATMD.COM

Note: you have to put the FULL path & file (inluding the .COM)
name of ATMD as a parameter to the MDEXTERN program, or it will
not work (I found that one out the hard way).

PoFoCF.asm: the source file of the driver, not of direct use.
This is GPL (copyleft) software, so you have to suffer
getting the source of the program as well as the executables...

PoFoCF.sys: the loadable driver. To use it put the following
statement in your config.sys file:

   device=c:\system\pofocf.sys [Options]

This version of the driver supports the following options:

 /D = debug modus. This will cause the driver to bark debug
      messages to the user at all kinds of odd moments. Klaus
      would understand what it means, I think it's quite useless
      for any other user. Default is no debug messages.

/N =  Skips the filesystem integrety check. The driver does a
      very basic check wether the filesystem(s) on the disk are
      in order when it loads. This option will switch off this
      check. The option is mostly interesting to recover from
      badly damaged filesystems, and should be rather
      superfluous...

NB: I have indicated the options here with a '/' as options
indicator. A '-' (for the unix fans..) will work just as well.

How to install pofocf:
----------------------

- Build-buy-or-steal the PoFoCF hardware interface. The hardware
  is quite simple. At this moment i've only tried with a 74HC138
  glued onto the pofo's motherboard and the CF's data and address
  bus connected to the memory card connector's pins. When I get
  more connectors and perhaps find the money to buy another
  CF-module I can tell about the experiences with different
  connections. The circuit diagram is in the source file:
  PoFoCF.sch . I've used the 'Eagle' (www.cadsof.com) freeware
  version to draw it.

- Install a CompactFlash module

- Get the PoFoCF driver on you pofo (somehow...). I'll assume in
  this description that you put it in the \system direcory.

- Install a 'device=c:\system\PoFoCF.sys' line in the config.sys
  file.

- Reboot (<CTRL><ALD<DEL>). The PoFo will attempt to load the driver.
  With a new drive: expect error messages: there are no valid
  file-systems on the disk, PoFoCF will complain loudly about that...

  After this first reboot the driver should report something
  like:

  PoFoCF disk driver v0.02 (02-02-2000)
  by: Peter Faasse
  Disk  : <disk ident string>
  Drives: d: .. <last drive:>
  No valid filesystem: d:
  .
  .
  No valid filesystem: <last drive:>

  <disk ident string> = the identification string of the module
  you have connected. The CompactFlash modules have an identifi-
  cation string stored in their ROM. I print it. Why? Well I
  really do not know. It does give some confidence that the rest
  of the identification information was read from the disk
  correctly.

  <last drive:> = the last drive that will fit on the module. This
  PoFoCF is quite plug-and-play in that respect. It detects the
  module size and the number of partitions that will fit on a module
  from the internal information it reads from the module itself.

  **************************************************************
  * DEBUGGING                                                  *
  **************************************************************
  DEBUGGING: If the above message(s) do not appear then something
  is wrong.

  If the first two lines do not appear then the driver is either
  corrupted somewhere in transfer to your PoFo, or not loaded at
  all. Perhaps the entry in config.sys is not there, or the
  transmission went astray somewhere.

  In this stage the driver also does a number of checks on the
  hardware. These are the messages that could appear when it
  finds some hardware problem:

  'CompactFlash not detected!': means just that. The driver has
  not been able to detect any module at the other end of the
  interface hardware. This is the error message you'd expect when
  you have a pofo, with just the interface connected, but no
  module at the other end. The pofo can happily run with no
  module connected. The driver will install, but with minimal
  memory usage, and all references to the module will result in a
  'drive not ready error' as a response. I have run pofo's with
  this driver installed and no module connected. Apart from a
  minimal loss of available memory I have detected no adverse
  effects. If you have, to the best of you cunning, connected
  everything right, then there's probably a hardware error in the
  interface hardware somewhere...

  'Not a Portfolio!': The driver does a simple check if it is
  running on a pofo. If you do see this message on a pofo, please
  report so. I have never seen that happen on a pofo. This *is*
  what you get when you install this driver in a normal PC's
  config.sys file.

  'Illegal command line option!': This too, I would not expect at
  this moment, but perhaps you *did* put an unrecognized
  command-line option in the config.sys file. This error message
  means that the driver was not able to understand it's own
  command line options in the config.sys file. If you see it
  showing up with no command-line options, then put an empty line
  after the ....PoFoCF.sys.... line in config.sys . And report
  this to me. I did have this kind of messages in an older
  version of PoFoIDE with no command-line options, but that
  should have been solved by now.

  'CompactFlash Ident Failed': at boot the module identification
  will be done. In this identification, the driver will attempt
  to get the module's geometry, name string etc.. If that fails,
  this message will show. The problem is most probably again some
  error in the hardware of the interface.

  'No valid filesystem: <drive:>': this message is to be expected
  when a new module is connected to PoFoCF. Till this version the
  PoFoCF has a rather non-standard partitioning mechanism. It
  checks for each partition if he partition contains a believable
  filesystem. This message shows up for each filesystem on a
  module that it does not recognize. This can cause a load of
  error messages when you connect a 'virgin' module. The error
  message is non-fatal, and you'll see later in this description
  what you should do about it. Later on, when PoFoCF has been
  booting without reporting this message, I'd be very surprised
  to find this message showing it's ugly face. It would mean that
  the filesystem information has somehow been corrupted. A
  partition that is corrupted this way is marked read-only by the
  driver. You could attempt to rescue data from it, (using the /N
  option in config.sys) but a mkfs on the partition is the only
  (documented...) way to recover.

  **************************************************************
  * END DEBUGGING                                              *
  **************************************************************

Assuming you had no problems with the previous part of the
installation, here's what we do about all these 'invalid
filesystems' on the module:

- run mkfs from the command line for each drive letter. Example:

     mkfs c
     mkfs d

  This is for a module of less than 66 MBytes. On bigger modules
  you may have to create more filessytems this way. If you lose
  count, just reboot: The pofo will re-check the filesystems, and
  report the ones that are not correctly made.

  NB: the driver will upon first (and other) reboots inform about
  how many drives it thinks will fit on the module, and if and/or
  not it thinks that these have been properly created. It will
  complain about every file-system it finds not ok on the module.

- reboot (<CTRL.......). This will load the driver again, this
  time with proper file-system information loaded and read/write
  for the partitions enabled. Before this second reboot the
  driver will refuse to write to non-valid filesystems. The
  results of a read-attempt are (not really) unpredictable
  (mostly you get garbage output...). I made reading possible to
  allow reading from perhaps-damaged file-systems as a recovery
  operation.

- Install MDEXTERN and ATMD in autoexec.bat. The MDEXTERN.TXT
  file describes how that is done. The pofo has a 'natural'
  problem with modules with a cluster size bigger than one. Most
  file-operations go ok, but MD (or MKDIR) result in 'divide by
  zero' errors if you attempt to make a directory without ATMD
  loaded. ATMD does fix most of the problems with the bigger
  cluster size, but not really all. On the PoFoCF, with cluster
  size maximally 16 sectors, the pofo still has problems when
  you'd put loads and loads of iles in a directory. I have no
  means to do anything about that. If this *really* annoys you,
  go hunt for the DIP v 1.43x version of the pofo BIOS. That
  version is reported to work correctly with big cluster sizes.

This should allow you to install a PoFoCF and driver on a pofo.
There's not really anything more to tell about it.

As for running with a PoFoCF driver in your system:

- Changing modules: Is rather uncritical. Just be sure to reboot
  the pofo each time you connect a different module. It needs
  that to make sure the driver has read the correct parameters
  from the module.

- running without a module: Here too: <CTRL><ALT<DEL> the pofo
  when you have disconnected the module. The driver will report
  that no module is connected, but the pofo should happily work..

- Just forgetting the above, running without a module: gives
  'disk not ready' errors. Nothing fatal should happen, just that
  the pofo starts reporting errors. Swapping module (for a
  different capacity module): that could be a recipe for
  invalid-file-system errors. I do not want to do something about
  that, such as re-check the module at each disk access. That
  will cripple the whole inetrface speed. The problem is just
  about the same as you'd get when you'd start to 'hot-swap'
  memory cards or harddisks in a normal PC: not recommended.

- finding errors: *please* do report them.

I've declared beta-testing at version 0.02 . The version number
is quite low to delare the thing open for beta-testing already,
but: Most of the driver's code is a direct copy of the PoFoIDE
driver. The PoFoIDE driver has been in the open for more than one
year with no bug reports. That seems to imply that either the
interest for the PoFoIDE driver has vanished, or else the thing
runs bug-free.... The PoFoCF modifications are only in the quite
basic I/O routines and have been tested on both a 8051 micro-
controller system, my PoFo and with this driver and a separate
CFTEST program. If you find problems: I'm very open to error
reports and/or comments. I do perfer comments in the form of
e-mail; that allows me to respond a lot faster than paper-mail.
But paper mail comments will (somewhat slower, the Dutch mail is
not lightning fast..) of course be read and handled.

greetings,

Peter Faasse

e-mail:
-------

faasse@nlr.nl

paper mail:
-----------

P.R. Faasse
Hakfort 635
1102LA Amsterdam
Netherlands


