HP-9000 BASIC Workstation Kermit

READ THIS FIRST!

The files whose names start with HPB comprise Kermit for the HP-9000 Series
200 and 300 BASIC workstation, submitted to Columbia by Andy Campagnola of
Hewlett-Packard Company, on an MS-DOS diskette.  Unfortunately, most of the
files on the disk are "binary", either in some kind of native HP workstation
data format (see below), or in one case an MS-DOS .EXE file.  Since only text
files can go in the Kermit distribution, these files have been converted to
simple hexadecimal encoding, i.e. two hex characters per 8-bit byte.  The
resulting .HEX files contain lines of 72 (or fewer) characters each.  The
lines mean nothing, and when decoding these .HEX files, the line breaks
should be ignored.

Here is a program that can be used to "dehexify" the .HEX files (one at a
time) on the PC, written in C.  Use it with i/o redirection, e.g.

  unhex < hpblif.hex > hpwlif.dir

This program probably can't be used on the HP BASIC workstation, but it should
be easy to translate it into HP BASIC (anyone who does this is invited to send
it back to Columbia -- IN ASCII SOURCE FORM! -- so we can include it with the
other HP9000 BASIC Kermit files).

/*  UNHEX.C - Program to translate a hex file from standard input
 *  into an 8-bit binary file on standard output.
 *  Usage: unhex < foo.hex > foo.exe
 *  Christine M. Gianone, CUCCA, October 1986.
 *  Modified Feb 89 to work right with Microsoft C on the PC.
 */

#include <stdio.h>                    /* Include this for EOF symbol */
#ifdef MSDOS
#include <fcntl.h>	              /* For MS-DOS setmode() symbol */
#endif

char a, b;                            /* High and low hex nibbles */
unsigned c;

/* Main program reads each hex digit pair and outputs the 8-bit byte. */

main() {
#ifdef MSDOS
    setmode(fileno(stdout),O_BINARY); /* To avoid DOS text-mode conversions */
#endif
    while ((c = getchar()) != EOF) {  /* Read first hex digit */
	a = c;			      /* Convert to char */
        if (a == '\n')                /* Ignore line terminators */
          continue;
        if ((c = getchar()) == EOF)   /* Read second hex digit */
          break;
	b = c;			      /* Convert to char */
        putchar( ((decode(a) * 16) & 0xF0) + (decode(b) & 0xF) );
    }
    exit(0);                          /* Done */
}

decode(x) char x; {                   /* Function to decode a hex character */
    if (x >= '0' && x <= '9')         /* 0-9 is offset by hex 30 */
      return (x - 0x30);
    else if (x >= 'A' && x <= 'F')    /* A-F offset by hex 37 */
      return(x - 0x37);
    else {                            /* Otherwise, an illegal hex digit */
        fprintf(stderr,"Input is not in legal hex format\n");
        exit(1);
    }
}

Following is the "read me" file that came with this program.  But before you
read it, please not that the filenames listed below had to be changed so they
would fit the requirements for Kermit Distribution filenames (unique prefix,
6.3 format, no funny characters):

DOS Diskette Name               Kermit Distribution Name

HPWLIF.DIR      (binary)    --> HPBLIF.HEX
HPKERM02        (binary)    --> HPBKER.HEX
HPK_INIT        (binary)    --> HPBINI.HEX
HPK_HELP        (binary)    --> HPBHLP.HEX
HPK_MISC        (binary)    --> HPBMIS.HEX
HPK_GETM.E      (binary)    --> HPBGET.HEX
HPK_DOC         (binary)    --> HPBDOC.HEX
HPWUTIL.EXE     (binary)    --> HPBWUT.HEX
HPK_DOC.PRN                 --> HPBKER.DOC
HPK_ASCP.TXT                --> HPBKER.BAS
README                      --> HPBAAA.HLP

The files marked "(binary)" were hexified.  README is the following file, now
called HPBAAA.HLP.


       HP-KERMIT  DOS  DISTRIBUTION DISC   - Version 1.02
                                             May 9, 1989

       This is a modified version of the HP-KERMIT LIF distribution
       diskette. It contains HP-KERMIT in two formats, a DOS text
       format, and a LIF PROG file image existing on DOS media. A
       utility program called HPWUTIL.EXE has been included on the
       disc to allow you to copy the LIF File images from the DOS
       distrbution disc to an HP-LIF disc.

       The HPWUTIL.EXE program is part of HP's 82300B BASIC LANGUAGE
       CO-PROCESSOR product and is Copyright (C) Hewlett-Packard.
       Permission is granted to use the product for installing the
       HP-Kermit distribution disc.

       If you have obtained the 82300 BASIC Processor Card for the PC
       you can use the BASIC copy command to copy files directly from
       this installation disc to a LIF disc. Without the
       Hardware product you must use the HPWUTIL.EXE Utility.

       This DOS distribution disc is being distributed by Columbia
       University - Kermit Distribution Dept. at the Center For
       Computing Activities. You may obtain a HP-LIF Distribution disc
       from INTEREX  HP-Users Group at the following Address:


           INTEREX
           680 Almanor Ave
           Sunnyvale, CA  94086-3513

           Attention: HP Kermit Distribution



       The files on this diskette include the following:

        DOS FILENAME            FILE TYPE        FILE CONTENTS

        HPWLIF   DIR     9728   LIF Image File   Directory Info
     *  HPKERM02       194048   LIF-PROG Image   Kermit Program
        HPK_INIT          256   LIF-ASCII Image  Kermit Init Script
        HPK_HELP        11776   LIF-PROG Image   Help Subprogram
     *  HPK_MISC        33024   LIF-PROG Image   Hex Edit, Misc Source
        HPK_GETM E       4096   LIF-ASCII Image  LIF "README" file
        HPK_DOC        135680   LIF-ASCII Image  Kermit User Manual

        HPK_DOC  PRN   134528   DOS TEXT         Kermit User Manual
     *  HPK_ASCP TXT   208958   DOS TEXT         Kermit Prog (Ascii)
     *  README           6784   DOS TEXT         This README File

     * = Files revised 5/9/89

       To Install the files on this disc you will need to use the
       HPWUTIL.EXE program from DOS. Have ready a LIF Initialized
       disc(s) from an HP BASIC Workstation. You will need two -
       5 inch (blue) floppies, or a grey 3.5 inch floppy. They must be
       initialized with 256 byte sectors (normal INITIALIZE command),
       and the newer black 1.4 Mb discs cannot be used.  If you are
       copying the files to a 3.5 inch LIF floppy you will need to
       have a 3.5 inch dos disc drive on your PC.  External floppy
       discs such as the HP-9122 cannot be used, the discs must be DOS
       internal drive mechanisms.


       COPYING THE DOS - LIF IMAGES TO AN HP-LIF DISC

       The DOS-LIF Image files are known as HPW (HP Workstation)
       files. You will be copying from a HPW volume to a LIF Volume.
       The following steps show you how to use the HPWUTIL program to
       install the Kermit files:

       In the following example the DOS Kermit Distribution Disc is in
       drive A: and the HP LIF Formatted disc is in drive B:


     (1) A:> HPWUTIL            Run the Utility Program

     (2) Press F2               Press the COPY Option

     (3) Press F5               Select  HPW to LIF  Copy

     (4) Type Source DOS Directory

         A:\    <enter>

     (5) Type the Destination LIF Drive Name

         B:     <enter>

     WARNING: DO NOT ACCIDENTALLY INSTALL THE FILES TO A DOS HARD DISC
              THIS MAY CORRUPT THE DOS DISC VOLUME.

     (6) "Please insert an HP LIF-Formatted Destination Disc
          in drive B:

          Warning: The Destination Disc will be completely
          overwritten ....

          Press <return> to begin copy

     (7)  You will see the folowing file copy status screen during
          copying:


          Source:    DOS HPW subsystem in directory:  A:\
          Destination:  LIF Disc in drive B:
          File Count = x
          Copying File: HPKERM02

          After the copy is complete you will see the followiung
          message on the screen:

         "DOS HPW directory to HP-LIF Volume copy is complete.
          Number of files copied is 6."

          <Hit any key to continue>


   (8)  To verify the copy operation perform a catalog function
        (F3) on the destination disc:


        From the HPWUTIL main (entry) screen -

          (a) Press F3      Catalog Function
          (b) Press F1      LIF Disc
          (c) B:            Type the DOS Drive for the LIF disc
          (d) <enter>       Press Enter when ready

                The LIF Disc is cataloged

          (e) <enter>       Press <enter> after catalog to exit
          (f) Press F8      Press F8 to return to DOS


        You can now place the LIF disc into an HP BASIC Workstation
        disc drive and LOAD the Kermit PROG file.

       --------------------------------------------------------------

        Printing the Kermit Documentation from DOS:

       The HP-Kermit Users Manual is included on this disc as both a
       DOS Text-Formatted Print File and LIF ASCII File.  There are no
       non-printable or escape sequences in the document.  To print
       the user manual from DOS use the DOS PRINT command:

        C:> PRINT HPK_DOC.PRN

       Don't print the LIF-ASCII document HPK_DOC from DOS.

       --------------------------------------------------------------

       The  HPK_ASCP.TXT  File

       The HPK_ASCP.TXT is a DOS text listing of the HP-Kermit
       Program File. The File is really meant for viewing and printing
       from DOS. It can be used to bootstrap the program from a
       file transfer or tape with some limitations.

       Because the DOS program listing is ascii, all compiled sections
       of the HPKERM02 Program have been replaced with the BASIC
       interpreted source code.  The program text will run Kermit at
       one-forth the speed of the BASIC PROG file because of the three
       missing compiled subprograms SUB Spack, SUB Encode_pack, and
       SUB Decode_pack.  The PHYREC CSUBS are also missing, and no
       source is available.  The PHYREC CSUBS are part of the BASIC
       5.x product from HP and can be "loadsub'd" from the BASIC
       Utilities disc with the following command:

       LOADSUB ALL FROM "PHYREC:,7xx,1"

       The source code for the Spack, Encode_pack, and Decode_pack
       subprograms can be compiled using any supported HP BASIC 5.x
       compiler.
