Date: Wed 28 Aug 85 11:17:59-PDT
From: Ronald Blanford <CONTEXT@WASHINGTON.ARPA>
Subject: Kermit on NEC 8800

Some time ago there was a complaint that the Generic version of Kermit
only partially worked on the NEC 8800.  I had reason to need it recently
and found the following fix which works quite well.

Generic Kermit uses the iobyte to switch to the BAT console (which takes
its input from the RDR device) so that it can check the serial port input
status using the Console Status BIOS call.  The BIOS therefore must check
the iobyte twice in this situation, once to determine that the BAT console
is in use, then again to decide which physical device RDR is set to.  The
NEC 8800 does this for the Console Input routine, but not for Console Status.
The default Console Status routine always returns No Input Available, so
that Kermit never tries to receive a character even though it can send them
just fine.

The solution is to patch the dispatch table for the Console Status routine
so that it proceeds to the serial status routine instead of the default.
It might be hard to determine the address of the status routine if RDR is
set to the PTR, UR1, or UR2 device, but for the TTY device the address is
just two entries earlier in the table to be patched.  Fortunately Kermit
uses the TTY device by default.

On the NEC 8800, the serial driver is loaded dynamically, and the address
of the status routine varies depending on which driver is used.  Therefore
this patch must be made each time the system is cold-booted, after installing
the serial device driver but before running Kermit.  It's easiest to make
the patch into a simple program using DDT as follows:

A>DDT
DDT VERS 2.2
-A100
0100 LHLD 1		; get the address of the BIOS jump table
0103 INX  H		; step forward to the Console Status entry
0104 INX  H
0105 INX  H
0106 INX  H
0107 MOV  A,M		; get the address of the Console Status dispatcher
0108 INX  H
0109 MOV  H,M
010A MOV  L,A
010B INX  H		; step past the dispatcher's initial JMP instruction
010C INX  H
010D INX  H
010E MOV  C,M		; pick up the address for the TTY Status routine
010F INX  H
0110 MOV  B,M
0111 INX  H
0112 INX  H		; step forward to the BAT entry
0113 INX  H
0114 MOV  M,C		; save the TTY address in the BAT entry
0115 INX  H
0116 MOV  M,B
0117 RET		; return to CP/M
0118 .
-^C			; Now get out of DDT
A>SAVE 1 KPATCH.COM	;  and save the patch as a COM file

With this patch program available, perform the following sequence of
actions after cold boot to bring up Kermit:

A>INSTALL8 IRS232A TTY: [,,,,O]		; install the driver as device TTY
					; set up for Object files.  The driver
					; name may vary.
A>KPATCH				; Patch the BAT status routine
A>KERMIT				; Start Kermit

With the interrupt-driven serial driver in place, this has worked perfectly
for me at up to 9600 baud.  Good luck.

-- Ron
