Patch to XT4 terminal programme version 1.6.8 to allow Hayes command
Modems to work and other things.                     R. Cox 01/09/88
--------------------------------------------------------------------
Mod.4(See below) requires Gregg Wonderly's Heath-19 filter
  Files:       H19/FLT
            SETH19/CMD
Refer to M4MIT/DOC for details of filter operation.
--------------------------------------------------------------------
This is a patch applied after the main programme is loaded to allow
Hayes modems to dial out properly on the XT4 terminal programme.

The method to boot is:-

LOAD XT4
XT4PAT                  or use XT41/JCL, which does the same thing.

This will load the main programme then overlay the patches onto the
main programme and run it.

What this patch does is fool the programme into thinking it has been echoed
back with the 'A' of the AT command. It also inserts a delay into sending the 
characters out, otherwise it all goes to quick for the modem to keep up with.

As the patch is arranged at the moment you load the main programme and then run
the patch, which overlays with the altered patch outs. 

Mod.1
I have included the obligatory patch for 1275 baud, although I have replaced
the 600 baud selection rather than the 9600 baud one, since I use that speed
for direct transfers.
Mod.2
There were found to be some difficulties with timing when at lower speeds than
2400 baud, so the pause time was increased to compensate for the increased time
taken for an echo back. The configuration used is set at Hayes modem/Fast 
output speed and rotary dialling.
Mod.3
The macro calls didn't work when calling each other, so another patch is 
included which jumps back to the Macro routine start when [A-J] is seen, a
<Break> call is included to allow exit from a loop when one Macro calls
another.
Mod.4
I have now included some patches out from the terminal mode routine so that the
display and keyboard  calls are re-routed to @PUT/@GET calls to *SO/*SI
This allows Gregg Wonderly's Heath-19 filter, used in the Kermit v5.2 for the
Model 4, to be installed so that the terminal emulates closely the Dec VT-52
screen. If the filter is not installed then the programme defaults through 
to the *DO/*KI devices. The code has now dropped below the magic 3000H, so I
have added a call to HIGH$ to set LOW$ to below the patch start. This has
been added to the start-up code so does not cost any space.
Carriage Returns on the VT-52 do not include a Line Feed on boot up, to change
to CR+LF then use the command <Esc>x8<CR>, where <Esc>=<Shift><UpArrow>
on the Model 4p. Refer to the Kermit v5.2 documentation for the rest of the
video commands. They can be entered in the terminal mode by typing AT so that
the modem is echoing back commands then the <Escape sequence> followed by a
 <CR>. The modem will usually ignore the escape sequence. It is important to
remove this filter when exiting from the programme as some applications will
crash spectacularly with it, or when coming back into XT4/Kermit without re-
initializing it.
Mod.5
Having found out where the final programme byte is loaded and stored I have
placed the overlay code at the end of the main programme code and written in 
the new final byte address at the appropriate place and remove the now 
redundant call to HIGH$. The programme crashes when uploading and presumably
downloading, maybe this change will make it more robust. Trouble is I don't
have much opportunity to try the uploading/downloading.
Mod.6
I have never used the modem break so have changed the call to the Logon
sequence which is much more useful to me.
Mod.7
I moved the Logon call 3 bytes on to avoid calling a routine that recalls a
saved ram area at 4400H. Especially at the beginning of a session this part
contains the boot-up programme and there doesn't seem to be a flag to avoid
putting this on the screen before it is used.
Mod.8
Alter baud rates in initialization to 300/1275/7512/1200/2400/9600 (plus 19200
available but not displayed - option 7). It transfers successfully at 19200 but
tends to drop the screen out as the emulation cannot cope too well.
Mod.9
NOP out compare and jump on zero for ^E - ENQ input to process Logon output.
Cure for crashing eventually traced to the emulator filter which loads into
3000H and re-locates to EC9AH normally. One of the jumps to the chained *DO
task had an address that when relocated made the jump to the original programme
at 3000H! So it worked fine until overwritten by another programme. This has
now been patched out and seems to work fine. The whole programme seems to func-
tion well now.
Mod.10
Add a call out to make the block increment as a 16 bit count instead of the 8
bit count as it annoyed me to see the count zero out when going past 32k. It
seems to work OK but needs some more work on it.
Mod.11
Well nothing works for long! Mod.11 decrements the HIGH$ value by one to avoid
overwriting the HEATH emulator filter when inputting into the buffer.
I've added calls to swap the cursor from block to underline when switching 
from terminal mode to other modes, just because I like the idea of it.
Mod.12
Set ATH command on redial to ATZ which happens to be my preference. Change it
back if you don't like it.
Mod.13
The Modem Space never seemed to work well for me. I do have the problem of
disconnecting from the PSS Network though so I've changed the 'A' command
Modem Space to Raise and lower DTR/RTS which disconnects the line immediately

An additional command from the main menu not listed is <Shift><Clear> which
will clear out the terminal buffer and jump to the <XT4 1.6.8> prompt. Also
commands such as the '?' Help and in the phone directory '+' to jump on a
screenful do not need to be shifted (ie a '/' or ';' will do)

This file and the source and assembled command file are placed in a library
file XT4PAT/LBR using LU4. It includes the fixed H19/FLT programme and the
source code for the patch. Also I have included a fix for the XT4/DAT file that
is loaded to give various parameters and directory entries to alter the incom-
ing video to stop screening above ASCII as it made a mess of the screen using
the macro facility. If it is required run it via the PATCH utility used by
TRSDOS. You may need to alter some values depending on your installation.
I now run XT4 in a menu driven ICP which installs the filter and removes it
on exit and also sets up Kermit the same way so that I can switch from XT4 to
Kermit without losing the call, as long as there is no input/output during the
switch which takes a few seconds and locks up the UART for setcom to install



Bob Cox
