Talkin' 'bout those emulators....
 
I found a bug in the h19 emulator included with the Model 4 Kermit
distribution.  The problem occurs when a "clear to end of line" code
appears with the cursor already positioned at the end of the line.
The result is that the TRS-80 appears to do strange, random things,
requiring a reboot to clear up.
 
Here's the technical description of the problem: the h19 code has a
special protection in it to handle the clear-to-end-of-line code when
the cursor is itself at the end of the line.  However, this protection
does not work correctly.  A value is PUSHed onto the stack before the
program checks to see where the cursor is, and if it's at the end of the
line, the program returns without POPping that value.  The result:
instead of returning to the proper address, the RET statement jumps
somewhere else in memory, which causes unpredictable results.
 
The problem is easy to fix if you have a good assembler like EDAS or MRAS.
Columbia University was kind enough to include the source code with its
Kermit distribution, so all you have to do is edit that and reassemble.
 
Here's the fix.  Edit file M4H192/ASM.  Find the code marked by the
label NO_CLEAR (close to the beginning of the file).  Above NO_CLEAR
but below R078, insert a new label POP_NO_CLEAR, with the instruction
POP BC.  Note that POP_NO_CLEAR will fall through to NO_CLEAR after
executing this POP.  Now go down about 20 lines and look for the
statement JR Z,NO_CLEAR in the CLEAR_TO_EOL block.  Change this
statement to JR Z,POP_NO_CLEAR.
 
Reassemble by making sure that you have available M4H19/EQU, M4H19/MAC,
M4H191/ASM, and M4H192/ASM.  Then assemble M4H191/ASM, instructing the
assembler to generate a CMD file from that file (ie. the -GC option in
MRAS).  Replace the existing M4H19/FLT with your new M4H191/CMD.  That's
it: you're done.
 
Enjoy!
 
       --- John ---
 

