Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vi, DOS and CTTY

86 views
Skip to first unread message

R. Christopher Lott

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

I want to be able to edit files on my DOS computer through the serial port. I
tried the CTTY COM1 command, and was able to control the computer via a
terminal connected to the COM1 serial port. However, when I started my vi
editor (elvis), the display was to the screen still, not out the serial port.
It did, however, accept commands from the serial port. A bit odd...

Then, I tried vim. It was worse than elvis at recognizing this configuration.
It not only displayed the file on the console, but it insisted on taking
commands from the keyboard. Vim didn't seem to recognize any aspect of the
CTTY command, while elvis at least "knew" enough to take keyboard input over
the serial port.

Surely there must be some command-line option or environment variable setting
that will do the trick, but I can't find it. I have searched the FAQs for this
newsgroup, and the help files for vim and elvis. (My wife often accuses me of
being blind as a bat, so it's entirely likely that I read right over it an
missed it!) Any help would be appreciated.

-Chris Lott
rcl...@ro.com


Sven Guckes

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

rcl...@ro.com (R. Christopher Lott):

> I want to be able to edit files on my DOS computer through the serial port.
> I tried the CTTY COM1 command, and was able to control the computer via a
> terminal connected to the COM1 serial port. However, when I started my vi
> editor (elvis), the display was to the screen still, not out the serial port.
> It did, however, accept commands from the serial port. A bit odd...
> Then I tried vim. It was worse than elvis at recognizing this configuration.

I wonder which version of elvis and vim you tried.

I have never used "CTTY COM1" - could you describe how this is done?
Maybe some other folks can then try it do and give you some feedback.

> It not only displayed the file on the console, but it insisted on taking
> commands from the keyboard. Vim didn't seem to recognize any aspect of the
> CTTY command, while elvis at least "knew" enough to take keyboard input over
> the serial port.

Another item for the vim wishlist?
Let me know!

Sven

R. Christopher Lott

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

In article <slrn6fo9fi...@rudin.math.fu-berlin.de>, guc...@math.fu-berlin.de says...

>I wonder which version of elvis and vim you tried.

Elvis version 1.7
VIM version ??? dated 26 Apr 97


>I have never used "CTTY COM1" - could you describe how this is done?
>Maybe some other folks can then try it do and give you some feedback.

Well, it's done like this. You type (not the prompt, of course):

C:\> CTTY COM1

from the DOS prompt. From then on, the command processor (command.com)
will send and accept commands from the specified device, in this case
the serial port on COM1. Many graphical-type programs, which write
directly to the Video RAM, won't work this way, of course. But I see
no reason why the vi-clones shouldn't work this way. Short of having
vi working, the only editor I know of that will work over the serial
port in this manner is EDLIN!

Any suggestions are welcome...

-Chris Lott
rcl...@ro.com


Sven Guckes

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

rcl...@ro.com (R. Christopher Lott):

> >I wonder which version of elvis and vim you tried.
> Elvis version 1.7
> VIM version ??? dated 26 Apr 97

Test with command ":version". According to the date this could be vim-5.0f.
Anyway, I suggest to get the release version, ie vim-5.0 [980219].

> it's done like this. You type "CTTY COM1" from the DOS prompt. From then on,


> the command processor (command.com) will send and accept commands from the

> specified device, in this case the serial port on COM1. [...]


> I see no reason why the vi-clones shouldn't work this way.

Maybe the info about the connected terminal cannot be obtained that way?
Perhaps vim would work with "+builtin_terms"?

Why do you do this again?

I can imagine that might want to do this to some PC
if I didn't want to connect a monitor to it and yet
edit some files. But then I'd have to enter the
command "CTTY COM1" without being sure that a shell,
err, command.com, will accept it.

Sven

James Hu

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

On 3 Mar 1998 13:36:21 GMT, R. Christopher Lott <rcl...@ro.com> wrote:
>I want to be able to edit files on my DOS computer through the serial
>port. I tried the CTTY COM1 command, and was able to control the
>computer via a terminal connected to the COM1 serial port. However,
>when I started my vi editor (elvis), the display was to the screen
>still, not out the serial port. It did, however, accept commands from
>the serial port. A bit odd...

What are you using as your terminal display through the serial port?
A DEC VT100? A WYSE terminal?

Most DOS versions of "vi" do not include a full blown terminal
capabilities database. But most have been designed to work with one
if one is available. Find the appropriate termcap/terminfo entry for
your terminal, install it someplace where your DOS "vi" can find it,
set your TERM variable appropriately, and you should be golden.


--
James C. Hu <j...@cs.wustl.edu> Computer Science Doctoral Candidate
http://www.cs.wustl.edu/~jxh/ Washington University in Saint Louis
>>>>>>>>>>>>> I use *SpamBeGone* <URL:http://www.internz.com/SpamBeGone/>

Louis RAPHAEL

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Sounds to me like elvis/vim display by putting the values directly to
the video card, rather than the DOS or BIOS routines. If I remember,
when you CTTY, you redirect *those*, but if the program is doing
direct screen writes, those will still go to the screen attached to
the computer. I do believe that (vim, at least) has an option to make
it display ANSI-style, so that you could do what you're talking about.
By default, this option is probably turned off, because it slows
things down (significantly on an older machine). I suggest browsing
through the help file - you'll probably find what you're looking for
in there... I vaguely remember seeing it, although I'm not really sure
what VI clone it was for.

Check the :set term options - that should be it. Try :set term=vt100
for starters...

Louis

R. Christopher Lott

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

In article <slrn6fp63...@lambada.cs.wustl.edu>, j...@cs.wustl.edu says...

>Most DOS versions of "vi" do not include a full blown terminal
>capabilities database. But most have been designed to work with one
>if one is available. Find the appropriate termcap/terminfo entry for
>your terminal, install it someplace where your DOS "vi" can find it,
>set your TERM variable appropriately, and you should be golden.

My problem wasn't that the program wasn't speaking the correct codes
for my terminal, but rather it wasn't using the appropriate BIOS
commands to receive/send keyboard/screen I/O. These BIOS commands
know when to redirect their input/output to the serial port when the
CTTY command is issued. But you are on the right track when you recommend
the TERM variable - that turned out to be the trick!

Under Elvis, if the TERM variable isn't set, the program bypasses the
BIOS and writes directly to the screen. When I set TERM to something,
say ANSI, elvis uses the BIOS calls and the I/O is appropriately
re-directed! It works!

Alas, I haven't been able to get vim to do the same thing. Setting
the TERM variable got it to route the screen output over the serial
port, but it was intent on getting keyboard input from the console.
I couldn't figure out how to get vim to accept commands over the
serial port.

Another poster has suggested/inquired about calvin. I haven't known
about this editor, but it sounds interesting enough for my application
(palmtop computer with limited memory) that I'll try to find it on the
internet and give it a try.

Thanks for all the comments and help.

-Chris Lott

roo...@gmail.com

unread,
Jun 7, 2020, 2:07:24 AM6/7/20
to
вторник, 3 марта 1998 г., 11:00:00 UTC+3 пользователь R. Christopher Lott написал:
> Then, I tried vim. It was worse than elvis at recognizing this configuration.
> It not only displayed the file on the console, but it insisted on taking
> commands from the keyboard. Vim didn't seem to recognize any aspect of the
> CTTY command, while elvis at least "knew" enough to take keyboard input over
> the serial port.
>

vim can handle terminal input with nobioskey (http://wwwcdf.pd.infn.it/vim/options.html#'bioskey'). I'm running vim 5.0 in a VM with DOS 5.0 and can edit files from iTerm on macOS host connected to the virtual COM1 over a UNIX socket using socat in raw mode. I made a small wrapper that does something like:
%VIM%\VIM.exe -T xterm -c "set nobioskey" %1 %2 %3 %4 %5 %6 %7 %8 %9

Otherwise, "set nobioskey" can and "term xterm" be placed in your _VIMRC.

Prebuilt vim 5.0 binary has a few more terminal databases built-in, e.g.: ansi and pcansi. Local DOS console is handled by pcterm terminal. The approach also works for vim 3.0 (but the version is way too far from modern vim).

-Roman

Eli the Bearded

unread,
Jun 8, 2020, 3:16:17 AM6/8/20
to
In comp.editors, <roo...@gmail.com> wrote:
> вторник, 3 марта 1998 г., 11:00:00 UTC+3 пользователь R.
^^^^^^^^^^^^

I think after 22 years the original poster has given up looking for an
answer here.

> Christopher Lott написал:
> > Then, I tried vim. It was worse than elvis at recognizing this configuration.
> > It not only displayed the file on the console, but it insisted on taking
> > commands from the keyboard. Vim didn't seem to recognize any aspect of the
> > CTTY command, while elvis at least "knew" enough to take keyboard input over
> > the serial port.
> vim can handle terminal input with nobioskey
> (http://wwwcdf.pd.infn.it/vim/options.html#'bioskey'). I'm running vim 5.0

Vim 5? That's 2016 or so. Long after 1998.

> The approach also works for vim 3.0 (but the version is way too far from
> modern vim).

Modern vim is 8.2. In my usage -- which is very heavy on vi features and
light on vim features -- there are noticably differences between 3 and
5, and less noticable differences between 5 and 8. So maybe, yeah.

Elijah
------
recalls the vim3 "Q" command is now "gq" so that "Q" could do the vi thing

Roman Bolshakov

unread,
Jun 8, 2020, 9:59:38 AM6/8/20
to
On 08.06.2020 10:16, Eli the Bearded wrote:
> In comp.editors, <roo...@gmail.com> wrote:
>> вторник, 3 марта 1998 г., 11:00:00 UTC+3 пользователь R.
> ^^^^^^^^^^^^
>
> I think after 22 years the original poster has given up looking for an
> answer here.
>

Likely, R. Christopher’s notes [1] may still be helpful for
retro-enthusiasts. It’s much more convenient to run long DOS sessions
with a familiar editor running in a modern terminal emulator with proper
settings and fonts rather than struggling with TC.EXE. The approach also
works for early versions of Windows running in a VM.

1. http://www.palmtoppaper.com/ptphtml/39/pt39002d.htm

>> Christopher Lott написал:
>>> Then, I tried vim. It was worse than elvis at recognizing this configuration.
>>> It not only displayed the file on the console, but it insisted on taking
>>> commands from the keyboard. Vim didn't seem to recognize any aspect of the
>>> CTTY command, while elvis at least "knew" enough to take keyboard input over
>>> the serial port.
>> vim can handle terminal input with nobioskey
>> (http://wwwcdf.pd.infn.it/vim/options.html#'bioskey'). I'm running vim 5.0
>
> Vim 5? That's 2016 or so. Long after 1998.
>

It was released in 1998, actually. Roughly two weeks before the message
I replied to:

*version5.txt* For Vim version 5.0. Last modification: 1998 Feb 19

>> The approach also works for vim 3.0 (but the version is way too far from
>> modern vim).
>
> Modern vim is 8.2. In my usage -- which is very heavy on vi features and
> light on vim features -- there are noticably differences between 3 and
> 5, and less noticable differences between 5 and 8. So maybe, yeah.
>
> Elijah
> ------
> recalls the vim3 "Q" command is now "gq" so that "Q" could do the vi thing
>

Yeah, lack of gg in vim 3.0 is something I couldn't get used to.

Cheers,
Roman
0 new messages