From: Eric Youngdale (eric@tantalus.dell.com)
Date: 09/16/92


From: eric@tantalus.dell.com (Eric Youngdale)
Subject: Re: Can you access a virtual console directly?
Date: 16 Sep 1992 16:02:08 GMT

In article <kjb.716640708@godzilla.cgl.citri.edu.au> kjb@cgl.citri.edu.au (Kendall Bennett) writes:
>>dimensions you've never even heard of? Do you even know that it will run
>>on Linux? Do you _really_ want to fall into the MS-DOS trap of having a
>>special driver for each and every piece of hardware that the program is
>>supposed to run on, instead of using the driver that already exists in
>>the operating system?
>
>Well, someone has to do it right? How does curses handle this. It is
>a normal C library that handles this sort of stuff for you, so surely
>you can get the same info that curses uses and figure it out from there.

        Sigh. The kernel itself emulates a vt125, I believe, so all of the
escape sequences are interpreted at that level. The way termcap works is that
you have an environment variable that says what your terminal type is, and any
program that is using termcap asks the termcap library for the escape sequences
to perform certain primative operations. If you change to a different
terminal, everything continues to work, because termcap looks up in a different
table for the new terminal type. You should be aware that a properly written
program that uses termcap will look up each escape sequence once and store it
in a local buffer of some kind. Each time you need to perform that operation,
you just dump that string. Curses is built on top of termcap, in that it uses
the termcap library to look up the escape sequences that are needed to move the
cursor, scroll the screen, etc.

        I would also like to second the other comments about how bad an idea it
is to try and directly write the video memory. DOS programmers got used to
writing directly to the video memory mainly because the bios support was so
slow. I know, I did it myself. As a matter of fact, bios (and dos) support
for lots of things really suck, so people ended up doing just the sort of thing
that you are contemplating, i.e. writing add-ons and applications that worked
around the operating system. These types of add-ons very often do not work
with each other. As an example, I know someone in the next room that has two
different boot-up sequences because MS-Windows and Mathematica use incompatible
memory management schemes. I have lost count of the number of times that
someone has said "You cannot use X with Y". This is one of my 18 reasons why
I no longer use DOS.

        Linux has the power and the tools to do whatever you need. If you use
the tools rather than trying to work around Linux then everything will happily
co-exist. If you are writing a text mode application, use curses and/or
termcap. If you want a graphics application, use MGR or X11. This is is what
they are there for.

-Eric