---------Post-Demuffin Patcher---------
A 4am hack                  v1.20141204
---------------------------------------

"Post-Demuffin Patcher" (PDP for short)
is a cracker's tool that can remove
several forms of copy protection from
Apple II disks. It is meant to be used
in conjunction with Advanced Demuffin.

Many programs contain secondary
protections (nibble checks) or modified
RWTS code that can no longer read disks
in a standard format. After converting
an original disk to a standard format
with Advanced Demuffin, you (the
cracker) are left with the task of
disabling or reverting the secondary
protection. This is where PDP comes in.

Some facts about copy protection:

1. Many companies, especially smaller
   ones, outsourced their copy
   protection. I have seen byte-for
   byte identical copy protection on
   disks from 7 different companies!

2. Even companies that wrote their own
   copy protection would try to re-use
   it on multiple disks to get the most
   "bang for the buck."

3. Not everything has been cracked!
   Because there was so much piracy in
   the 1980s, some people assume that
   everything ever published has been
   cracked and ultimately preserved in
   an emulator-friendly format. In
   reality, there are hundreds of disks
   that have never been cracked. Thirty
   years later, these programs are
   still trapped on physical media,
   literally rotting away.

If you can convert a disk with Advanced
Demuffin, but the copy...

- grinds loading DOS, or
- hangs on boot, or
- reboots endlessly

...PDP may be able to help.

                   ~

Using PDP is simple. The program works
under ProDOS, DOS 3.3, or DOS variants
like Diversi-DOS. When you BRUN PDP, it
will ask you to select the slot and
drive of the disk you want to patch.

NEVER PATCH AN ORIGINAL DISK. Even if
the original disk is already in a
standard format and does not need to be
converted with Advanced Demuffin, you
should still make a copy and patch the
copy. Originals are originals, and we
may some day be able to preserve them
as-is without modification. Until then,
don't reduce the number of original
disks in the world.

Anyway, use the arrow keys to select
the slot and drive, then press RETURN.
That's it; there are no other options.
PDP will read the disk, analyze it for
known copy protections, print out the
modifications that need to be made, and
write the modifications back to the
same disk.

                   ~

PDP comes with a test harness (PDPTEST)
that can simulate cracking a disk. This
includes a collection of test cases.
Each test case is a snippet of a
demuffin'd disk (usually a single track
worth of data) and the expected output
of running PDP on that disk.

PDPTEST only works under ProDOS. It
loads the PDP binary and a list of test
cases from the current directory, then
loads each test case from a hard-coded
directory (/PDP/TESTS/). The collection
of test cases is too large to fit on a
floppy disk, so it is distributed as a
larger .2mg image. You can mount this
file as a ProDOS hard drive in most
emulators.

The following companies constitute the
majority of the working test cases:

- Edu-Ware (all known disks)
  e.g. Decimals, Algebra 2

- Hartley Courseware (all known disks)
  e.g. Tim and the Cat and the Big Red
  Hat

- DesignWare (all known disks)
  e.g. Spellicopter, Crypto Cube

- Sunburst Communications (DOS 3.3
  file-based disks only)
  e.g. M-ss-ng L-nks, The Incredible
  Laboratory

- Focus Media (all known disks)
  e.g. The Time Tunnel: The Presidents,
  Travels with Za-Zoom

- The Learning Company (selected)
  e.g. Bumble Games, Gertrude's Secrets

                   ~

PDP is 100% original code and 100% open
source. It is distributed under the MIT
license. Here is the license, which
applies to the program itself and to
the test harness.

Post-Demuffin Patcher
Copyright (c) 2014 by 4am

Permission is hereby granted, free of
charge, to any person obtaining a copy
of this software and associated
documentation files (the "Software"),
to deal in the Software without
restriction, including without
limitation the rights to use, copy,
modify, merge, publish, distribute,
sublicense, and/or sell copies of the
Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this
permission notice shall be included in
all copies or substantial portions of
the Software.

THE SOFTWARE IS PROVIDED "AS IS",
WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

                   ~

1.20141204
- added #JMPBEB1 and #JMPBECA patchers
  and tests

1.20141113
- added #NIBTABLE patcher and tests
- split source code into multiple files

1.20141028
- initial release

------------------EOF------------------