25-Jul-86 09:14:45-EDT,21426;000000000001 Received: from CUVMA by CU20B with HASP; 25 Jul 86 09:14:40 EDT Received: by CUVMA (Mailer X1.23a) id 1521; Fri, 25 Jul 86 01:00:24 EDT Date: 07/24 18:56:11 From: FDCCU@CUVMA Subject: PEPAP MAIL - PUN file from RSCS Tag: FILE (2717) ORIGIN HARVARDA PEPMNT 7/23/86 23:32:10 E.D.T. To: SY.FDC@CU20B Reply-To: PEPMNT@HARVARDA Date: Wed, 23-JUL-1986 23:17 EST From: Bob Babcock Subject: Sanyo Kermit sources, 3 of 3 To: pepmnt@harvarda Original_To: JNET%"jrd@usu",JNET%"pepmnt@harvarda" NAME msz55x ; File MSZ55X.ASM ; Last edit 10 July 1986 ; Make vtsound public so it can be called from msx55x. ; Convert MSZIBM.ASM to Sanyo 55x version [rwb] ; Fix parameter decanm not being updated in stblmds under soft reset. ; 21 May 1986 [jrd] page 60,132 ; Terminal emulator module for IBM PC's and compatibles. Emulates Heath-19, ; VT52, and VT102 (without printer modes). ; Change method of displaying underlined characters from IBM official 'blue ; character on a black field' (which shows as a true underline on the mono- ; chrome adatper but not the color ones) to a simple reveral of the video, ; leaving intact the preexisting blink and intensity attributes. Change is ; in procedure atsgr3: [jrd] ; Revise underlining procedure to use true underlining on monochrome display ; adapters; byte crt_mode is 7 for the monochrome display adaper mode. [jrd] ; Add delete char procedure for use when local echoing is done. [jrd] ; Correct code for special character handling in right-most column. Strange ; deletion display is the way a VT100 actually does it. ; Add (partial) code to support Set Term Color fore back. ; Add code to enable use of 25th line by Heath-19 mode. Mode line should be ; off to prevent overwriting normal mode line text and vice versa. ; Add revisions by Howie Kaye (CU) to permit 25th line operation with DEC ; emulation modes. [jrd] ; Add screen on/off in delete char code to suppress snow on IBM CGA's. [jrd] ; Adjust code to accomodate change in intensity without reseting screen. [jrd] ; Add full double wide/high character support. Double width characters are ; shown as the char followed by a space with the same video attributes as the ; character. Scrolling, cursor movements, char/line insert/delete, erasing, ; tab setting, etc work in both single and double character forms. Byte array ; "linetype" holds the line type for each line on the screen: byte = 0 for ; normal single width, byte = 1 for double width (double height forces ; double width), and byte = 2 for double height. Linetype is scrolled with ; the screen display lines; however, manual scrolling of the screen is not ; known to the emulator. ; Logical screen coordinates are held in "cursor" and register DX; physical ; coordinates are calculated from logical ones. 29 March 1986 [jrd] ; Complete "soft reset" of terminal emulator if terminal type is changed ; at the Kermit prompt level. Procdure stblmds tests for change of type and ; resets scrolling margins, insert mode & 25th line flags, double wide chars, ; and DEC flags. Screen is left intact and there is no beep. 5 April 86 [jrd] ; Add routine atmline to rewrite mode line in current colors/intensity ; without invoking a full terminal reset. 10 April 1986 [jrd] ; Correct parsing of ANSI escape sequences which have a numeric argument ; greater than 127; limit value to 127 rather than abort seq. ; Improve Heath-19 escape sequence handling. Add ESC * > to list of ignored ; sequences for VT102 (Brian Nelson says it is a VT200 special operation). ; 5 May 86 [jrd] ; ; Edit history ; [2.29] [jrd] ; Take this code from MS Kermit 2.27 [IU]; upgrade and incorporate in 2.29. ; Add VT102 char/line insert/delete, merge Heath-19 code (add some features). ; Add ability to toggle between Heath-19, VT52, and VT100 modes (Alt minus). ; Make VT52 mode stand alone. Reset (Alt =) does not change terminal type. ; Screen scrolling is located in module msyibm, as are several other support ; procedures needed to communicate with the rest of Kermit. ; "Setup" values are determined by Kermit's Set commands in mssset, ; but some initial values are determined by constant vsdefaults specified ; in mssdefs.h, in case mssset is not called. ; Communication with mssset is via structure vtemu. ; Communication with msyibm is via structure vtemu, public data quantities ; mar_top, mar_bot (screen line number scrolling limits), jwait (retrace flag), ; scbattr (screen background attributes byte), ; and through the public procedures listed below. Note, there are some ; definite machine dependencies left here (time limits being what they are) ; but most have been removed to msyibm. ; Topview support is included for char/line insert/delete. ; The structure of display attributes is that of the IBM PC where screen ; memory is laid out as display char byte, attribute byte, etc. The top ; left corner of the screen is coord 0,0 and the status line ends on 24,79. ; This module uses Bios calls (int 10, video i/o) and in/outs to the timer ; chip for sounds (beeps and key clicks). ; Absorb without action the VT102 printer control escape sequences, especially ; ESC [ Pn i and ESC [ ? Pn i. ; Fixed destruction of host-set tabs when returning to connect mode. ; Note -- persons preferring no beep when the emulator initializes may ; comment out the line "call vtbell" at the end of procedure atreset. ; [Joe R. Doupnik, Utah State Univ] ; ; [IU2] JAH 27-Jun-85 ; Add ANSI (VT100) terminal emulator. Put it in a separate module, MSZIBM. ; public anstty, ansini, ansrei, ansdsl, anstat, anskbi ; Entry points public ans52t, vclick, vsinit public vtsound ; [rwb] public mar_top, mar_bot, jwait ; data for msyibm include mssdef.h ; * Disclaimer * ; ; DEC and VT are trademarks of Digital Equipment Corporation. ; ; There is a naming convention ; for the ANSI and VT100 functions and flags; generally, the stuff in the ; symbol after "ans" or "at" is the function or mode mnemonic used in the ; VT100 manual. ; ; Every effort has been made to make the VT100 emulation as much like the ; real thing as possible. The reference used was the VT100 User's Guide, 2nd ; ed. Jan. 1979, DEC part no. EK-VT100-UG. Some aspects of the behavior ; of the terminal (e.g., the interaction of the "origin mode", limited ; scrolling region, and indexing), were gleaned from programming experiments ; on an actual VT100 terminal. Implemented features include: (1) Limited ; scolling region, (2) Settable tab stops, (3) Special "graphics" character ; set and UK ASII set, (4) All graphic renditions (underline, blink, and ; high intensity), (5) Simulated "LEDs" on the mode line, (6) Screen mode ; (normal or reverse video), (7) All terminal reports (status, active position, ; terminal parameters, and device attributes), (8) The ANSI new-line mode and ; several of the DEC private modes, including keypad application, cursor key, ; screen, auto-wrap, and origin, (9) cursor position/graphic rendition/ ; character set save/restore, and last (and probably least): (10) VT52 com- ; patibility mode. Also, various details of behavior required by the ANSI ; standard (e.g. most control characters do not affect the interpretation of ; the current escape sequence, relative cursor positioning (up, down, left ; right, and of course tab) stop at the screen margins, etc.) have been ; scrupulously observed. ; ; This was the first thing I ever wrote in 8088 assembler (some of it was ; stolen from MSYIBM), and one of the constraints was that the emulator ; should work with a vanilla PC with a monochrome monitor. Given these and ; other constraints, no attempt was made to implement the following VT100 ; features: (1) Smooth scolling, (2) 132 column lines, (3) Auto repeat, ; (5) Interlace/no interlace, (6) Double-width/double-height lines. The ; escape sequences to set and reset these are recognized, but ignored. ; ; - James A. Harvey, IUPUI Computing Services, DEC Systems Group ; ; * End of Disclamer * ; --------------------------------------------------------------------------- ; ; Description of the global entry points and calls on external routines ; needed by this emulator. [jrd] ; ; vsinit - start up routine called as Kermit initializes. Takes no arguments. ; Sets up address pointers to tabs, reads default terminal parameters ; reads current screen coloring. Examines and updates structure ; "vtemu." which is how mssset communicates changed information ; about many Set Term parameters; "flags." is a Kermit structure ; carrying the other Set Term parameters. ; anstty - starting point for displaying a character, delivered in AL. ; Returns when the display operation is completed and that may ; take many many instructions. All normal "characters received by ; the terminal" are provided by calling anstty with the char in AL. ; ansini - entry point to initialize the emulator. It requires information ; from msy in four registers: the Kermit terminal routine flags ; "yflags" (used mainly to sense debug mode and the mode line toggle) ; "low_rgt" (bh = row, bl = column of the lower right display corner) ; "lbaudtab" (index into baud rate table, for status reporting) ; "lpartab" (index into parity table, for status reporting) ; Ansini causes a full reset of the emulator, including screen ; clearing and a beep. Ansini is also called by msy in response to ; sensing the Alt = key combination to fully reset the emulator. ; ansrei - entry point to reinitialize the emulator. Nearly the same as ; ansini except operating flags, tabs, etc are retained from the ; previous emulator session. Items which can be changed by Set Term ; are examined and updated. The msy flags "yflags" are needed. ; This is the warm-restart entry point used when connect mode ; is reentered gracefully. The screen is cleared only if the coloring ; has changed. The starting cursor location is whereever msy puts it. ; ansdsl - display "led" (status line) information. Invoked by msy when ; the mode line is constructed so the emulator can write the ; terminal type and the VT100 led status lights when Connect mode ; is started. Requires "yflags" from msy to sense whether the mode ; line is to be shown. ; anstat - reports our working flags and screen coloring to msy. Nearly ; obselete but not quite. Reads msy "yflags" and reports "mlbattr" ; the video attributes used on the mode line, "scbattr" the video ; attributes of an empty character cell (background), "curattr" ; the video attributes of displayable characters, and "ansflgs" ; the emulator's working flags (needed for keyboard translations ; done in msy). ; anskbi - a routine called by msy to notify the emulator that a character ; is available from the keyboard. No character is read, just flag ; ttkbi is set. This is actually used only to beep when the cursor ; goes beyond column 72 and the margin bell flag is on. ; ans52t - called by msy to change terminal types "on the fly" without ; fully updating all operating parameters and without losing setup ; information. Msy senses the Alt minus key and calls ans52t with ; no arguments. Ans52t cycles among VT102, VT52 and Heath-19 modes. ; vclick - called by msy to cause a click sound. Simulates keyboard clicks, ; sort of anyway. No arguments. ; other modules in msy are called by this file to handle screen scrolling ; mode line on/off, output to the serial port (reports), screen ; particulars (location, cursor shape, blanking). The list is ; the set of code extrn procedures below; all are in file msy. ; ; data exchange is directly with msy to assist in scrolling (varaibles ; "mar_top", "mar_bot", "jwait") and in sensing the non-connect ; mode screen coloring ("scbattr"). Screen coloring controlled by ; the emulator is not permitted to influence the non-connect mode ; screens whereas the emulator attempts to use the regular Kermit ; screen colors as defaults. The kind of terminal to emulate is ; held in byte "flags.vtflg" which is set by Set Term and by this ; module for global information within Kermit. ; ; The emulator assumes the screen is laid out in the manner of a conventional ; IBM monochrome or color graphics adapter running in 80 column TEXT ; modes. That layout is one word per displayable location starting at ; the upper left corner (0,0) and running contiguously to the lower ; right corner (24,79). Each word holds the displayable character in ; the low order byte and the display attributes in the high order ; byte. Attributes are, from high to low bits: blinking on, back- ; ground red, green, and blue on, high intensity, foreground red, ; green, and blue on. Normal white chars on a black field is 07H. ; The starting segment of screen memory is given by msy module ; "scrseg" to be TopView/MS Windows compatible. Msy module "scrsync" ; is used to inform these windowing environments of memory updates. ; Variable "crt_mode" is set by msy to indicate which IBM display ; mode is active; only the monochrome and CGA modes are recognized. ; Direct reading and writing of display memory is done, compatibly ; with TopView/Windows, to attain speed over Bios and DOS calls ; when editing of previously entered text is needed. However, IBM ; Bios interrupt 10H is used where possible for normal cursor ; movement/sensing and writing of new characters. See the IBM PC ; hardware Technical Reference Manuals for further details. ; ; Many things have been added, or modified since James Harvey donated this ; code to Columbia University for use in Kermit. [jrd] ; --------------------------------------------------------------------------- screen equ 10h ; Bios screen call att_low_mask equ 06H ; Various attribute-related equates ;;;att_reverse equ 70H ; these two are now storable items ;;;att_normal equ 07H ; to allow external settings. [jrd] att_underline equ 01H att_intensity equ 08H att_blink equ 80H ; VT100 status flags ansflg ;anslnm equ 01H ; ANSI line feed/new line mode ;decckm equ 02H ; VT100 cursor keys mode ;deckpam equ 04H ; VT100 keypad application mode ;decscnm equ 08H ; VT100 screen mode (n.y.i.) ;decom equ 10H ; VT100 origin mode ;decawm equ 20H ; VT100 autowrap mode ;decanm equ 40H ; ANSI(VT100)/VT52 mode ;decmode equ 80H ; "?" seen in lead-in ;;;;;;;;;;;;;;;; items for reference from mssdef.h ;;;;;;;;;;;;; ; VT100 SETUP mode flags ;vsscreen equ 40H ; Screen mode (0 = normal video) ;vscursor equ 20H ; Cursor (0 = block) ;vsmarginbell equ 10H ; Margin bell (0 = off) ;vskeyclick equ 08H ; Keyclick (0 = off) ;vsshift3 equ 04H ; Shift-3 (0 = American pound sign) ;vswrap equ 02H ; Line wrap around (0 = no wrap) ;vsnewline equ 01H ; ANSI new line (0 = off) ;vsdefaults equ 0+vscursor ;[IU1] Definitions for terminal emulation ;TTGENRC EQU 0 ;[IU1] Type 0 - TTY (no special emulation) ;TTHEATH EQU 1 ;[IU1] Type 1 - HEATH 19 ;TTVT52 EQU 2 ; [jrd] Type 2 - VT52 ;TTVT100 EQU 3 ;[IU1] Type 3 - ANSI (VT100 subset) ;TTTYPES EQU 4 ;[IU1] Number of terminal types defined ;emulst struc ; structure of vtemu.xxx for VT100 emulator ;vtflgst db 0 ; VT100 setup flags (from SET) ;vttbs dw 0 ; pointer to default tab stops, for SET ;vttbst dw 0 ; pointer to active tab stops, for STATUS ;att_ptr dw 0 ; pointer to normal & reverse video attributes ;emulst ends ;;;;;;;;;;;;;;;; end references ;;;;;;;;;;;;;;;;;;;; datas segment public 'datas' extrn vtemu:byte, crt_mode:byte, scbattr:byte, flags:byte ; [jrd] ; Early versions of MASM have a bug that causes it to consider the ; expression (offset foo) as non-relocatable if used in an arithmetic ; operation (for example, "sub di,offset foo"), and if foo is defined ; within the first 256 bytes of the data segment. ; ANSI special character table - 32 entries indexed by control char value ansspc dw 5 dup (atign) ; ignore NUL,SOH,STX,ETX,EOT dw decid ; ENQ - answerback message dw atign ; ACK - ignore dw atbel ; BEL - ring terminal bell dw atbs ; BS - ANSI backspace dw atht ; HT - ANSI tab dw atlf ; LF - ANSI line feed dw atlf ; VT - Interpreted as ANSI LF dw atlf ; FF - Interpreted as ANSI LF dw atcr ; CR - ANSI carriage-return dw atso ; SO - Select char set G1 dw atsi ; SI - Select char set G0 dw 8 DUP (atign) ; ignore DLE,DC1,DC2,DC3,DE4,NAK,SYN,ETB dw atcan ; CAN - cancel ANSI sequence dw atign ; EM - ignore dw atcan ; SUB - treat as CAN dw atesc ; ESC - ANSI CSI. dw 4 DUP (atign) ; ignore FS,GS,RS,US ; Heath-19 mode escape follower table h19esc db 'YABCD', 'KIHJF', 'G=>','<','Z' db '7','8','c' lv52esc equ $-v52esc ; length of table ; Dispatch for v52esc table v52ejt dw v52pos,atcuu,atcud,atcuf,atcub dw atel,atri,atcup,ated,v52egm dw v52xgm,atkpam,atkpnm,v52ans,decid dw atsc,atrc,v52ris ; ANSI escape special character table ansesc db '[','D','E','M','H' db '7','8','=','>','c' db '(',')','#','Z','\' db '<','P','*' lansesc equ $-ansesc ; length of table ; Dispatch for ansesc table ansejt dw atcsi,atind,atnel,atri,athts dw atsc,atrc,atkpam,atkpnm,atris dw atsg0,atsg1,atsdhl,decid,atpriv dw atpriv,atpriv,atpriv ; Final char table for ANSI escape sequences (ESC [ Pn ; ... Pm ch) anstab db 'H','A','B','C','D' db 'K','J','m','g','r' db 'c','q','x','n','f' db 'l','h','y','P','L' db 'M','i','s','u','z' lanstab equ $-anstab ; Define table length ; Dispatch for anstab table ansjmp dw atcup,atcuu,atcud,atcuf,atcub dw atel,ated,atsgr,attbc,atstbm dw atda,atll,atreqt,atdsr,atcup dw atrm,atsm,atctst,atdelc,inslin dw dellin,atnorm,htsc,htrc,htrest ; "Special graphics" set translation table for characters 137 (octal) ; through 176 when the special graphics set is selected. Some characters ; (142, 143, 144, 145, 150, 151, 157, 160, 162, 163, and 174) do not ; have exact equivalents in the available set on the IBM, so a (some- ; times reasonably close) substitution is made. Table is indexed by ; ASCII char value minus 137 octal for chars 137-176 octal. sgrtab db 032,004,177,026,023