TRANZ330 ZonTalk Protocol:
--------------------------
This document describes the download protocol between the TRANZ330 and
the host ZonTalk server.

Communication is via dial-up modem at 1200 bps, 8 data bits, NO parity,
to allow for the host to transmit 8-bit CRC's. The terminal will send
7 data bits, even parity, so the host MUST strip the parity bit (bit 7)
from incoming terminal data.

Initiation:
-------------
The terminal dials into the host, and the modems connect. The host must
wait until Carrier is detected and the line is stable.

The host then sends ENQ. The terminal will respond with a download request
packet. If the terminal fails to respond within one second, the host should
resend the ENQ and retry receiving the request several times before giving
up and disconnecting.

The download request packet from the terminal looks like this:

    <STX>55.serial<FS>application<FS>version<D or d><ETX><LRC>

    <STX>       = Start of TeXt character (02 hex)
    55.         = Fixed text - indicates a ZonTalk download request
    serial      = Terminal serial number (content of location 001)
    <FS>        = Field separator (1C hex)
    application = Requested application name (content of location 019)
    version     = Terminal firmware version number
    D           = Full download request
    d           = Partial download request
    <ETX>       = End of TeXt character (03 hex)
    <LRC>       = Longitudinal Redundancy Check character
                    LRC is calculated as the binary EXCLUSIVE OR of all
                    characters in the packet occuring AFTER the <STX>, and
                    continuing through (and including) the <ETX>.

    eg: Terminal with serial number '1234567', firmware version '3.70',
        requesting Full download of application 'DC0001'.

        {02}55.1234567{1C}DC0001{1C}3.70D{03}{45}
        - Host responds by sending download/control packet -

        note: {xx} denotes hexidecimal character code value.

After receiving the request, the host responds with download and control
packets. The host does NOT ACK the request packet. The ACK for the request
packet is implied by the transmission of the first download or control
packet.

Each download or control packet takes the general form:

    <STX>data<ETX><CRC1><CRC2>

    <STX>       = Start of TeXt character (02 hex)
    data        = Packet data content (see below)
    <ETX>       = End of TeXt character (03 hex)
    <CRC1>      = First byte of Cyclic Redundancy Check
    <CRC2>      = Second byte of Cyclic Redundancy Check
                    CRC is calculated on polynomial: X16+X15+X2+1
                    Most-Significant-Bit first, Initial value = 0.

The format of a download packet is:

    <STX>nnndata<ETX><CRC1><CRC2>

    nnn         = Memory location 000-999
    data        = Data to be loaded into this memory location

    Terminal responds to each download packet with ACK.

    eg: Download memory location '113' with 'G+Q#V.2.1*O#L'
        {02}113G+Q#V.2.1*O#L{03}{04}{4F}    <= Packet from host
        {06}                                <= Terminal acknowlege


There are two control packets available:

    <STX>*Mtext<ETX><CRC1><CRC2>

    *M          = Fixed text - indicates a display Message
    text        = Text to be shown on terminal display

    The *M control packet may be issued at any time during the
    download to write a text message to the TRANZ330 display.

    Terminal responds to the *M control packet with ACK.

    eg: Display message 'DOWNLOAD DONE'
        {02}*MDOWNLOAD DONE{03}{EE}{7E}     <= Packet from host
        {06}                                <= Terminal acknowlege

    <STX>*S<ETX><CRC1><CRC2>

    *S          - Fixed text - indicates Stop download.

    The *S control packet is used to end the download.

    Terminal responds to the *S control packet with ACK, then waits
    for EOT from the host, and disconnects the modem.

    eg: Stop download
        {02}*S{03}{E8}{04}                  <= Packet from host
        {06}                                <= Terminal acknowlege
        {04}                                <= EOT from host
        - terminal hangs up line -

UDL File Format:
----------------
TRANZ330 applications are normally provided to the download server in
a UDL format file. The UDL file has the extension .UDL, and consists
of ASCII text lines, one for each TRANZ330 memory location. The format
of each line is:

    "fnnndata"

    "           = Each .UDL line begins and ends with "
    f           = '0' for full download only, '1' for full/partial
    nnn         = The TRANZ330 memory location to be loader
    data        = The data to be stored in the memory location.
