Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!aurora!labrea!decwrl!jumbo!ehs From: ehs@jumbo.dec.com (Ed Satterthwaite) Newsgroups: comp.sys.atari.8bit Subject: VT52B: Yet Another Terminal Emulator (Part 2 of 3) Message-ID: <953@jumbo.dec.com> Date: Mon, 28-Sep-87 12:32:37 EDT Article-I.D.: jumbo.953 Posted: Mon Sep 28 12:32:37 1987 Date-Received: Tue, 29-Sep-87 06:16:10 EDT Organization: DEC Systems Research Center, Palo Alto Lines: 192 Keywords: terminal emulator VT52 ACTION ------------------------------------------------------------------------------ VT52B Documentation Overview -------- VT52B consists of two modules. One is a fairly general handler for an "A:" device that manages a 24 x 80 screen. It provides a character-oriented output device that recognizes embedded escape sequences. These escape sequences perform various display control functions. They support a subset of the VT52 terminal capabilities plus a few extensions needed for incremental display updates. The other module is a very simple (perhaps too simple) terminal protocol manager that attempts to coordinate the K:, R: and A: devices to emulate an extended VT52 terminal. The A: handler uses techniques of display list management that are by now fairly standard and well-known. I hope that most of the code will be fairly scrutable to an experienced ACTION! programmer. I will not attempt to explain it here but I will try to answer any specific questions that arise. The A: Handler -------------- The following VT52 escape sequences are supported: esc-A moves cursor up one line esc-B moves cursor down one line esc-C moves cursor right one column esc-D moves cursor left one column esc-H homes cursor esc-I reverse line feed esc-J clears from cursor to end of screen esc-K clears from cursor to end of line esc-Y positions cursor (see VT52 specs for X,Y encoding) The following extensions are also supported: esc-F enters 'stand-out' (inverse video) mode esc-G exits 'stand-out' mode esc-L inserts blank character space at the cursor esc-M deletes character at the cursor esc-N inserts blank line at the cursor esc-O deletes line containing the cursor A suitable UNIX termcap entry appears at the end of this file. The extension codes have been chosen to be compatible with the "VT-52XL" terminal supported by Chameleon, and the same termcap should be suitable for both. The support for 'stand-out' mode has not been extensively tested, but it is good enough to do Emacs mode lines and the like. Its use is a mixed blessing, however, since the inverted video can be much less readable. To disable it, remove the next-to-last line from the suggested termcap. The code could easily be modified to support 'insert' and 'delete' modes directly, and the corresponding incremental updates would be considerably faster. I have not done this because such modality can be disastrous over a noisy or unreliable line. When the A: device is opened, it allocates space for its display bit maps and custom display lists from the top of available memory as recorded in MEMTOP (location $2E5) and updates MEMTOP. These data structures require approximately 8200 bytes. If sufficient space is not available, the open fails and MEMTOP is not changed. Terminal Emulation ------------------ ASCII characters not on the Atari keyboard can be entered as follows: { ctrl-< or shift-< } ctrl-> or shift-> ~ ctrl-backS or shift-backS ` ctrl-. The emulator does not provide flow control; buffer overruns drop characters. In my experience, this is never a problem at 1200 baud and is not a problem at 2400 for screen-at-a-time output. The program cannot keep up with continuous output at 2400 baud. The ASCII bell character (^G) produces no visible or audible output. Installation ------------ You will need an ACTION! cartridge to compile and run this program. You might also have to edit the source to select the options you require, since there is no provision for changing these at runtime. The configuration of the 850 interface (or similar R: interface) is controlled by the following variables, which are declared and initialized at the beginning of the main program module: speed, wsize, sbits, lf, iparity, oparity See the 850 manual for tables of possible values and their meanings. Note that the value of 'speed' is 7 less than the tabulated value, e.g., speed baud rate 1 300 2 600 3 1200 5 2400 Alternatively, you can modify the calls of XIO_R in the procedure init_R; these variables are not used elsewhere. As it stands, VT52B supports a 1200 baud modem with 8-bit words, 2 stop bits and no parity. Many monitors will actually display 25 or 26 lines of text. You can take advantage of this by changing the following definitions at the beginning of the module for the A: handler: NL number of screen lines (normally 24) NB number of skip lines in top border (normally 3) LL *must* equal NL-1 DLSize *must* equal NB + 10*NL + 3 I have had good results with NL=25 and NB=2. If you change NL, be sure to change your termcap entry to agree. I experimented with several background colors for the display. I eventually settled on a pale blue that seemed to be the best compromise between contrast and flicker on my particular monitor. See the procedure init_A if you want to change this. The emulator module contains a procedure load_R. This is a machine-code insert essentially similar to the code in the autorun file that downloads the R: handlers from the 850. I added it when I was having some trouble with 850 (re)initialization. I left it in because it makes the object file somewhat smaller and easier to build. If you have a different interface unit or prefer a different handler, delete init_R and prepend your handler to the object file in the usual way. You must compile this program with lower case enabled. You must also compile it with space for the R: handlers reserved in low memory. The simplest way to do this is to load the handler you intend to use (by executing the AUTORUN.SYS file, for example) before compiling VT52B.ACT. You can then execute the compiled program directly or save it for later execution using the DOS "L" command or equivalent. If you deleted init_R, you must prepend an appropriate R: handler. Alternatively, you can set the code origin to reserve space for your handler as described on page 144 of the ACTION! manual. You are in terminal emulation mode as soon as execution begins. Note: At least some versions of the 850 will not download the R: handlers a second time until the power has been cycled on either the console computer or the 850. Thus if you load the handlers (e.g., with the standard AUTORUN.SYS file), do something that destroys them (e.g., going to DOS without a MEM.SAV file) and then attempt to reload them, you will be left without warning with bad handlers. Suggested Termcap Entry ----------------------- Here's one that has worked for me: dw|vt52|decvt52:\ :cr=^M:do=^J:nl=^J:bl=^G:le=^H:bs:cd=\EJ:ce=\EK:\ :cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#24:nd=\EC:ta=^I:pt:sr=\EI:\ :up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H: a1|atari|atari vt52 emulator:\ :am:pt:tc=vt52: a2|atari+|vt52xl|atari vt52+ emulator:\ :al=\EN:dl=\EO:im=:ei=:ic=\EL:dm=:ed=:dc=\EM:\ :so=\EF:se=\EG:\ :tc=atari: Note that it can take some extra work to get your favorite program to notice changes in the terminal type and capabilities. If the program is able to use the escape sequences, you should notice a definite difference between vt52 and atari+ termcap entries. Here's a script from our system administrator that works for Emacs: #! /bin/csh -f # # vt52b-mode - setup terminal for vt52b mode. # stty dec new cr0 set noglob setenv TERMCAP atari.termcap setenv TERM atari+ eval `tset -s -I -Q` set term = atari+ unset noglob Replace "atari.termcap" with the name of the file containing a termcap entry similar to the one above. ----------------------------------------------------------------------------- Ed Satterthwaite Arpa: ehs@src.DEC.COM Uucp: {...}!decwrl!ehs