View Full Version : WordStar patches for VT100 terminal on CP/M

March 17th, 2011, 04:48 PM
I've re-installed WordStar 3.0 for my CP/M system with VT100 terminal.

Basic cursor positioning is OK, but I can't get WordStar to deliver the correct delete sequences to clear the un-refreshed parts of the screen as it updates the display.

I've tried patching into WordStar's ERAEOL location the VT100 escape sequences for
"delete from cursor to end of line", "delete line containing cursor", delete from cursor to end of display" - none of them work so the display accumulates garbage from each screen.

In addition, I think some of the display control codes are interfering with the VT100 and corrupting keyboard dispatch, leading to freeze.

Does anyone have a reliable setup to share? There is one on line that appears at the top of a Google search for "WordStar VT100" - but it seems to have a few errors in it.

In particular, is a WordStar terminal initialisation sequence needed for the VT100? The terminal is already set up and working fine with CP/M before launching WordStar. Display control escape sequences that work in CP/M are not working through my WordStar 3.0.

I've seen some discussion of XON/XOFF issues with WordStar and VT100 - but my setup is using serial port with only hardware handshaking.

This setup has worked in the past, so I don't think I have a hardware problem.

Is a puzzlement.


March 17th, 2011, 04:54 PM
Have you looked at the sequences for the Heath H8? That might help.

The other thing to try is to initialize by putting your VT100 into VT52 mode--the sequences are much simpler--and de-initialize by putting the terminal back into VT100 mode.

If that doesn't work, I'll dig out my notes. The CP/M WS 4.0 may also have better sequences--at least upgrade to WS 3.30.

March 17th, 2011, 08:12 PM
If it worked before, it may be something simple like word length, stop bits and parity.

March 17th, 2011, 10:16 PM
You're using ESC 0 K, right?

Did you have to enable any sort of handshaking with the VT100? If you're shooting characters out as fast you can, you might be overrunning things. (See the Setup B display for X-on/off option for software handshaking).

March 18th, 2011, 12:00 AM
I think the communications protocol is probably the issue, but not the word length etc because that works fine outside of WordStar.

The DEC User Guide warns of conflicts between the VT100's XON/XOFF habits and software that uses ESC codes. WordStar uses ^S and other low ASCII bytes for application commands - maybe these are confusing the terminal. I tried switching off the "Auto XON/XOFF" configuration in SETUP but it made no difference.

Also tried Chuck's idea of switching to VT52 mode - see the patches for both VT52 and VT100 listed below. The mode-switching happened alright, but display problems were if anything worse. Did I miss anything in the control code patches?

Implementing XON/XOFF on the CP/M console port would not solve this if the terminal is getting fake XONs from the application. But I know that this very copy of WordStar 3.0 worked on this exact same CP/M system and hardware 20 years ago - so it must be configurable.

I might try pulling the baud rates right down to 1200 or so.

Here are the patches I have tried so far:


Jay Maynard "patches necessary to make WordStar 3.0 work on a VT100" posted 2005

[This worked partially for me only after switching off TRMINI, TRMUNI, LINDEL and


Original menu displays correctly with video attributes and cursor positioning, but

display gets corrupted after any change of display. Nothing is erased unless written


ERAEOL did not work when patched with any of the delete control sequences listed in the

DEC VT100 User Manual Programmers Guide]

Patch locations and content - 1st byte= byte-count for the sequence, 00=ignore:

CLEAD1 (024Ah), cursor positioning lead-in: 02 1B 5B
CLEAD2 (0253h), cursor positioning separator: 01 3B
CTRAIL (0258h), cursor positioning trailer: 01 48
CB4LFG (025Dh), column before line flag: 00
LINOFF (025Eh), line number offset: 01
COLOFF (025Fh), column number offset: 01
ASCUR (0260h), ASCII cursor positioning values: 01
ERAEOL (026Dh), erase to end of current line: 03 1B 5B 4D
LINDEL (0274h), delete line at cursor: 03 1B 5B 4D
LININS (027Bh), insert line at cursor: 03 1B 5B 4C
IVON (0284h), inverse video on: 04 1B 5B 37 6D
IVOFF (028Bh), inverse video off: 04 1B 5B 30 6D
TRMINI (0292h), initialize terminal: 04 1B 5B 32 4A
TRMUNI (029Bh), uninitialize terminal at exit: 04 1B 5B 30 6D
IDTEX (0190h), terminal ID string: 'DEC VT-100 terminal' (in hex, of course)

Maynard - "This may stretch the capabilities of a basic VT-100, since line insert and
line delete are optional (are they included in the VT-102?). If scrolling
operations don't work right, simply set LINDEL and LININS to 00, as they're
optional capabilities anyway."

VT100 ANSI-Mode Control Sequences = Hex

Cursor Up ESC [ 1 A 1b 5b 31 65
Cursor down ESC [ 1 B 1b 5b 31 66
Cursor right ESC [ 1 C 1b 5b 31 67
Cursor left ESC [ 1 D 1b 5b 31 68
Erase to EOL ESC [ 0 K 1b 5b 30 75
Erase line ESC [ 2 K 1b 5b 32 75
Clear screen ESC [ 2 J 1b 5b 32 74
Direct cursor addressing uses CLEAD1, CLEAD2, CTRAIL, and ASCUR

VT100 VT52-Mode Control Sequences = Hex

Cursor Up ESC A 1b 65
Cursor down ESC B 1b 66
Cursor right ESC C 1b 67
Cursor left ESC D 1b 68
Erase to EOL ESC K 1b 75
Erase to EOS ESC J 1b 74
Cursor address ESC Y lc 1b 59 lhch

Rick's (unsuccessful) Wordstar patches for VT52 mode

[This displayed 1st WordStar menu minus video attributes, but cursor positioning didn't

work for display of disk directory - no CRLF or cursor positioning implemented on


CLEAD1 (024Ah), cursor positioning lead-in: 02 1B 59
CLEAD2 (0253h), cursor positioning separator: 0
CTRAIL (0258h), cursor positioning trailer: 0
CB4LFG (025Dh), column before line flag: 0
LINOFF (025Eh), line number offset: 1F
COLOFF (025Fh), column number offset: 1F
ASCUR (0260h), ASCII cursor positioning values: 02
ERAEOL (026Dh), erase to end of current line: 02 1B 74
LINDEL (0274h), delete line at cursor: 00
LININS (027Bh), insert line at cursor: 00
IVON (0284h), inverse video on: 00
IVOFF (028Bh), inverse video off: 00
TRMINI (0292h), initialize terminal: 02 1B 3C
TRMUNI (029Bh), uninitialize terminal at exit: 02 1B 3C
IDTEX (0190h), terminal ID string: 'VT52 terminal'


March 18th, 2011, 11:53 AM
Unfortunately, XON/XOFF is the only flow control that the VT100 knows about (RTS/CTS, which would have been the logical thing to do). So sending too fast is going to foul things up.

However, there's no need to program a string for "delete to EOL"--just leave the byte count 0 and WS willl overwrite the area to be cleared with spaces. It might be the easiest way around the problem.

March 18th, 2011, 05:03 PM
Thanks Chuck - zeroing the ERAEOL string basically solved the screen refresh problem - sometimes there is an artifact left at EOL but screens are readable.

I found this old discussion (http://www.groupsrv.com/computers/about105937.html) about the XON/XOFF issue on another forum. It suggests some sort of serial port driver will be needed to eliminate conflicts between VT100 and WordStar or CP/M use of ^S and XON/XOFF. The thread refers to some code for ZCPR which is no longer at the referring link in that old thread, but can be found on the Walnut Creek archive CD-ROM.

I'll keep looking for work-arounds but might have to get into CP/M if this issue goes beyond WordStar and VT100 configuration options.

Discussants all agree the problem has been solved before - they just don't remember how!

March 18th, 2011, 05:29 PM
I'll have a look at my CP/M WS 4.0 manuals to see if they have suggestions.

It's actually pretty surprising how primitive a terminal can be and still work with WS. I recall doing a version where the terminal had erase screen and no direct cursor positioning--just cursor up, down, left, right and home.