
                            PINHEAD
                            -------

                          Version 1.4
                Shareware by Charles F. Johnson

         Copyright  1989 Little Green Footballs Software
                      All Rights Reserved.

             Release Date: Saturday, September 9, 1989


Introduction
------------

     PinHead is a *very* tiny program (it uses less than 1K when
installed!) that should be run from your AUTO folder.  PinHead will
drastically reduce the amount of time it takes to boot your computer,
especially if you have several AUTO programs and desk accessories
installed.  Every program that runs after PinHead will load into the
computer faster than you ever thought possible!  And this speedup is not
only evident at bootup time; programs will load much faster even when
they are run from the GEM desktop or a shell such as CodeHead Software's
HotWire.  PinHead gives you a lot of bang for your memory buck!

     PinHead 1.4 works with all ROM versions of TOS; 1.0, 1.2, and 1.4. 
Even though TOS 1.4 contains its own built-in "fastload" feature, I
decided to make PinHead support TOS 1.4 as well, because in some cases
PinHead's fastload is more compatible with improperly written ST
applications.  (Two very popular programs that don't work correctly with
TOS 1.4's fastload, but do work with PinHead 1.4, are ARC.TTP [the
original version] and the GFA Basic 2.x Interpreter.)


If You've Already Read This Document
------------------------------------

     ...then skip ahead to the section at the end titled "New Stuff." 
Here you will find the revision history of PinHead, with any new
features (hopefully) clearly described.

     If you haven't read this document before, please take a few minutes
to read it through.  Your enjoyment of PinHead will be much increased if
you do; there's information here that will help you through the most
common trouble spots, to the fastest ST bootup you've ever seen.  Yow!


Yet Another Shareware Plea
--------------------------

     The first three versions of PinHead (1.0, 1.1/1.1a, and 1.2) were
released as freeware.  However the response to PinHead on the major
networks has been so enormous that I've found myself spending more and
more time answering questions, looking for solutions, working on the
code and the documentation, etc.

     Therefore, starting with PinHead 1.3, PinHead and the accompanying
documentation are now being distributed as shareware...which means that
if you use and enjoy the program, you're expected to pay a small
registration fee.  (After you've used it a few times I suspect you may
find it difficult to do without!)  I'm asking only $15 for PinHead. 
Please pay the registration fee if you end up using PinHead regularly;
if there's no shareware response to PinHead, I'll be unable to keep
enhancing and supporting the program. 

     If after trying PinHead 1.4, you decide to continue using it,
please send a check or money order for $15.00 to:

     Charles F. Johnson
     P.O. Box 1250
     Pacific Palisades, CA 90272

and please indicate on your check that this is a registration payment
for PinHead.  This will enable me to enter your name properly in my
shareware data base.


Installation
------------

     For best results, PinHead should be as close to the beginning of
your AUTO folder programs as possible.  If you already have an AUTO
folder with several programs in it, you can use CodeHead Software's
"AUTO Organizer" (one of the programs on our 'CodeHead Utilities' disk)
to make sure PinHead runs before most of the other AUTO programs.  If
you don't yet own a copy of CodeHead Utilities, you should make a backup
copy of your AUTO folder, delete the original folder on your bootup
disk, create a new folder named AUTO, and copy all the programs back, in
the order in which you want them to run.

     If you have a hard disk driver in your AUTO folder, it should run
before PinHead.  If you use the public domain program FATSPEED (which
speeds up the directory search routines in GEMDOS), this too should run
before PinHead 1.4 in the AUTO folder.  Why?  Well, FATSPEED insists on
being the very first thing in the trap #1 vector; and PinHead also needs
to intercept this vector.

     But every other program designed for AUTO folder usage can run
after PinHead...which is just the way you want it.  When you boot up
with PinHead active, your AUTO folder programs and accessories will just
FLY across the screen, especially if you have a hard disk. 

     When PinHead 1.4 first runs, it tries to read a file called
PINHEAD.DAT in the root directory of the boot drive.  See below in the
section titled "Configuring PinHead" for details on how to "custom
tailor" PinHead 1.4 for each program you run, to get the most compatible
system possible. 


Disabling PinHead for One Program
---------------------------------

     It should be a very rare occurrence to find a program that needs to
have PinHead 1.4 disabled in order to run.  However, if a certain
program does act strangely or crashes with PinHead active, you can turn
off the "fastload" feature before running that program, with a special
"hot key" sequence.  To disable PinHead, hold down the Alternate, Left
Shift, and Control keys while you type '0' (zero) on the numeric keypad,
before running the program.  This will disable PinHead, but only for the
very next program you run.  After quitting that program, PinHead will be
active again. 


Turning PinHead On and Off
--------------------------

     PinHead 1.4 also lets you turn it "on" and "off."  This is different
from the disabling method explained above; when you turn PinHead off, it
will be disabled until you turn it back on, not just for the very next
program that runs.  To turn PinHead off, hold down the Alternate, Left
Shift, and Control keys and type '-' (minus) on the numeric keypad.  To
turn PinHead on, hold Alternate, SHift, and Control, and type '+' (plus)
on the keypad. 

     This feature is in PinHead 1.4 in case you find yourself running
several programs in a row that don't work properly when PinHead is
active.  In that case, it will be easier to just turn PinHead off for
the duration, and re-enable it when you're through with the <ahem>
"problem" programs.  See "Configuring PinHead" below for a way to
automatically tell PinHead when to disable itself.


Configuring PinHead
-------------------

     Since it's hard sometimes to remember when you're supposed to
disable PinHead to run a certain program, and a system crash seems like
a rather harsh penalty to pay for a moment of forgetfulness, PinHead has
a configuration option which lets you tell PinHead to automatically
disable itself when certain programs are run.  You can also tell PinHead
to clear a little bit of extra memory for certain programs; this enables
"problem" programs to be fastloaded.

     As mentioned above, you can create a special "configuration file"
which will be read when PinHead is first run.  This file should be
called PINHEAD.DAT, and kept in the root directory of your boot disk. 
PINHEAD.DAT is a standard ASCII text file which can be created and
edited with just about any ST word processor or text editor (as long as
your editor has an option to 'Save as ASCII').  This file contains
information about programs that need "special treatment" in order to
live harmoniously in the same system with PinHead. 

     The PINHEAD.DAT file must follow some simple rules of organization
to be properly used by PinHead.  All lines should be flush with the left
screen margin...do not insert spaces from the left.  The first line of
the file should contain the letters 'PH13', followed by Return.  This is
the special identifier that tells PinHead this is a valid PINHEAD.DAT
file. 

     On the lines following the identifier, you can list each program or
desk accessory that needs to be specially treated.  All filenames should
be in upper case, with no path information -- only the name of the file
itself.  PinHead 1.4 allows you to list up to 32 programs in the
PINHEAD.DAT file.

     If a line contains only a program filename, followed by a Return,
PinHead assumes this to mean that it should deactivate itself during the
loading of that program.  This frees you from having to remember to
disable PinHead manually.

     If a line contains a program filename followed by one or more
spaces, followed by a number, PinHead assumes this number to be the
number of kilobytes of "extra" memory it should clear when that program
runs.  (One "K" or kilobyte is 1024 bytes.)  By experimenting with
different sizes of "extra" memory, you should be able to "fastload" many
programs that would otherwise be incompatible with PinHead.  (The same
programs that are incompatible with TOS 1.4's fastload feature.)  For
example, the GFA Basic Interpreter apparently needs only 8K of "extra"
memory cleared when it runs in order to be fastloaded like any other
program.  (See "How PinHead Works" for more details about clearing this
extra memory.)

     Here's a sample PINHEAD.DAT file:


PH13           <---------------\
GFABASIC.PRG 8  <------\        \
USCRIPT.PRG   <---\     \        \
ARC.TTP 16  <--    \     \        \
TURBOST.ACC    |    \     \   Mandatory "identifier" (must be 1st line).
               |     \     \
        ^      |      \  Clear 8K of extra memory when GFABASIC.PRG runs.
        |      \       \
        |       \    Disable PinHead when USCRIPT.PRG runs.
        \        \
         \     Clear 16K of extra memory when ARC.TTP runs.
          \
        Disable PinHead when the Turbo ST desk accessory loads.

     Please note that unless a program's name is listed in the
PINHEAD.DAT file with a number after it, PinHead 1.4 will not clear any
"extra" memory at all when the program runs.  This differs from PinHead
1.2 -- version 1.2 would always clear an arbitrary 16K of extra memory
for all programs.


How PinHead Works
-----------------

     PinHead is based on a public domain program called NULLFILL,
originally written by Leo de Wit, and circulated on the Bitnet system. 
When it appeared on GEnie, I got curious about it and took a look.  The
original program worked only with TOS 1.0, which didn't do me much good
since I have a Mega ST4 with TOS 1.2.  I added compatibility with TOS
1.2 and 1.4 (which turned out to involve a bit more than just changing a
few addresses!), and had it check to see which version of the ROMs it
was running under.  I also added a "hot key disable" feature, optimized
the code to work almost twice as fast, reduced its memory usage by quite
a bit, and made it compatible with the popular FATSPEED program (the
original stopped working if FATSPEED was installed).  Then I found a way
to make it even more compatible with certain programs (programs like
Microsoft Write, the GFA Basic Interpreter, and ARC.TTP) than the new
"fastload" feature in TOS 1.4.  Leo, if you see this, I hope you don't
mind what I've done with your idea!

     So how does it work? Ordinarily, when TOS runs a program all free
memory (from the beginning of the program to the end of the TPA, or
Transient Program Area) is cleared.  PinHead sits and watches for that
memory clearing routine to occur, and when it does, substitutes a much
faster clearing routine.  In addition to being faster, the PinHead
routine only clears one (usually small) part of the program's memory
area (the BSS) instead of clearing all memory in the computer.  This
means that programs start up much faster.  (This is the exact same
method that TOS 1.4 uses to implement its fastload feature.)

     But a few programs don't get along with TOS 1.4's fastload method;
these "problem" programs expect all memory to be clear (set to zeros)
when they run.  (The ST documentation does not guarantee that anything
except a program's BSS area will be clear when it runs, but some
programmers have made that assumption in their code.)  To get around this
problem, PinHead 1.4 allows you to specify (in the PINHEAD.DAT file) an
amount of "extra" memory to clear beyond a program's BSS; this extra
clearing is usually imperceptible unless you specify a very large
amount, yet it enables PinHead to work properly with many applications
that fail when used with TOS 1.4's fastload technique. 

     If you do come across a program that won't work properly when
PinHead is active, you can either disable PinHead manually before
running it, or add its name to your PINHEAD.DAT file to disable PinHead
automatically when that program runs.  (See "Disabling PinHead,"
"Turning PinHead On and Off," and "Configuring PinHead" above.)


A tough decision
----------------

     When I started playing with the NULLFILL code, I had no idea that
I'd end up writing something that would make one of CodeHead Software's
products (TopDown) obsolete for many people.  One of the purposes of
TopDown is to accelerate the bootup process, by limiting the amount of
free memory which needs to be cleared by TOS when programs run.  As it
turns out, PinHead does a much better job of speeding up the boot
process, and has the added benefit of being active whenever you run a
program...not just at bootup. 

     TopDown has one other important feature, however...it also allows
people to use all their usual desk accessories and AUTO programs along
with programs that normally don't allow this.  (For example, Epyx's
Art/Film Director, and early versions of Hybrid Arts' SMPTE-Track and
Easy-Track.)

     After much discussion, my partner John Eidsvoog (John's the author
of TopDown, and together we own CodeHead Software) and I have decided to
release TopDown as shareware, since there is still a very valid use for
it.  Watch for TopDown to be posted soon on the major information
services. 


*************
*           *
* NEW STUFF *
*           *
*************


-------------
 PinHead 1.4
-------------

PinHead Now Fastloads Itself!
-----------------------------

     Version 1.4 of PinHead uses an undocumented feature of TOS 1.0 and
1.2 to "fastload" itself.  This means that the speedup starts one
program sooner in your AUTO folder, since the PinHead program file does
not cause memory to be cleared when it runs.

     (NOTE: Normally, the use of this undocumented feature would result
in the PinHead program file being left "open" by the system.  PinHead
1.4 uses a special technique to avoid this bug in TOS, and you will have
no trouble deleting, renaming, or copying the PinHead program file after
it runs.)


New "Wildcard" Configuration Option
-----------------------------------

     Starting in PinHead 1.4, you can now specify a default amount of
"extra" memory to be cleared automatically for every program _not_
listed in the PINHEAD.DAT file.  This way, if you have a problem with
PinHead, you don't have to go laboriously searching through your AUTO
folder and accessories to find the one that's crashing -- just list a
default amount of extra memory in the PINHEAD.DAT file.

     To do this, just create a PINHEAD.DAT file that looks like:


PH13
*.* 16


     In this example, we're telling PinHead to clear 16K of extra memory
whenever any program runs.  The wildcard specifier "*.*" is used to mean
"all files/programs".  This should be followed by a space, then the
amount of K (kilobytes) you wish to clear beyond the program's BSS.  If
there are other program names listed in the PINHEAD.DAT file, either
before or after the "*.* 16" line, they will be processed according to
the rules explained in the section titled "Configuring PinHead" above.


**************************************************************************
*                                                                        *
*  PINHED14.PRG and PINHEAD.TXT are                                      *
*  Copyright 1989 Charles F. Johnson & Little Green Footballs Software.  *
*  All Rights Reserved.                                                  *
*                                                                        *
*  PinHead 1.4 may be freely distributed as long as both the program     *
*  file and this documentation are included, and as long as neither      *
*  file is altered in any way whatsoever.  No part of this program or    *
*  its accompanying documentation may be reprinted or used for           *
*  commercial purposes without the express written consent of the        *
*  program's author.                                                     *
*                                                                        *
**************************************************************************

