The G3PLX bootstrap.
====================
If you have a FLASH rom in your EVM, and would like to be able to start
EVM programs by G3PLX much faster than you can with the EVM56K debugger,
then you can install the G3PLX bootstrap into the FLASH.

When you have done this, you will be able to leave the serial port cable
permanently on the user port, hit the RESET switch on the EVM, and run the
LOADEVM.EXE program to load direct from the .CLD file into the EVM. There
is no need to load BIOS or LEONID first, and there is no need to convert the
.CLD file to a .LOD file. The PLXBOOT code is also compatible with programs
such as PSK31.EXE and EVMSPEC.EXE, which will themselves load the .CLD file
without needing LOADEVM separately. Note that use of PLXBOOT is not
recommended if the EVM is set in the 32k memory map: see the technical notes
at the end of this file.

INSTALLATION
============
To install PLXBOOT in a FLASH ROM, load PLXBOOT.CLD into the EVM with the
debugger, and run it using the debugger command "GO". This will load the
bootstrap code into the FLASH. You should realise that this will erase the
previous contents of the FLASH chip. Loading PLXBOOT into the flash will
not affect the way that the debugger works.

OPERATION
=========
Once the PLXBOOT code is programmed into the FLASH ROM, you can move the
serial port cable to the user port and it can stay there. The commandline
for LOADEVM is:

   LOADEVM [options] <filename> [<filename>...   ]

The filenames default to .CLD extension so you don't need to enter it. You
can load up to 10 files in one operation by just adding more filenames to
the commandline. But you may need to be careful about the order they appear
in the list. See below.

The options are all preceded by a / character and they can appear anywhere
in the commandline:

/p<comport>   for example /p2        Indicate which COM port to use. Defaults
                                     to COM1 if you don't have this option.

/b<baudrate>  for example /b19200    Specify baudrate to use for the load.
                                     Defaults to 57600. Only the well-known
                                     speeds can be used like 38400, 9600.
                                     57600 is the fastest that will work.

/go[hex]      This option specifies that the EVM will be started after the
              last file is loaded. If you add a hex address, the EVM will
              be started from that address, otherwise the start address will
              be taken from the last .CLD file loaded.

LOADEVM starts by taking the serial port RTS and DTR lines positive for 55mS.
Either of these lines can be used to reset the EVM by connecting it to a
transistor which operates the reset switch. The files are then loaded in
the order in which they appear in the commandline. If you are loading two
files, remember that if the second one loads code into memory locations
that were also loaded by the first, then the code from the first will be
destroyed. If in doubt, use the sequence that you know works when loading
via the debugger. Also remember that if the /go option is used without an
address, LOADEVM uses the start address of the last file. This will work
if the "GO" command in the debugger works without an address.

Some programs to drive the EVM from a PC, like PSK31 and EVMSPEC written by
G3PLX, have LOADEVM built into the .EXE file. These programs can load the
.CLD files direct without needing LOADEVM.

TECHNICAL DETAILS
=================
PLXBOOT is loaded into ram at P:$0 by the EVM hardware. It starts by
receiving the first two bytes of data from the serial port at 1200 bauds,
and uses them to set the baudrate for the rest of the file. It acknowledges
these two bytes by sending a 'break' level to the PC, and switches to the
new baudrate. When the PC receives the break (at 1200 bauds) it also switches
to the new baudrate and sends blocks of data, in the format described:

The first byte indicates the type of the block. 00 loads code into P
memory, 01 into X, 02 into Y, and 03 into L (48-bit data into X/Y together).
Block type 04 starts the EVM running from a given address, and block 05 sends
the bootstrap back to the start to wait for another file. These blocks of
data are sent by the PC, decoded from the information in the .CLD file.

Blocks 00, 01, and 02, have 2 bytes for the start address, two bytes for
the word-count, then three bytes for each 24-bit data-word. Block type 03
is similar but has six bytes for each 48-bit data-word.

Block 04 has only 2 bytes which form the start address. Just before it jumps
to the user code, it sends one byte back to the PC and waits until that byte
has finished sending. The PC waits for this acknowledgement before
terminating LOADEVM back to the DOS prompt or the next command in a .BAT
file.

Block 05 has no data. It makes the bootstrap jump to the start of the
bootstrap code. In this way it can start another file load without resetting
the EVM.

The bootstrap code is loaded at P:$000..P:$1FF, but in order that it can be
possible for it to load programs into this region without corrupting itself
as it loads, it relocates itself before running the main part of it's program.
The region into which it relocates itself is P:$4000..P:$40FF. This is
actually above the top of the 16k memory limit, and there should be no memory
at this address. However, because of the way the memory is wired into the
circuit, the 16k of memory at $0..$3FFF appears twice, with a "phantom" image
at $4000..$7FFF. For example, addressing phantom location $5000 actually
addresses location $1000 as well. So we can only use the lower image or the
upper image but not both. Since the 56002 processor has some on-chip P:
memory in the region $0000..$01FF, the lower image of the external ram at
P:$0000..P:$01FF is not accessible (it's hidden 'underneath' the internal
memory). This means that the upper image of this 512-word region can be
safely used. But because the EVM external P: memory is shared with X: memory
and the external X: memory IS accessible in the X:$0100..X:$01FF region
(when the ROMs are turned off), PLXBOOT uses only P:$4000..P:$40FF.

This means that PLXBOOT can load data into any X:, Y:, or P: memory location
in the entire 16k memory map between $0000 and $3FFF.

Note that if the EVM is used in it's 32k mode (J2 in the 32k position), the
bootstrap will then be in the middle of the $0000..$7FFF common memory map,
and will crash if an attempt is made to load data or code into ANY memory
space in the address range $4000..$40FF. Don't use PLXBOOT if you will be
using the 32k memory map.

