Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0135/10/vista.sim
There are 6 other files named vista.sim in the archive. Click here to see a list.
00030	COMMENT* package for control of display terminals*; OPTIONS(/l/e);
00060	COMMENT* Copyright (c) Swedish National Defense Research Institute*;
00090	COMMENT%IFNOT MACRO;
00120	COMMENT COMMENT%IF SIMULATION marks places to be modified to put
00150	vista as a subclass to simulation;
00180	COMMENT COMMENT%IF MVISTA marks places to give simplified
00210	minivista for use by VIDED package;
00240	COMMENT COMMENT%IF MACRO generates MACRO-10 program code defining
00270	global variables only;
00300	COMMENT COMMENT%IF CALLMAC generates SIMULA code calling MACRO
00330	versions of some procedures;
00360	
00390	COMMENT%IF MACRO
00420	        UNIVERSAL VTMVDA
00450	        .DIRECTIVE .NOBIN
00480	        SALL
00510	;! No sorting of parameters, simple def of WRD macro
00540	        DEFINE WRD(X,T,L)<
00570	        C$==<X==C$>+1>
00600	        DEFINE WORD(X)<WRD(X,A,1)>
00630	        DEFINE REF(X)<WRD(X,R,1)>
00660	        DEFINE TEXT(X)<WRD(X,T,2)>
00690	        SYN WORD,INTEGER
00720	        SYN WORD,BOOLEAN
00750	        SYN WORD,CHARACTER
00780	        SYN REF,ARRAY
00810	
00840	        C$==2   ;! Initial offset (no prefix)
00870	COMMENT%IFNOT MACRO;
00900	
00930	COMMENT%IF MVISTA
00960	EXTERNAL CHARACTER PROCEDURE getch;
00990	EXTERNAL TEXT PROCEDURE maketext;
01020	COMMENT%IFNOT MVISTA;
01050	EXTERNAL CHARACTER PROCEDURE insinglechar;
01080	COMMENT%IFEND MVISTA;
01110	EXTERNAL CHARACTER PROCEDURE fetchar;
01140	EXTERNAL PROCEDURE depchar, outstring, forceout;
01170	EXTERNAL PROCEDURE echo, abort, outchr;
01200	EXTERNAL INTEGER PROCEDURE trmop, gettab, checkint;
01230	EXTERNAL BOOLEAN PROCEDURE meny;
01260	EXTERNAL TEXT PROCEDURE storbokstav, scanto;
01290	EXTERNAL CLASS termty;
01320	COMMENT%IF CALLMAC
01350	EXTERNAL PROCEDURE vtmcur, vtsynk, vtisng;
01380	EXTERNAL PROCEDURE outche; EXTERNAL INTEGER PROCEDURE iondx;
01410	COMMENT%IFNOT MVISTA;
01440	EXTERNAL BOOLEAN PROCEDURE tmpout;
01470	EXTERNAL TEXT PROCEDURE tmpin;
01500	EXTERNAL INTEGER PROCEDURE checkreal;
01530	
01560	COMMENT%IFNOT SIMULATION;
01590	CLASS vista
01620	COMMENT%IF MVISTA
01650	COMMENT%IF CALLMAC
01680	CLASS mmista;
01710	COMMENT%IFNOT CALLMAC
01740	COMMENT%IFNOT SIMSET
01770	CLASS mvista;
01800	COMMENT%IF SIMSET
01830	CLASS msista;
01860	COMMENT%IFEND SIMSET
01890	COMMENT%IFEND CALLMAC
01920	COMMENT%IF MVISTA
01950	BEGIN
01980	COMMENT%IF SIMSET
02010	simset CLASS mvistax
02040	COMMENT%IFNOT SIMSET
02070	CLASS mvistax
02100	COMMENT%IFEND SIMSET
02130	COMMENT%IFEND MVISTA
02160	COMMENT%IF SIMULATION
02190	Simulation CLASS vistas
02220	COMMENT%IFEND SIMULATION;
02250	(width, height, terminalin, terminalout, q_echoenabled,
02280	terminaltype
02310	COMMENT%IFNOT MVISTA;
02340	, extraterminal, extraparameters);
02370	COMMENT%IFNOT MVISTA;
02400	VALUE extraterminal;
02430	COMMENT%IFNOT MACRO;
02460	COMMENT%IF MVISTA
02490	,trmspeed);
02520	COMMENT%IFEND MVISTA;
02550	COMMENT%IFEND MACRO;
02580	INTEGER width; ! Screen width or less;
02610	INTEGER height; ! Screen height or less;
02640	COMMENT%IFNOT MACRO;
02670	REF (infile) terminalin; ! From the terminal, usually sysin;
02700	REF (printfile) terminalout; ! To the terminal, usually sysout;
02730	BOOLEAN q_echoenabled; ! TRUE = monitor echo, FALSE = program echo;
02760	COMMENT%IF MACRO
02790	REF termin
02820	REF termout
02850	BOOLEAN qechoenabled
02880	COMMENT%IFNOT MACRO;
02910	INTEGER terminaltype; ! Number of terminal type, 0 for not given;
02940	COMMENT%IF MACRO
02970	INTEGER trmtyp
03000	COMMENT%IFEND MACRO;
03030	COMMENT%IF MVISTA
03060	INTEGER trmspeed;
03090	COMMENT%IFNOT MVISTA;
03120	TEXT extraterminal; ! Text name of additional terminal type;
03150	TEXT extraparameters; ! Cursor control codes for this terminal type;
03180	COMMENT%IFEND MVISTA;
     
03210	COMMENT%IFNOT MACRO;
03240	COMMENT%IFNOT MVISTA;
03270	NOT HIDDEN PROTECTED q_echoenabled, q_display_output, terminalin,
03300	terminalout, synka, cpunumber, vt52, minitec,
03330	elite, kthelite, infoton, newelite, newkthelite, teletec, sattelite,
03360	tandberg, beehive, cdc71310s, cdc71310p, elite3025,
03390	elite1521, volkerd404, volker414h, buginfoton, lowintens, highintens,
03420	otherdisplay, i200, adm3a, vt100, fut3, fut2, fut1, ttyform,
03450	get_char_from_screen, scrollallow, echon, echoff, unknownchar,
03480	q_gotchar, cancel_display, extraparameters, synchronize,  allow_cr,
03510	home_the_cursor, erasescreen, outchar, normaltext, specialtext,
03540	outimage, outtext, make_blank, move_the_cursor_to, trmspeed,
03570	blank_the_screen, stopblink, startblink, bell, q_verticalpos,
03600	eraseline, line_erasable, deleteline, insertline, deletechar,
03630	q_horizontalpos, up, down, left, right, altmode, restorechar,
03660	carriagereturn, linefeed, home, fill, null, tab, formfeed, verttab,
03690	terminaltype, screen, badscreen, controlchar, addaltmode, height,
03720	heightm1, width, widthm1, resume_display, delayer,
03750	upsingle, downsingle, leftsingle, rightsingle, homesingle,
03780	clearsingle, linesingle, eraseeol, insertchar;
03810	NOT HIDDEN PROTECTED insingle;
03840	NOT HIDDEN PROTECTED direct_cursor_addressing, leftimage;
03870	NOT HIDDEN PROTECTED stop_blink, start_blink, cause_real_time_delay,
03900	restore_the_whole_screen, blank_line, displaying, outint, outfrac,
03930	outreal, outfix, restore_one_char, inreal, inint, inimage, inyes,
03960	inword, verticalpos, horizontalpos, echoenabled, terminaloutimage,
03990	set_char_on_screen;
04020	COMMENT%IF SIMSET
04050	NOT HIDDEN Linkage, Link, Head;
04080	COMMENT%IFEND SIMSET;
04110	COMMENT%IF SIMULATION
04140	NOT HIDDEN Linkage, Link, Head;
04170	COMMENT%IF SIMULATION
04200	NOT HIDDEN Process, Time, Current, Passivate,
04230	Wait, Hold , Cancel, Accum, Main;
04260	COMMENT%IFEND SIMULATION;
04290	COMMENT%IFEND MVISTA;
     
04320	COMMENT%IF MVISTA
04350	VIRTUAL: PROCEDURE restore_the_whole_screen;
04380	COMMENT%IFEND MVISTA;
04410	BEGIN
04440	
04470	
04500	COMMENT%IFEND MACRO;
04530	COMMENT%IF MACRO
04560	;! Variables in a block are sorted in order:
04590	;! 1) Non-relocatable, 2) TEXT, 3) REF and ARRAY
04620	
04650	        IF1,<A$B==<R$B==<T$B==0>>> ;! Initial counters
04680	        DEFINE  WRD(X,T,L)<
04710	        IF2,<IFDEF X,<PRINTX ERROR X redefinition>
04740	        T'$B==<X==T'$B>+L>
04770	        IF1,<IFE T'$B,<T'$B==C$>
04800	        C$==C$+L>>
04830	COMMENT%IFEND MACRO;
04860	BOOLEAN scrollallow; ! Allow <LF> to scroll the screen;
04890	COMMENT%IFNOT MACRO;
04920	BOOLEAN direct_cursor_addressing; ! Move cursor that way;
04950	BOOLEAN allow_cr; ! Allow sending of <CR> code to the terminal;
04980	COMMENT%IF MACRO
05010	BOOLEAN directcursoraddressing; !
05040	BOOLEAN allowcr;
05070	COMMENT%IFEND MACRO;
05100	BOOLEAN synka; ! Cursor may be at wrong place on terminal screen;
05130	BOOLEAN unknownchar; ! Last read character was untreated char < ' ';
05160	BOOLEAN synchronizing; ! True during "synchronize" action only;
05190	INTEGER cpunumber; ! From monitor tables;
05220	INTEGER vt52; ! code for DEC VT52 terminal type;
05250	INTEGER minitec; ! code for TEC minitec terminal type;
05280	INTEGER elite; ! code for elite 2500 with auto-<LF> at <CR>;
05310	INTEGER kthelite; ! code for elite 2500 without auto-<LF> at <CR>;
05340	INTEGER infoton; ! code for infoton vista terminal type;
05370	INTEGER newelite; ! code for elite 1500 with auto-<LF> at <CR>;
05400	INTEGER newkthelite; ! code for elite 1500 without auto-<LF> at <CR>;
05430	INTEGER teletec; ! code for TEC teletec terminal type;
05460	INTEGER sattelite; ! code for INFOTON vistar sattelite;
05490	INTEGER tandberg; ! code for TANDBERG TDV 2000 terminal type;
05520	INTEGER beehive; ! code for minibee and BEEHIVE B 100 terminals;
05550	COMMENT%IFNOT MACRO;
05580	INTEGER cdc71310s; ! CDC 713-10 terminals, scroll mode;
05610	INTEGER cdc71310p; ! CDC 713-10 terminals, page mode;
05640	COMMENT%IF MACRO
05670	INTEGER cdc73s
05700	INTEGER cdc73p
05730	COMMENT%IFEND MACRO;
05760	INTEGER elite3025; ! Datamedia Elite 3025 terminal;
05790	INTEGER elite1521; ! Datamedia Elite 1521 terminal;
05820	COMMENT%IFNOT MACRO;
05850	INTEGER volkerd404; ! Volker 404 terminal;
05880	INTEGER volker414h; ! Volker 414h terminal;
05910	COMMENT%IF MACRO
05940	INTEGER vc404
05970	INTEGER vc414h
06000	COMMENT%IFEND MACRO;
06030	INTEGER buginfoton; ! Infoton without erase line feature;
06060	INTEGER i200; ! Infoton I 200 terminal;
06090	INTEGER adm3a; ! ADM 3 A terminal;
06120	INTEGER vt100; ! Digital VT 100 terminal in Vt52 mode;
06150	INTEGER fut3; ! Reserved for future terminal models;
06180	INTEGER fut2; ! Reserved for future terminal models;
06210	INTEGER fut1; ! Reserved for future terminal models;
06240	INTEGER otherdisplay; ! Unknown display terminal;
06270	INTEGER maxterminals; ! 1 more than highest terminal type number;
06300	INTEGER ttyform; ! tty form setting before being called;
06330	COMMENT%IFNOT MVISTA (declared earlier %IF MVISTA);
06360	INTEGER trmspeed; ! speed of line to terminal in bits/second;
06390	COMMENT%IFEND MVISTA;
06420	COMMENT%IFNOT MACRO;
06450	INTEGER q_verticalpos; ! Current cursor position vertically;
06480	INTEGER q_horizontalpos; ! Current cursor position horizontally;
06510	COMMENT%IF MACRO
06540	INTEGER qverticalpos; !
06570	INTEGER qhorizontalpos;
06600	COMMENT%IFNOT MACRO;
06630	INTEGER widthm1; ! One less than screen width;
06660	INTEGER heightm1; ! One less than screen height;
06690	COMMENT%IF MACRO
06720	INTEGER widm1
06750	INTEGER heim1
06780	COMMENT%IFEND MACRO;
06810	INTEGER ioindex; ! comment for sysout, used by outche;
06840	CHARACTER lowintens; ! change to low intensity on screen;
06870	CHARACTER highintens; ! change to high intensity on screen;
06900	CHARACTER up; ! cursor up;
06930	CHARACTER left; ! cursor left;
06960	CHARACTER right; ! cursor right;
06990	CHARACTER down; ! cursor movement codes;
07020	CHARACTER formfeed; ! ASCII character;
07050	CHARACTER eraseline; ! Erases rest of line on some terminals;
07080	CHARACTER delayer;
07110	CHARACTER home; ! code to move cursor to upper left screen corner;
07140	COMMENT* ON CDC 713-10, this code moves to lower left corner*;
07170	CHARACTER carriagereturn; ! ASCII character;
07200	CHARACTER altmode; ! ASCII ESCAPE character, decimal 27;
07230	CHARACTER restorechar; ! code which, when given from terminal
07260	;! causes screen to be restored (usually = altmode);
07290	CHARACTER linefeed; ! ASCII character;
07320	CHARACTER verttab; ! ASCII vertical tab character;
07350	CHARACTER null; ! ASCII character with decimal 0 value;
07380	CHARACTER tab; ! ASCII horizontal tab (HT) character;
07410	CHARACTER insline; ! inserts line on some terminal models;
07440	CHARACTER delline; ! deletes line on some terminal models;
07470	CHARACTER inschar; ! inserts character on some terminal models;
07500	CHARACTER delchar; ! deletes character on some terminal models;
07530	COMMENT%IFNOT MACRO;
07560	CHARACTER q_gotchar; ! Character inputted from the terminal;
07590	COMMENT%IF MACRO
07620	CHARACTER qgotchar;
07650	COMMENT%IFEND MACRO;
07680	CHARACTER startblink; ! Code to start blinking on terminal screen;
07710	CHARACTER bell; ! ASCII character;
07740	CHARACTER stopblink; ! Code to stop blinking on terminal screen;
07770	CHARACTER fill; ! Character with decimal value 127, RUB OUT code;
07800	CHARACTER erasescreen; ! Code to make the whole screen blank;
07830	COMMENT%IFNOT MACRO;
07860	CHARACTER address_screen; ! Code to start direct cursor addressing;
07890	
07920	BOOLEAN line_erasable; ! True if eraseline is effective;
07950	INTEGER lineinsfillers; ! Number of fillers after insert line;
07980	COMMENT%IF MACRO
08010	CHARACTER addressscreen; !
08040	
08070	BOOLEAN lineerasable; !
08100	BOOLEAN lineinsertable; !
08130	COMMENT%IFEND MACRO;
08160	BOOLEAN addaltmode; ! Terminal control codes to be preceded by ESC;
08190	BOOLEAN upsingle; ! TRUE = no escape in front of cursor up;
08220	BOOLEAN downsingle;
08250	BOOLEAN leftsingle;
08280	BOOLEAN rightsingle;
08310	BOOLEAN homesingle;
08340	BOOLEAN clearsingle; ! TRUE = no escape in front clear screen;
08370	BOOLEAN linesingle; ! TRUE = no escape in front of clear line;
08400	COMMENT%IFNOT MACRO;
08430	BOOLEAN q_display_output; ! Screen is to be output to the terminal;
08460	COMMENT%IF MACRO
08490	BOOLEAN qdisplayoutput;
08520	COMMENT%IFEND MACRO;
08550	BOOLEAN badscreen; ! Terminal screen may be jumbled;
08580	BOOLEAN controlchar; ! Last input char was terminal control code;
08610	BOOLEAN ttyqz; ! Local for QZ computer centre;
08640	BOOLEAN ttyzq; ! Local for QZ computer centre;
08670	
08700	COMMENT%IFNOT MACRO;
08730	TEXT deleteline; ! Removes line, scrolls rest of screen up;
08760	TEXT insertline; ! Adds blank line, scroll rest down;
08790	TEXT deletechar; ! Removes char, shifts rest to the left;
08820	TEXT eraseeol; ! Erase to end of line;
08850	TEXT insertchar; ! insert character;
08880	COMMENT%IFEND MACRO;
08910	COMMENT%IF MACRO
08940	TEXT deletline
08970	TEXT inserline
09000	TEXT deletchar
09030	TEXT eraseeol
09060	TEXT inserchar
09090	COMMENT%IFEND MACRO;
09120	TEXT leftimage; ! Image with left code in first position;
09150	COMMENT%IFNOT CALLMAC;
09180	COMMENT%IFNOT MACRO;
09210	TEXT elitecursors; ! Direct cursor adress table for elite terminals;
09240	COMMENT%IFEND MACRO;
09270	COMMENT%IFEND CALLMAC;
09300	COMMENT%IFNOT MVISTA;
09330	TEXT terminaloutimage; ! image of terminalout file class;
09360	COMMENT%IF MVISTA
09390	TEXT extraparameters;
09420	
09450	COMMENT%IF MACRO
09480	ARRAY screen ; ! TEXT ARRAY screen[0:height-1];
09510	COMMENT%IFNOT MACRO;
09540	TEXT ARRAY screen[0:height-1]; ! Internal copy of screen contents;
09570	COMMENT%IF MVISTA
09600	COMMENT%IFNOT CALLMAC
09630	REF (q_insingle) p_q_insingle; ! CALLing class faster than       ;
09660	COMMENT%IF MVISTA
09690	REF (insingle) p_insingle; !     procedure call;
09720	COMMENT%IFEND CALLMAC
09750	COMMENT%IFEND MVISTA;
     
09780	COMMENT%IFNOT mvista;
09810	
09840	INTEGER PROCEDURE horizontalpos; horizontalpos:= q_horizontalpos;
09870	COMMENT to stop users changing the internal variable with
09900	the current horizontal cursor position;
09930	
09960	INTEGER PROCEDURE verticalpos; verticalpos:= q_verticalpos;
09990	COMMENT current vertical cursor position;
10020	
10050	BOOLEAN PROCEDURE echoenabled; echoenabled:= q_echoenabled;
10080	COMMENT to stop users changing the internal variable telling
10110	if input chars are echoed by the program or the monitor;
10140	
10170	BOOLEAN PROCEDURE displaying; displaying:= q_display_output;
10200	COMMENT to stop users chaning the internal variable telling
10230	if picture is to be displayed on the terminal screen;
10260	
10290	COMMENT%IFEND mvista;
     
10320	PROCEDURE echon;
10350	BEGIN COMMENT to start monitor echoing of input characters;
10380	  !z_t(1); !z_t(-2); q_echoenabled:= TRUE;
10410	  IF q_display_output THEN echo(terminalin,4);
10440	END;
10470	
10500	PROCEDURE echoff;
10530	BEGIN COMMENT to start program echoing of input characters;
10560	  !z_t(-1); !z_t(2); q_echoenabled:= FALSE;
10590	  IF q_display_output THEN echo(terminalin,2);
10620	END;
     
10650	PROCEDURE resume_display;
10680	COMMENT to start displaying the picture on the terminal screen;
10710	IF NOT q_display_output THEN
10740	BEGIN !z_t(3); !z_t(-4); q_display_output:= TRUE;
10770	  COMMENT%IFNOT MVISTA;
10800	  restore_the_whole_screen;
10830	  COMMENT%ENDIF MVISTA;
10860	  echo(terminalin,IF q_echoenabled THEN 4 ELSE 2);
10890	END;
10920	
10950	PROCEDURE cancel_display;
10980	COMMENT to stop displaying the picture on the terminal screen;
11010	IF q_display_output THEN
11040	BEGIN !z_t(-3); !z_t(4); COMMENT erase screen;
11070	  IF addaltmode AND NOT homesingle THEN
11100	  outchr(terminalout,altmode,1);
11130	  outchr(terminalout,home,1);
11160	  IF addaltmode AND NOT clearsingle
11190	  THEN outchr(terminalout,altmode,1);
11220	  outchr(terminalout,erasescreen,1); outchr(terminalout,delayer,10);
11250	  forceout(terminalout);
11280	  q_display_output:= FALSE;
11310	  echo(terminalin,4);
11340	END;
     
11370	COMMENT%IFNOT MVISTA;
11400	PROCEDURE cause_real_time_delay(number_of_fillers);
11430	  COMMENT: Causes a moving picture on the screen to move slower by
11460	  outputting a number_of_fillers. Example: If the speed of the
11490	  terminal is 240 characters/second, then cause_real_time_delay(120)
11520	  will cause a 0.5 seconds delay;
11550	INTEGER number_of_fillers;
11580	IF q_display_output THEN
11610	outchr(terminalout,delayer,number_of_fillers);
11640	COMMENT%IFEND MVISTA;
     
11670	CHARACTER PROCEDURE get_char_from_screen(h, v);
11700	  COMMENT: If (h,v) indicates a position on the screen, then the
11730	  character in that position is returned. If (h, v) indicates a
11760	  position outside the screen, then char(0) is returned;
11790	INTEGER h, v;
11820	IF v >= 0 AND v <= height THEN
11850	BEGIN
11880	  get_char_from_screen:= fetchar(screen(v),h+1);
11910	END;
     
11940	COMMENT%IFEND MVISTA;
11970	PROCEDURE specialtext;
12000	COMMENT depending on terminal type, this procedure may give
12030	text which is low intensity, inverse video or underlined. Does
12060	not work on all terminal types;
12090	IF lowintens NE char(0) THEN
12120	BEGIN
12150	  IF addaltmode THEN outchr(terminalout,altmode,1);
12180	  IF terminaltype = elite3025 THEN outchr(terminalout,'O',1);
12210	  outchr(terminalout,lowintens,1);
12240	END;
12270	
12300	PROCEDURE normaltext;
12330	IF highintens NE char(0) THEN
12360	BEGIN
12390	        COMMENT indicate normal text again by intensity
12420	        shift or normal video;
12450	  IF addaltmode THEN outchr(terminalout,altmode,1);
12480	  IF terminaltype = elite3025 THEN outchr(terminalout,'O',1);
12510	  outchr(terminalout,highintens,1);
12540	  outchr(terminalout,delayer,1);
12570	END;
12600	
12630	COMMENT%IFNOT MVISTA;
12660	
12690	PROCEDURE start_blink;
12720	  COMMENT will start blinking screen text and output a a space on
12750	  the screen;
12780	BEGIN COMMENT on infoton terminals, blinking text is between start
12810	  blink and stop blink codes on the screen. On most other terminals,
12840	  blinking text is text sent between sending start blink and stop
12870	  blink codes to the terminal;
12900	  IF terminaltype = infoton OR terminaltype = cdc71310s
12930	  OR terminaltype = cdc71310p THEN
12960	  outchar(startblink) ELSE outchar(' ');
12990	  IF terminaltype = minitec OR terminaltype = beehive
13020	  OR terminaltype = elite3025 THEN
13050	  BEGIN outchr(terminalout,altmode,1);
13080	    IF terminaltype = elite3025 THEN outchr(terminalout,'O',1);
13110	    outchr(terminalout,startblink,1);
13140	  END ELSE IF terminaltype >= elite
13170	  AND terminaltype <= newkthelite
13200	  THEN outchr(terminalout,startblink,1);
13230	  outchr(terminalout,bell,1);
13260	END;
13290	COMMENT%IFEND MVISTA;
     
13320	COMMENT%IFNOT MVISTA;
13350	
13380	PROCEDURE stop_blink;
13410	  COMMENT will stop blinking screen text and output a a space on the
13440	  screen;
13470	BEGIN
13500	  IF terminaltype = infoton OR terminaltype = cdc71310s
13530	  OR terminaltype = cdc71310p THEN
13560	  outchar(stopblink) ELSE outchar(' ');
13590	  IF terminaltype = minitec OR terminaltype = beehive
13620	  OR terminaltype = elite3025 THEN
13650	  BEGIN outchr(terminalout,altmode,1);
13680	    IF terminaltype = elite3025 THEN outchr(terminalout,'O',1);
13710	    outchr(terminalout,stopblink,1);
13740	  END ELSE IF terminaltype >= elite
13770	  AND terminaltype <= newkthelite
13800	  THEN synchronize(q_horizontalpos,q_verticalpos);
13830	END;
13860	COMMENT%IFEND MVISTA;
     
13890	PROCEDURE synchronize(hnew, vnew);
13920	  COMMENT: If there is a risk that the program does not know where
13950	  the cursor is on the screen, then this procedure will anyway for
13980	  sure move the cursor to the position (hnew, vnew);
14010	INTEGER hnew, vnew;
14040	COMMENT%IFNOT CALLMAC;
14070	IF q_display_output THEN
14100	BEGIN
14130	  IF NOT direct_cursor_addressing THEN local_home_the_cursor
14160	  ELSE synchronizing:= TRUE;
14190	  move_the_cursor_to(hnew,vnew);
14220	  synchronizing:= FALSE;
14250	END;
14280	COMMENT%IF CALLMAC
14310	vtsynk(heightm1,hnew,vnew);
     
14340	COMMENT%IFNOT MVISTA;
14370	PROCEDURE restore_the_whole_screen;
14400	  COMMENT: If the picture of the screen has been destroyed, then a
14430	  call to this procedure will make the picture on the screen equal
14460	  to the internal picture in the program;
14490	IF q_display_output THEN
14520	INSPECT terminalout DO
14550	BEGIN
14580	  INTEGER h, v, hold, vold;
14610	  hold:= q_horizontalpos; vold:= q_verticalpos;
14640	  echo(terminalin,IF q_echoenabled THEN 4 ELSE 2);
14670	  home_the_cursor; breakoutimage;
14700	  IF addaltmode AND NOT clearsingle THEN
14730	  outchr(terminalout,altmode,1);
14760	  outchr(terminalout,erasescreen,1); outchr(terminalout,delayer,10);
14790	  q_horizontalpos:= q_verticalpos:= 0;
14820	  FOR v:= 0 STEP 1 UNTIL heightm1 DO
14850	  BEGIN
14880	    IF screen[v].strip =/= NOTEXT THEN
14910	    BEGIN
14940	      IF allow_cr THEN outchr(terminalout,carriagereturn,1)
14970	      ELSE home_the_cursor;
15000	      move_the_cursor_to(0,v); breakoutimage;
15030	      outstring(terminalout,screen[v].strip);
15060	    END;
15090	  END;
15120	  synchronize(hold,vold);
15150	END;
15180	COMMENT%IFEND MVISTA;
     
15210	COMMENT%IFNOT CALLMAC;
15240	PROCEDURE true_outchr(c); CHARACTER c;
15270	BEGIN
15300	  COMMENT at the QZ computer centre, certain national characters are
15330	  sometimes converted by the monitor before transmitting them to the
15360	  terminal. This will cause errors if these characters are used for
15390	  direct cursor addressing. This procedure makes the inverse
15420	  conversion first, so that the correct code will be output;
15450	  IF ttyqz THEN
15480	  BEGIN IF ttyzq THEN
15510	    BEGIN
15540	      IF c = char(00035) THEN c:= char(124) ELSE
15570	      IF c = char(00036) THEN c:= char(126) ELSE
15600	      IF c = char(00064) THEN c:= char(92) ELSE
15630	      IF c = char(00091) THEN c:= char(35) ELSE
15660	      IF c = char(00092) THEN c:= char(64) ELSE
15690	      IF c = char(00093) THEN c:= char(36) ELSE
15720	      IF c = char(00096) THEN c:= char(91) ELSE
15750	      IF c = char(00124) THEN c:= char(96) ELSE
15780	      IF c = char(00126) THEN c:= char(93);
15810	    END ELSE
15840	    BEGIN
15870	      IF c = char(00035) THEN c:= char(91) ELSE
15900	      IF c = char(00036) THEN c:= char(93) ELSE
15930	      IF c = char(00064) THEN c:= char(92) ELSE
15960	      IF c = char(00091) THEN c:= char(35) ELSE
15990	      IF c = char(00092) THEN c:= char(64) ELSE
16020	      IF c = char(00093) THEN c:= char(36) ELSE
16050	      IF c = char(00096) THEN c:= char(124) ELSE
16080	      IF c = char(00124) THEN c:= char(96);
16110	    END;
16140	  END ELSE IF ttyzq THEN
16170	  BEGIN
16200	    IF c = char(00035) THEN c:= char(96) ELSE
16230	    IF c = char(00036) THEN c:= char(126) ELSE
16260	    IF c = char(00096) THEN c:= char(35) ELSE
16290	    IF c = char(00126) THEN c:= char(36);
16320	  END;
16350	  outchr(terminalout,c,1);
16380	END of procedure true_outchr;
16410	COMMENT%IFEND CALLMAC;
     
16440	PROCEDURE move_the_cursor_to(horiz, vertic);
16470	  COMMENT: Will move the cursor to the position(horiz, vertic) on
16500	  the screen;
16530	INTEGER horiz, vertic;
16560	  COMMENT%IF CALLMAC
16590	  vtmcur(cpunumber,horiz,vertic);
16620	COMMENT%IFNOT CALLMAC;
16650	BEGIN
16680	  INTEGER i;
16710	  !z_t(5);
16740	  IF q_display_output THEN
16770	  BEGIN
16800	    COMMENT%IFNOT MVISTA;
16830	    IF badscreen THEN
16860	    BEGIN badscreen:= FALSE; restore_the_whole_screen;
16890	    END;
16920	    COMMENT%IFEND MVISTA;
16950	    IF direct_cursor_addressing THEN
16980	    BEGIN
17010	      ! Do not move if you are already there;
17040	      IF NOT synchronizing AND horiz = q_horizontalpos
17070	      AND vertic = q_verticalpos THEN GOTO moved;
17100	
17130	      IF terminaltype = minitec THEN
17160	      BEGIN
17190	        outchr(terminalout,altmode,1);
17220	        outchr(terminalout,address_screen,1);
17250	        true_outchr(char(127-horiz));
17280	        true_outchr(char(127-vertic));
17310	      END ELSE IF terminaltype >= elite
17340	      AND terminaltype <= kthelite THEN
17370	      BEGIN
17400	        outchr(terminalout,address_screen,1);
17430	        true_outchr(fetchar(elitecursors,horiz+1));
17460	        true_outchr(fetchar(elitecursors,vertic+1));
17490	      END ELSE IF terminaltype = newelite
17520	      OR terminaltype = newkthelite OR terminaltype = elite1521
17550	      OR terminaltype = i200 OR terminaltype = elite3025 THEN
17580	      BEGIN
17610	        IF addaltmode THEN outchr(terminalout,altmode,1);
17640	        outchr(terminalout,address_screen,1);
17670	        true_outchr(char(8r040+horiz));
17700	        true_outchr(char(8r040+vertic));
17730	      END ELSE IF terminaltype = volker414h THEN
17760	      BEGIN
17790	        outchr(terminalout,altmode,1); forceout(terminalout);
17820	        outche(ioindex,address_screen); !DEC-10 transmits DC1 as
17850	        DC1+DEL;
17880	        true_outchr(char(IF horiz < 32 THEN horiz+96
17910	        ELSE horiz));
17940	        true_outchr(char(vertic+64));
17970	      END ELSE
18000	      BEGIN
18030	        IF addaltmode THEN outchr(terminalout,altmode,1);
18060	        outchr(terminalout,address_screen,1);
18090	        true_outchr(char(8r040+vertic));
18120	        true_outchr(char(8r040+horiz));
18150	      END;
18180	      GOTO moved;
18210	    END;
18240	    IF terminaltype = tandberg THEN
18270	    BEGIN COMMENT TANDBERG TDV 2000 is funny on last screen line;
18300	      IF q_verticalpos = heightm1 AND vertic < heightm1 THEN
18330	      BEGIN outchr(terminalout,home,1);
18360	        q_horizontalpos:= q_verticalpos:= 0;
18390	      END;
18420	    END;
18450	    IF horiz < q_horizontalpos//2 THEN
18480	    BEGIN
18510	      q_horizontalpos:= 0;
18540	      IF allow_cr AND vertic > q_verticalpos//2 THEN
18570	      outchr(terminalout,carriagereturn,1) ELSE
18600	      BEGIN
18630	        IF addaltmode AND NOT homesingle
18660	        THEN outchr(terminalout,altmode,1);
18690	        outchr(terminalout,home,1);
18720	        IF terminaltype = cdc71310s THEN q_verticalpos:= heightm1
18750	        ELSE q_verticalpos:= 0;
18780	      END;
18810	    END;
18840	    IF addaltmode THEN
18870	    BEGIN
18900	      FOR i:= horiz+1 STEP 1 UNTIL q_horizontalpos DO
18930	      BEGIN IF NOT leftsingle THEN outchr(terminalout,altmode,1);
18960	        outchr(terminalout,left,1);
18990	      END;
19020	      FOR i:= q_horizontalpos+1 STEP 1 UNTIL horiz DO
19050	      BEGIN IF NOT rightsingle THEN outchr(terminalout,altmode,1);
19080	        outchr(terminalout,right,1);
19110	      END;
19140	      FOR i:= vertic+1 STEP 1 UNTIL q_verticalpos DO
19170	      BEGIN IF NOT upsingle THEN outchr(terminalout,altmode,1);
19200	        outchr(terminalout,up,1);
19230	      END;
19260	      FOR i:= q_verticalpos+1 STEP 1 UNTIL vertic DO
19290	      BEGIN IF NOT downsingle THEN outchr(terminalout,altmode,1);
19320	        outchr(terminalout,down,1);
19350	      END;
19380	    END ELSE
19410	    BEGIN
19440	      outchr(terminalout,right,horiz-q_horizontalpos);
19470	      outchr(terminalout,left,q_horizontalpos-horiz);
19500	      outchr(terminalout,down,vertic-q_verticalpos);
19530	      outchr(terminalout,up,q_verticalpos-vertic);
19560	    END;
19590	  END;
19620	  moved:
19650	  q_horizontalpos:= horiz; q_verticalpos:= vertic;
19680	  !z_t(-5);
19710	END;
19740	COMMENT%IFEND CALLMAC;
     
19770	COMMENT%IFNOT MVISTA;
19800	PROCEDURE set_char_on_screen(setchar,horiz,vertic);
19830	  COMMENT: Will output the character "setchar" onto the position
19860	  (horiz,vertic) on the screen;
19890	CHARACTER setchar; INTEGER horiz, vertic;
19920	BEGIN
19950	  move_the_cursor_to(horiz, vertic);
19980	  BEGIN
20010	    IF setchar = fill THEN setchar:= ' ' ELSE
20040	    IF setchar < ' ' THEN setchar:= ' ';
20070	    IF q_display_output THEN
20100	    BEGIN outchr(terminalout,setchar,1);
20130	      IF addaltmode THEN
20160	      BEGIN IF NOT leftsingle THEN
20190	        outchr(terminalout,altmode,1);
20220	      END;
20250	      outchr(terminalout,left,1);
20280	    END;
20310	    depchar(screen[q_verticalpos],q_horizontalpos+1,setchar);
20340	  END;
20370	  IF q_horizontalpos = width THEN
20400	  BEGIN
20430	    synchronize(0,q_verticalpos+1);
20460	  END;
20490	END;
20520	COMMENT%IFEND MVISTA;
     
20550	PROCEDURE outchar(setchar);
20580	  COMMENT  Will output the character "setchar" onto the place where
20610	  the cursor is on the screen. Thereafter, the cursor is advanced to
20640	  the position after the outputted character;
20670	CHARACTER setchar;
20700	BEGIN
20730	  BEGIN
20760	    IF setchar = fill THEN setchar:= ' ' ELSE
20790	    IF setchar < ' ' THEN
20820	    BEGIN
20850	      IF terminaltype <= 2 THEN !infoton or vt52;
20880	      BEGIN
20910	        IF setchar NE startblink AND setchar NE stopblink
20940	        THEN setchar:= ' ' ELSE outchr(terminalout,bell,1);
20970	      END ELSE setchar:= ' ';
21000	    END;
21030	    IF q_display_output THEN outchr(terminalout,setchar,1);
21060	    depchar(screen[q_verticalpos],q_horizontalpos+1,setchar);
21090	  END;
21120	  q_horizontalpos:= q_horizontalpos+1;
21150	  IF q_horizontalpos = width THEN
21180	  BEGIN
21210	    synchronize(0,q_verticalpos+1);
21240	  END;
21270	END;
     
21300	COMMENT%IFNOT MVISTA;
21330	PROCEDURE blank_line(v); INTEGER v;
21360	COMMENT will make  line v blank on the screen;
21390	BEGIN
21420	  move_the_cursor_to(0,v);
21450	  IF q_display_output THEN
21480	  BEGIN
21510	    IF line_erasable THEN
21540	    BEGIN outstring(terminalout,eraseeol);
21570	    END ELSE
21600	    BEGIN INTEGER blank_field;
21630	      blank_field:= screen(v).strip.length+1;
21660	      outchr(terminalout,' ',blank_field);
21690	      IF allow_cr THEN outchr(terminalout,carriagereturn,1)
21720	      ELSE synchronize(0,v);
21750	    END;
21780	  END;
21810	  screen(v):= NOTEXT;
21840	END;
21870	COMMENT%IFEND MVISTA;
     
21900	PROCEDURE outimage;
21930	  COMMENT: Will output any characters in the terminalout.image
21960	  buffer and will then move the cursor to the beginning of the
21990	  next line on the screen;
22020	INSPECT terminalout DO
22050	BEGIN
22080	  CHARACTER lastout;
22110	  IF q_display_output THEN
22140	  BEGIN
22170	    IF allow_cr AND terminaltype NE tandberg THEN
22200	    BEGIN outchr(terminalout,carriagereturn,1);
22230	      outchr(terminalout,linefeed,1);
22260	    END ELSE
22290	    BEGIN
22320	      move_the_cursor_to(0,q_verticalpos+1);
22350	      q_verticalpos:= q_verticalpos-1;
22380	    END;
22410	  END;
22440	  IF allow_cr OR NOT q_display_output THEN
22470	  q_verticalpos:= q_verticalpos+1;
22500	  IF q_verticalpos >= height THEN q_verticalpos:=
22530	  q_verticalpos-height;
22560	  q_horizontalpos:= 0;
22590	  forceout(terminalout);
22620	END;
     
22650	PROCEDURE outtext(tt); NAME tt; TEXT tt;
22680	COMMENT: Will output a text string onto the screen;
22710	BEGIN TEXT screenpart;
22740	  ! screenpart is part of screen to which t is to be output;
22770	  IF tt.length+q_horizontalpos <=width THEN
22800	  BEGIN
22830	    !z_t(6);
22860	    screenpart:- screen[q_verticalpos].
22890	    sub(q_horizontalpos+1,tt.length);
22920	    screenpart:= tt;
22950	    IF q_display_output THEN
22980	    BEGIN
23010	      outstring(terminalout,screenpart);
23040	    END;
23070	    q_horizontalpos:= q_horizontalpos+tt.length;
23100	    COMMENT%IFNOT MVISTA;
23130	    IF q_horizontalpos > widthm1 THEN
23160	    move_the_cursor_to(0,q_verticalpos);
23190	    COMMENT%IFEND MVISTA;
23220	    !z_t(-6);
23250	  END;
23280	END;
     
23310	PROCEDURE make_blank(size); INTEGER size;
23340	  COMMENT will make part of the screen blank, beginning at the
23370	  current cursor position, and continuing size characters;
23400	BEGIN
23430	  TEXT notblankpart;
23460	  notblankpart:- screen[q_verticalpos]
23490	  .sub(q_horizontalpos+1,size).strip;
23520	  notblankpart:= NOTEXT;
23550	  IF q_display_output THEN
23580	  BEGIN
23610	    IF (IF line_erasable THEN
23640	    size + q_horizontalpos >= width ELSE FALSE) THEN
23670	    BEGIN IF terminaltype = i200 THEN
23700	      BEGIN IF q_horizontalpos > 0 THEN GOTO blankit;
23730	      END; ! since erase line blanks the whole line;
23760	      outstring(terminalout,eraseeol);
23790	    END ELSE blankit: outchr(terminalout,' ',notblankpart.length);
23820	  END;
23850	  q_horizontalpos:= q_horizontalpos+notblankpart.length;
23880	END;
     
23910	COMMENT%IFNOT MVISTA;
23940	PROCEDURE outfix(a,i,j); REAL a; INTEGER i, j;
23970	COMMENT similar to SIMULA outfix procedure;
24000	BEGIN
24030	  TEXT t;
24060	  t:- screen[q_verticalpos].sub(q_horizontalpos+1,j);
24090	  t.putfix(a,i);
24120	  IF q_display_output THEN
24150	  outstring(terminalout,t);
24180	  q_horizontalpos:= q_horizontalpos+j;
24210	  IF q_horizontalpos > widthm1 THEN
24240	  move_the_cursor_to(0,q_verticalpos);
24270	END;
24300	COMMENT%IFEND MVISTA;
     
24330	COMMENT%IFNOT MVISTA;
24360	PROCEDURE outreal(a,i,j); REAL a; INTEGER i, j;
24390	COMMENT similar to SIMULA outreal procedure;
24420	BEGIN
24450	  TEXT t;
24480	  t:- screen[q_verticalpos].sub(q_horizontalpos+1,j);
24510	  t.putreal(a,i);
24540	  IF q_display_output THEN
24570	  outstring(terminalout,t);
24600	  q_horizontalpos:= q_horizontalpos+j;
24630	  IF q_horizontalpos > widthm1 THEN
24660	  move_the_cursor_to(0,q_verticalpos);
24690	END;
24720	COMMENT%IFEND MVISTA;
     
24750	COMMENT%IFNOT MVISTA;
24780	PROCEDURE outfrac(a,i,j); INTEGER a, i, j;
24810	COMMENT similar to SIMULA outfrac procedure;
24840	BEGIN
24870	  TEXT t;
24900	  t:- screen[q_verticalpos].sub(q_horizontalpos+1,j);
24930	  t.putfrac(a,i);
24960	  IF q_display_output THEN
24990	  outstring(terminalout,t);
25020	  q_horizontalpos:= q_horizontalpos+j;
25050	  IF q_horizontalpos > widthm1 THEN
25080	  move_the_cursor_to(0,q_verticalpos);
25110	END;
25140	COMMENT%IFEND MVISTA;
     
25170	COMMENT%IFNOT MVISTA;
25200	PROCEDURE outint(i,j); INTEGER i, j;
25230	COMMENT similar to SIMULA outint procedure;
25260	BEGIN
25290	  TEXT t;
25320	  t:- screen[q_verticalpos].sub(q_horizontalpos+1,j);
25350	  t.putint(i);
25380	  IF q_display_output THEN
25410	  outstring(terminalout,t);
25440	  q_horizontalpos:= q_horizontalpos+j;
25470	  IF q_horizontalpos > widthm1 THEN
25500	  move_the_cursor_to(0,q_verticalpos);
25530	END;
25560	COMMENT%IFEND MVISTA;
     
25590	COMMENT%IFNOT MVISTA;
25620	PROCEDURE restore_one_char(horiz,vertic);
25650	  COMMENT: Will restore the character in the position (horiz,
25680	  vertic) to what the program believes is in that position on
25710	  the screen;
25740	INTEGER horiz, vertic;
25770	IF horiz >= 0 AND horiz < width AND vertic >= 0 AND
25800	vertic < height AND q_display_output THEN
25830	set_char_on_screen(get_char_from_screen(horiz,vertic),
25860	horiz,vertic);
25890	COMMENT%IFEND MVISTA;
     
25920	COMMENT%IF mvista
25950	COMMENT%IFNOT CALLMAC
25980	CLASS q_insingle
26010	COMMENT%IFNOT mvista;
26040	PROCEDURE p_q_insingle
26070	(echo)
26100	COMMENT%IFEND MVISTA;
26130	;
26160	  COMMENT: Will input one character from the terminal without
26190	  waiting for a carriage return. Can also input "left"=^Z,
26220	  which cannot be input with inimage;
26250	COMMENT%IFNOT MVISTA;
26280	BOOLEAN echo;
26310	COMMENT%IFEND MVISTA;
26340	BEGIN
26370	  COMMENT%IF MVISTA
26400	  loop: detach;
26430	  COMMENT%IFNOT MVISTA;
26460	  IF NOT q_display_output THEN
26490	  abort("VISTA input without picture showing");
26520	  COMMENT%IFNOT MVISTA;
26550	  q_gotchar:= insinglechar(terminalin);
26580	  COMMENT%IF MVISTA
26610	  q_gotchar:= getch;
26640	  COMMENT%IFEND MVISTA;
26670	  IF q_gotchar = fill THEN
26700	  BEGIN
26730	    IF q_horizontalpos > 0 THEN
26760	    BEGIN
26790	      COMMENT%IF MVISTA
26820	      IF addaltmode and NOT leftsingle THEN
26850	      outchr(terminalout,altmode,1);
26880	      COMMENT%IF MVISTA
26910	      outchr(terminalout,left,1);
26940	      COMMENT%IF MVISTA
26970	      outchr(terminalout,' ',1);
27000	      COMMENT%IF MVISTA
27030	      IF addaltmode and NOT leftsingle THEN
27060	      outchr(terminalout,altmode,1);
27090	      COMMENT%IF MVISTA
27120	      outchr(terminalout,left,1);
27150	      COMMENT%IF MVISTA
27180	      depchar(screen[q_verticalpos],q_horizontalpos,' ');
27210	      COMMENT%IF MVISTA
27240	      q_horizontalpos:= q_horizontalpos-1;
27270	      COMMENT%IFNOT MVISTA;
27300	      set_char_on_screen(' ',q_horizontalpos-1,q_verticalpos);
27330	      COMMENT%IFEND MVISTA;
27360	    END;
27390	  END;
27420	  IF
27450	  COMMENT%IFNOT MVISTA;
27480	  echo AND
27510	  COMMENT%IFEND MVISTA;
27540	  NOT q_echoenabled THEN
27570	  BEGIN IF q_gotchar = tab THEN q_gotchar:= ' ';
27600	    IF terminaltype NE tandberg THEN
27630	    outchr(terminalout,q_gotchar,1) ELSE
27660	    outchr(terminalout,
27690	    IF q_gotchar = linefeed AND q_horizontalpos < heightm1 THEN
27720	    down ELSE q_gotchar,1);
27750	  END;
27780	  COMMENT%IF MVISTA
27810	  GOTO loop;
27840	  COMMENT%IFEND MVISTA;
27870	END;
     
27900	COMMENT%IFNOT MVISTA;
27930	CHARACTER PROCEDURE insingle(echo);
27960	BOOLEAN echo;
27990	COMMENT%IFEND MVISTA;
28020	COMMENT%IF MVISTA
28050	CLASS insingle;
28080	COMMENT%IFEND MVISTA;
28110	BEGIN
28140	COMMENT%IF MVISTA
28170	  mainloop: detach;
28200	  COMMENT%IFEND MVISTA;
28230	  !z_t(7);forceout(terminalout);
28260	  COMMENT%IF MVISTA
28290	  call(p_q_insingle);
28320	  COMMENT%IFNOT MVISTA;
28350	  p_q_insingle(echo);
28380	  COMMENT%IFEND MVISTA;
28410	  controlchar:= IF q_gotchar < ' ' THEN TRUE ELSE
28440	  IF q_gotchar = fill THEN TRUE ELSE FALSE;
28470	  COMMENT%IFNOT MVISTA;
28500	  IF terminaltype = infoton THEN
28530	  BEGIN
28560	    IF controlchar THEN
28590	    BEGIN IF q_gotchar = startblink OR q_gotchar = stopblink
28620	      THEN controlchar:= FALSE;
28650	    END;
28680	  END;
28710	  COMMENT%IFEND MVISTA;
28740	  IF addaltmode THEN
28770	  BEGIN IF q_gotchar = altmode THEN
28800	    COMMENT%IF mvista
28830	    call(p_q_insingle);
28860	    COMMENT%IFNOT mvista;
28890	    p_q_insingle(echo);
28920	    COMMENT%IFEND MVISTA;
28950	  END;
28980	  COMMENT%IFNOT MVISTA;
29010	  IF controlchar AND
29040	  q_gotchar = restorechar OR q_gotchar = erasescreen THEN
29070	  restore_the_whole_screen;
29100	  insingle:= q_gotchar;
29130	  COMMENT%IFEND MVISTA;
29160	  COMMENT%IFNOT MVISTA;
29190	  IF echo THEN
29220	  COMMENT%IFEND MVISTA;
29250	  BEGIN
29280	    IF NOT controlchar THEN
29310	    BEGIN COMMENT to be stored in screen;
29340	      depchar(screen[q_verticalpos],q_horizontalpos+1,
29370	      q_gotchar);
29400	      q_horizontalpos:= q_horizontalpos+1;
29430	      IF q_horizontalpos >= width THEN
29460	      BEGIN ! wrap cursor around at screen borders;
29490	        IF q_verticalpos < heightm1 THEN
29520	        synchronize(0,q_verticalpos+1) ELSE
29550	        COMMENT%IFNOT MVISTA;
29580	        IF scrollallow THEN
29610	        COMMENT%IFEND MVISTA;
29640	        BEGIN outchr(terminalout,linefeed,1);
29670	          synchronize(0,heightm1); badscreen:= TRUE;
29700	          COMMENT unwanted scrolling of screen has occured;
29730	        END
29760	        COMMENT%IFNOT MVISTA
29790	        ELSE synchronize(widthm1,heightm1);
29820	        COMMENT%IFEND MVISTA;
29850	      END;
29880	    END ELSE
29910	    BEGIN COMMENT not to be stored on the screen;
29940	      COMMENT not printable AND echo;
29970	      unknownchar:= FALSE;
30000	      IF q_gotchar = linefeed THEN
30030	      BEGIN
30060	        IF q_verticalpos < heightm1 THEN
30090	        BEGIN IF allow_cr THEN
30120	          BEGIN q_verticalpos:= q_verticalpos+1;
30150	            IF q_echoenabled THEN
30180	            BEGIN
30210	              IF terminaltype = tandberg THEN
30240	              BEGIN
30270	                screen(q_verticalpos).sub(q_horizontalpos+1,
30300	                width-q_horizontalpos):= NOTEXT;
30330	              END;
30360	            END;
30390	          END ELSE
30420	          synchronize(q_horizontalpos,q_verticalpos+1);
30450	        END
30480	        COMMENT%IFNOT MVISTA
30510	        ELSE
30540	        BEGIN
30570	          IF NOT scrollallow THEN restore_the_whole_screen;
30600	        END;
30630	        COMMENT%IFEND MVISTA;
30660	      END ELSE
30690	      IF q_gotchar = carriagereturn THEN
30720	      q_horizontalpos:= 0 ELSE
30750	      IF q_gotchar = up THEN
30780	      BEGIN IF q_verticalpos = 0 THEN
30810	        synchronize(q_horizontalpos,heightm1)
30840	        ELSE
30870	        BEGIN
30900	          IF terminaltype = tandberg THEN
30930	          BEGIN IF q_verticalpos = heightm1 THEN synka:= TRUE;
30960	          END;
30990	          q_verticalpos:= q_verticalpos-1;
31020	        END;
31050	      END ELSE
31080	      IF q_gotchar = down THEN
31110	      BEGIN IF q_verticalpos >= heightm1 THEN
31140	        synchronize(q_horizontalpos,0) ELSE
31170	        q_verticalpos:= q_verticalpos+1;
31200	      END ELSE
31230	      IF q_gotchar = left THEN
31260	      BEGIN IF q_horizontalpos = 0 THEN
31290	        synchronize(widthm1,q_verticalpos) ELSE
31320	        q_horizontalpos:= q_horizontalpos-1;
31350	      END ELSE
31380	      IF q_gotchar = right THEN
31410	      BEGIN IF q_horizontalpos >= widthm1 THEN
31440	        synchronize(0,q_verticalpos) ELSE
31470	        q_horizontalpos:= q_horizontalpos+1;
31500	      END ELSE
31530	      IF q_gotchar = home THEN
31560	      BEGIN q_horizontalpos:= 0;
31590	        IF terminaltype = cdc71310s THEN q_verticalpos:= heightm1
31620	        ELSE q_verticalpos:= 0;
31650	      END ELSE
31680	      IF q_gotchar = eraseline THEN
31710	      BEGIN
31740	        IF line_erasable THEN screen[q_verticalpos].
31770	        sub(q_horizontalpos+1, width-q_horizontalpos):= NOTEXT;
31800	      END ELSE unknownchar:= TRUE;
31830	      IF synka THEN
31860	      BEGIN IF (IF q_echoenabled THEN NOT trmop(8R0001,terminalout,1)
31890	        = 1 !=type ahead from the terminal has occured;
31920	        ELSE TRUE) THEN
31950	        BEGIN synka:= FALSE;
31980	          IF q_echoenabled THEN
32010	          synchronize(q_horizontalpos, q_verticalpos) ELSE
32040	          restore_the_whole_screen;
32070	        END;
32100	      END;
32130	    END not printable, but echo;;
32160	  END;
32190	  !z_t(-7);
32220	  COMMENT%IF MVISTA
32250	  GOTO mainloop;
32280	  COMMENT%IFEND MVISTA;
32310	END;
     
32340	COMMENT%IFNOT MVISTA;
32370	PROCEDURE inimage;
32400	  COMMENT: Will input a line of text from the terminal into
32430	  the buffer terminalin.image;
32460	BEGIN
32490	  TEXT stripimage; CHARACTER c;
32520	  IF NOT q_display_output THEN
32550	  abort("VISTA input without picture showing");
32580	  readagain: forceout(terminalout);
32610	  BEGIN
32640	    terminalin.image:= NOTEXT; terminalin.image.setpos(1);
32670	    loop: c:= insingle(TRUE);
32700	    IF c EQ carriagereturn OR c EQ null THEN GOTO
32730	    loop;
32760	    IF c EQ linefeed THEN GOTO out;
32790	    IF c = fill THEN
32820	    BEGIN
32850	      IF terminalin.pos > 1 THEN
32880	      BEGIN
32910	        terminalin.setpos(terminalin.pos-1);
32940	        depchar(terminalin.image,terminalin.pos,' ');
32970	      END;
33000	      GOTO loop;
33030	    END;
33060	    terminalin.image.putchar(c);
33090	    IF c EQ altmode OR c EQ formfeed OR c EQ verttab
33120	    THEN GOTO out;
33150	    GOTO loop;
33180	    out: terminalin.image.setpos(1);
33210	  END;
33240	  IF terminalin.endfile THEN
33270	  BEGIN
33300	    terminalin.close; terminalin:- NEW infile("*");
33330	    terminalin.open(copy(leftimage));
33360	  END;
33390	END;
33420	COMMENT%IFEND MVISTA;
     
33450	COMMENT%IFNOT MVISTA;
33480	INTEGER PROCEDURE inint;
33510	COMMENT: Will search for and read an integer from the terminal;
33540	BEGIN
33570	  INTEGER vold, hold;
33600	  IF NOT q_display_output THEN
33630	  abort("VISTA input without picture showing");
33660	  forceout(terminalout);
33690	  vold:= q_verticalpos; hold:= q_horizontalpos; inimage;
33720	  WHILE checkint(terminalin.image) <= 0 DO
33750	  BEGIN
33780	    move_the_cursor_to(terminalin.image.strip.length+hold,
33810	    vold);
33840	    WHILE q_horizontalpos > hold DO
33870	    BEGIN
33900	      set_char_on_screen('?',q_horizontalpos-1,vold);
33930	    END;
33960	    move_the_cursor_to(hold,vold);
33990	    inimage;
34020	  END;
34050	  inint:= terminalin.image.getint;
34080	  synchronize(q_horizontalpos, q_verticalpos);
34110	END of inint;
34140	COMMENT%IFEND MVISTA;
     
34170	COMMENT%IFNOT MVISTA;
34200	REAL PROCEDURE inreal;
34230	COMMENT: Will search for and read an real from the terminal;
34260	BEGIN
34290	  INTEGER vold, hold;
34320	  IF NOT q_display_output THEN
34350	  abort("VISTA input without picture showing");
34380	  forceout(terminalout);
34410	  vold:= q_verticalpos; hold:= q_horizontalpos; inimage;
34440	  WHILE checkreal(terminalin.image) <= 0 DO
34470	  BEGIN
34500	    move_the_cursor_to(terminalin.image.strip.length+hold,
34530	    vold);
34560	    WHILE q_horizontalpos > hold DO
34590	    BEGIN
34620	      set_char_on_screen('?',q_horizontalpos-1,vold);
34650	    END;
34680	    move_the_cursor_to(hold,vold);
34710	    inimage;
34740	  END;
34770	  inreal:= terminalin.image.getreal;
34800	  synchronize(q_horizontalpos, q_verticalpos);
34830	END of inreal;
34860	COMMENT%IFEND MVISTA;
     
34890	COMMENT%IFNOT MVISTA;
34920	TEXT PROCEDURE inword;
34950	  COMMENT: Will search for and read a word from the terminal.
34980	  A word is any seqeuence of non-blank characters;
35010	BEGIN
35040	  INTEGER vold;
35070	  IF NOT q_display_output THEN
35100	  abort("VISTA input without picture showing");
35130	  forceout(terminalout);
35160	  vold:= q_verticalpos;
35190	  WHILE
35220	  terminalin.image.sub(terminalin.pos,
35250	  terminalin.length-terminalin.pos+1).strip.length = 0 DO
35280	  BEGIN
35310	    inimage; move_the_cursor_to(0,vold);
35340	  END;
35370	  WHILE terminalin.image.getchar NE ' ' AND
35400	  terminalin.image.more
35430	  DO;
35460	  inword:-
35490	  copy(terminalin.image.sub(1,terminalin.image.pos-2));
35520	  synchronize(q_horizontalpos, q_verticalpos);
35550	END;
35580	COMMENT%IFEND MVISTA;
     
35610	COMMENT%IFNOT MVISTA;
35640	BOOLEAN PROCEDURE inyes;
35670	  COMMENT: Will search for either "yes" or "no" in input from
35700	  the terminal and return TRUE if "yes" is found, FALSE if
35730	  "no" is found;
35760	BEGIN
35790	  TEXT answer; CHARACTER c; INTEGER vold;
35820	  IF NOT q_display_output THEN
35850	  abort("VISTA input without picture showing");
35880	  forceout(terminalout);
35910	  vold:= q_verticalpos-1;
35940	  tryagain:
35970	  inimage; answer:- terminalin.image.strip;
36000	  WHILE TRUE DO
36030	  BEGIN
36060	    c:= IF answer.more THEN answer.getchar ELSE
36090	    char(0);
36120	    IF c \= ' ' THEN
36150	    BEGIN
36180	      IF c = 'y' OR c = 'Y' THEN inyes:= TRUE ELSE
36210	      IF c = 'n' OR c = 'N' THEN inyes:= FALSE ELSE
36240	      BEGIN
36270	        synchronize(0,vold);
36300	        outtext(
36330	        "You answered neither yes nor NO. Try again."
36360	        );
36390	        outimage;
36420	        GOTO tryagain;
36450	      END;
36480	      GOTO out;
36510	    END;
36540	  END;
36570	  out: terminalin.setpos(terminalin.length+1);
36600	  synchronize(q_horizontalpos,q_verticalpos);
36630	END;
36660	COMMENT%IFEND MVISTA;
     
36690	COMMENT%IFNOT CALLMAC;
36720	PROCEDURE local_home_the_cursor;
36750	  COMMENT: Will move the cursor to the position (0,0),
36780	  the upper left corner of the screen, on CDC 71310 to
36810	  the lower left corner;
36840	BEGIN
36870	  IF q_display_output THEN
36900	  BEGIN
36930	    IF addaltmode AND NOT homesingle THEN
36960	    outchr(terminalout,altmode,1);
36990	    outchr(terminalout,home,1);
37020	  END;
37050	  q_verticalpos:= q_horizontalpos:= 0;
37080	  IF terminaltype = cdc71310s THEN q_verticalpos:= heightm1;
37110	END;
37140	COMMENT%IFEND CALLMAC;
     
37170	PROCEDURE home_the_cursor;
37200	  COMMENT: Will move the cursor to the position (0,0),
37230	  the upper left corner of the screen;
37260	BEGIN
37290	  IF q_display_output THEN
37320	  BEGIN
37350	    IF addaltmode AND NOT homesingle THEN
37380	    outchr(terminalout,altmode,1) ELSE
37410	    outchr(terminalout,home,1);
37440	    outchr(terminalout,home,1);
37470	    IF terminaltype = cdc71310s THEN outchr(terminalout,up,heightm1);
37500	  END;
37530	  q_verticalpos:= q_horizontalpos:= 0;
37560	END;
     
37590	PROCEDURE blank_the_screen;
37620	COMMENT: Will make the whole screen blank.;
37650	BEGIN
37680	  INTEGER h, v;
37710	  FOR v:= 0 STEP 1 UNTIL heightm1 DO
37740	  screen[v]:= NOTEXT;
37770	  IF q_display_output THEN
37800	  BEGIN
37830	    home_the_cursor;
37860	    IF addaltmode AND NOT clearsingle
37890	    THEN outchr(terminalout,altmode,1);
37920	    outchr(terminalout,erasescreen,1); outchr(terminalout,delayer,10);
37950	    home_the_cursor;
37980	    echo(terminalin,IF q_echoenabled THEN 4 ELSE 2);
38010	  END;
38040	END;
     
38070	COMMENT Execution of the CLASS VISTA starts here with initialization
38100	of local variables;
38130	COMMENT%IF mvista
38160	COMMENT%IFNOT callmac
38190	p_q_insingle:- NEW q_insingle;
38220	COMMENT%IF mvista
38250	p_insingle:- NEW insingle;
38280	COMMENT%IFNOT mvista;
38310	COMMENT%IFEND callmac;
38340	terminaloutimage:- terminalout.image;
38370	COMMENT%IFEND mvista;
38400	trmop(8r2017,terminalout,0); !.TTY FILL 0, please monitor no fill
38430	 chars;
38460	allow_cr:= TRUE; infoton:= 1; vt52:= 2;
38490	minitec:= 3; elite:= 4; kthelite:= 5;
38520	newelite:= 6; newkthelite:= 7; teletec:= 8;
38550	sattelite:= 9; tandberg:= 10; beehive:= 11; cdc71310s:= 12;
38580	cdc71310p:= 13; elite3025:= 14; elite1521:= 15;
38610	volkerd404:= 16; volker414h:= 17; buginfoton:= 18;
38640	i200:= 19; adm3a:= 20; vt100:= 21;
38670	
38700	cpunumber:= gettab(8r11,8r20); ! Get CPU number from monitor tables;
38730	IF cpunumber = 1215 !QZ computer centre in Stockholm; THEN
38760	BEGIN
38790	  ttyqz:= trmop(8r1777,terminalout,1) = 1 !.TTY QZ = TRUE;;
38820	  ttyzq:= trmop(8r1776,terminalout,1) = 1 !.TTY ZQ = TRUE;;
38850	END;
38880	IF trmspeed <= 0 THEN
38910	BEGIN
38940	  trmspeed:= trmop(8r1031,terminalout,0);
38970	  trmspeed:= IF trmspeed = 1 THEN 50 ELSE IF trmspeed = 2 THEN
39000	  75 ELSE IF trmspeed = 3 THEN 110 ELSE IF trmspeed = 4 THEN 135
39030	  ELSE IF trmspeed = 5 THEN 150 ELSE IF trmspeed = 6 THEN 200
39060	  ELSE IF trmspeed = 7 THEN 300 ELSE IF trmspeed = 8 THEN 600
39090	  ELSE IF trmspeed = 9 THEN 1200
39120	  ELSE IF trmspeed = 10 THEN 1800 ELSE IF trmspeed = 11 THEN 2400
39150	  ELSE IF trmspeed = 12 THEN 4800 ELSE IF trmspeed = 13 THEN 9600
39180	  ELSE 2400;
39210	END;
39240	
39270	lineinsfillers:= trmspeed*trmspeed*0.0000011464+trmspeed*0.0040327
39300	-2.548; IF lineinsfillers < 0 THEN lineinsfillers:= 0;
39330	
39360	ioindex:= iondx(terminalout);
39390	IF terminalout.image.length < width THEN terminalout.image:-
39420	blanks(width);
39450	IF terminalin.image.length < width THEN terminalin.image:-
39480	blanks(width);
39510	restorechar:= altmode:= char(27); linefeed:= char(10);
39540	bell:= char(7); verttab:= char(11); null:= char(0);
39570	delayer:=
39600	fill:= char(127); tab:= char(9); carriagereturn:= char(13);
39630	formfeed:= char(12); ttyform:= -1;
39660	COMMENT%IF MACRO
39690	IF2,<   PURGE C$,A$B,A$C,R$B,R$C,T$B,T$C
39720	        PURGE WRD,WORD,INTEGER,ARRAY
39750	        PURGE REF,BOOLEAN,INTEGER
39780	>
39810	  RADIX 10
39840	  qbel==7
39870	  qvt==11
39900	  qnul==0
39930	  qdel==127
39960	  qtab==9
39990	  qht==9
40020	  qcr==13
40050	  qlf==10
40080	  qesc=27
40110	  qff==12
40140	  RADIX 8
40170	COMMENT%IFNOT MACRO;
     
40200	INSPECT terminalout DO INSPECT terminalin DO
40230	BEGIN CHARACTER c; TEXT typec; BOOLEAN tmpfound;
40260	  IF FALSE THEN bad:
40290	  BEGIN
40320	    outtext("I cannot cope with your terminal specification."
40350	    ); outimage; terminaltype:= 0;
40380	  END;
40410	  COMMENT%IFNOT MVISTA;
40440	  IF terminaltype = 0 THEN
40470	  asktype:
40500	  INSPECT NEW termty DO
40530	  BEGIN
40560	    otherdisplay:= termtype;
40590	    IF extraterminal =/= NOTEXT THEN
40620	    BEGIN termtype:= termtype+1;
40650	      tr[termtype]:- storbokstav(extraterminal);
40680	    END;
40710	    maxterminals:= termtype+1;
40740	    IF terminalin == sysin THEN
40770	    typec:- tmpin("TRM",FALSE); ! TMP:TRM may give terminal type;
40800	    IF typec =/= NOTEXT THEN
40830	    BEGIN typec:- scanto(typec,carriagereturn);
40860	      tmpfound:= TRUE;
40890	    END ELSE
40920	    BEGIN
40950	      ! Ask the terminal user about terminal type;
40980	      again: outchr(terminalout,formfeed,1); outimage; outimage;
41010	      asktype2:
41040	      type_menu(terminalout); IF extraterminal =/= NOTEXT THEN
41070	      BEGIN outtext(extraterminal); outtext(", ");
41100	      END;
41130	      outtext("(Other) display."); outimage; outtext(
41160	      "Switches: /DCA or /-DCA = Direct Cursor Adressing,"
41190	      "/ALF or /-ALF = Auto LF"); outimage;
41220	      inloop:
41250	      outchr(terminalout,'*',1); forceout(terminalout);
41280	      inimage; typec:- terminalin.image.strip;
41310	      IF typec == NOTEXT THEN GOTO inloop;
41340	    END;
41370	    typec:- storbokstav(typec);
41400	    IF NOT tmpfound AND terminalout == sysout THEN
41430	    tmpout("TRM",typec);
41460	    ts:- scanto(typec,'/');
41490	    IF NOT meny(ts,terminaltype,tr,maxterminals-1) THEN
41520	    BEGIN outtext(IF terminaltype = -1 THEN
41550	      "Your answer was ambiguous!" ELSE
41580	      "The computer did not understand!"); outimage;
41610	      GOTO asktype2;
41640	    END;
41670	    terminalin.setpos(0);
41700	  END of asktype;
41730	  COMMENT%IFEND MVISTA;
     
41760	  zeroterminal: IF terminaltype = 0 OR
41790	  terminaltype = otherdisplay THEN
41820	  BEGIN
41850	    terminaltype:= otherdisplay;
41880	    outtext(
41910	    "Push the following keys in sequence on your terminal:"
41940	    ); outimage;
41970	    outtext(
42000	    "Cursor down, cursor up, cursor right, cursor left,");
42030	    outimage;
42060	    outtext("cursor home, erase screen, carriage return.");
42090	    outimage;
42120	    extraparameters:- blanks(20);
42150	    loop:
42180	    COMMENT%IF MVISTA
42210	    c:= getch;
42240	    COMMENT%IFNOT MVISTA;
42270	    c:= insinglechar(terminalin);
42300	    COMMENT%IFEND MVISTA;
42330	    IF c NE carriagereturn THEN
42360	    BEGIN extraparameters.putchar(c); GOTO loop;
42390	    END;
42420	    extraparameters:-
42450	    extraparameters.sub(1,extraparameters.pos-1);
42480	    COMMENT%IF MVISTA
42510	    c:= getch;
42540	    COMMENT%IFNOT MVISTA;
42570	    c:= insinglechar(terminalin);
42600	    COMMENT%IFEND MVISTA;
42630	    IF extraparameters = NOTEXT THEN GOTO bad;
42660	    terminaltype:= maxterminals-1;
42690	  END;
     
42720	  IF terminaltype = maxterminals-1
42750	  AND extraparameters =/= NOTEXT THEN
42780	  BEGIN
42810	    CHARACTER PROCEDURE find(single);
42840	    NAME single; BOOLEAN single;
42870	    BEGIN IF NOT extraparameters.more THEN GOTO bad;
42900	      c:= extraparameters.getchar;
42930	      IF c = altmode THEN
42960	      BEGIN addaltmode:= TRUE;
42990	        IF NOT extraparameters.more THEN GOTO bad;
43020	        c:= extraparameters.getchar;
43050	      END ELSE single:= TRUE;
43080	      find:= c;
43110	    END;
43140	    extraparameters.setpos(1);
43170	    down:= find(downsingle); up:= find(upsingle); right:=
43200	    find(rightsingle); left:= find(leftsingle); home:=
43230	    find(homesingle); erasescreen:= find(clearsingle);
43260	  END ELSE
     
43290	  IF terminaltype = infoton OR terminaltype = sattelite
43320	  OR terminaltype = buginfoton THEN
43350	  BEGIN COMMENT Infoton Vista Standard or VISTAR Sattelite;
43380	    IF terminaltype EQ buginfoton THEN
43410	    terminaltype:= infoton ELSE
43440	    BEGIN line_erasable:= TRUE; eraseline:= char(11);
43470	    END;
43500	    IF terminaltype = infoton THEN
43530	    BEGIN
43560	      startblink:= char(31); stopblink:= char(15);
43590	    END ELSE startblink:= stopblink:= ' ';
43620	    up:= char(28); down:= char(29); right:= char(25);
43650	    left:= char(26); home:= char(8); erasescreen:= char(12);
43680	  END ELSE IF terminaltype = vt52 OR terminaltype = vt100 THEN
43710	  BEGIN COMMENT VT52;
43740	    IF terminaltypet= vt100 THEN
43770	    BEGIN COMMENT set terminal to VT52 mode;
43800	      outchr(terminalout,altmode,1);
43830	      forceout(sysout); outche(ioindex,char(91));
43860	      outchr(terminalout,'?',1);
43890	      outchr(terminalout,'2',1);
43920	      outchr(terminalout,'l',1);
43950	    END;
43980	    eraseline:= 'K'; address_screen:= 'Y';
44010	    line_erasable:= direct_cursor_addressing:= addaltmode:= TRUE;
44040	    up:= 'A'; down:= 'B'; right:= 'C'; left:= 'D';
44070	    home:= 'H'; erasescreen:= 'J';
44100	  END ELSE IF terminaltype = minitec OR terminaltype = teletec
44130	  THEN
44160	  BEGIN COMMENT minitec 2402 or teletec;
44190	    IF terminaltype = minitec THEN
44220	    BEGIN
44250	      address_screen:= 'F';
44280	      startblink:= char(16r42); stopblink:= char(16r53);
44310	      erasescreen:= char(28);
44340	    END ELSE erasescreen:= char(12);
44370	    up:= char(11); down:= char(10); right:= char(31);
44400	    left:= char(8); home:= char(30);
44430	  END ELSE IF terminaltype = elite OR terminaltype = kthelite
44460	  THEN
44490	  BEGIN
44520	    BEGIN
44550	      COMMENT%IFNOT CALLMAC;
44580	      elitecursors:- copy("`abcdefghijklmnop"
44610	      "qrstuvwxyz{|}~5@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ !""#"
44640	      "$%&'()*+,-./");
44670	      depchar(elitecursors,32,fill);
44700	      COMMENT%IFEND CALLMAC;
44715	      line_erasable:= TRUE; eraseline:= char(23);
44730	      address_screen:= formfeed; direct_cursor_addressing:= TRUE;
44760	    END;
44790	    up:= char(26); down:= char(10);
44820	    right:= char(28); left:= char(8);
44850	    home:= char(2); erasescreen:= char(31);
44880	    startblink:= char(14);
44910	    stopblink:= ' '; !in reality = home;
44940	  END ELSE IF terminaltype = newelite OR terminaltype =
44970	  newkthelite OR terminaltype = elite1521 THEN
45000	  BEGIN
45030	    IF terminaltype = elite1521 THEN
45060	    BEGIN lowintens:= char(4); highintens:= char(24);
45090	    END;
45120	    address_screen:= char(30); direct_cursor_addressing:= TRUE;
45150	    up:= char(31); down:= char(10);
45180	    right:= char(28); left:= char(8);
45210	    home:= char(25); erasescreen:= char(12);
45240	    startblink:= char(14);
45270	    stopblink:= ' '; !in reality = home;
45300	    line_erasable:= TRUE; eraseline:= char(29);
45330	  END ELSE IF terminaltype = tandberg THEN
45360	  BEGIN
45390	    highintens:= char(15);
45420	    lowintens:= char(14);
45450	    COMMENT%IFNOT MVISTA;
45480	    trmop(8R2005,terminalout,1);!.TTY TAB;
45510	    COMMENT%IFEND MVISTA;
45540	    tab:= char(30);
45570	    up:= char(28); down:= char(11); left:= char(8);
45600	    right:= char(9);
45630	    home:= char(29); erasescreen:= char(25);
45660	  END ELSE IF terminaltype = beehive THEN
45690	  BEGIN
45720	    addaltmode:= TRUE;
45750	    up:= 'A'; down:= 'B'; left:= 'D'; right:= 'C';
45780	    home:= 'H'; erasescreen:= 'E';
45810	    startblink:= 'l'; stopblink:= 'm';
45840	    address_screen:= 'F'; direct_cursor_addressing:= TRUE;
45870	  END ELSE IF terminaltype = cdc71310s OR
45900	  terminaltype = cdc71310p THEN
45930	  BEGIN
45960	    up:= char(26); down:= linefeed;
45990	    left:= char(8); right:= char(21);
46020	    startblink:= char(14); stopblink:= char(15);
46050	    home:= char(25); ! lower left corner for cdc71310s;
46080	    erasescreen:= char(24);
46110	    delayer:= char(0);
46140	  END ELSE IF terminaltype = elite3025 THEN
46170	  BEGIN
46200	    highintens:= char(48); lowintens:= char(49);
46230	    startblink:= char(16r34); stopblink:= char(16r30);
46260	    line_erasable:= TRUE;
46290	    addaltmode:= leftsingle:= downsingle:= TRUE;
46320	    up:= 'A'; down:= linefeed; right:= 'C';
46350	    left:= char(8); home:= 'H';
46380	    erasescreen:= 'J'; eraseline:= 'K';
46410	    deleteline:- maketext(fill,6+trmspeed*0.013);
46440	    deleteline.putchar(altmode); deleteline.putchar('P');
46470	    deleteline.putchar(altmode); deleteline.putchar(up);
46500	    deleteline.putchar(altmode); deleteline.putchar('Q');
46530	    insertline:- copy(deleteline); insertline.setpos(3);
46560	    insertline.putchar(fill); insertline.putchar(down);
46590	    deletechar:- copy(insertline.sub(1,6+trmspeed*0.0006));
46620	    deletechar.setpos(4); deletechar.putchar(left);
46650	    insertchar:- copy(deleteline.sub(1,deletechar.length));
46680	    insertchar.setpos(4); insertchar.putchar(right);
46710	    address_screen:= 'Y'; direct_cursor_addressing:= TRUE;
46740	  END ELSE
46770	  IF terminaltype = i200 THEN
46800	  BEGIN
46830	    home:= char(26); up:= char(28); down:= char(29);
46860	    left:= char(8); right:= char(25);
46890	    erasescreen:= formfeed;
46920	    ! note eraseline always blanks the whole line;
46950	    line_erasable:= TRUE; eraseline:= char(11);
46980	    address_screen:= char(23); direct_cursor_addressing:= TRUE;
47010	  END ELSE IF terminaltype = adm3a THEN
47040	  BEGIN
47070	    down:= char(10); up:= char(11); right:= char(12);
47100	    left:= char(8); home:= char(30); erasescreen:= char(26);
47130	  END ELSE
47160	  IF terminaltype = volkerd404 THEN
47190	  BEGIN
47220	    home:= char(25); up:= char(26); down:= linefeed; left:= char(8);
47250	    right:= char(21); eraseline:= char(22); erasescreen:= char(24);
47280	    address_screen:= char(16);
47310	    direct_cursor_addressing:= line_erasable := TRUE;
47340	  END ELSE IF terminaltype = volker414h THEN
47370	  BEGIN
47400	    highintens:= char(31); lowintens:= char(25);
47430	    up:= char(12); down:= char(11); left:= char(8); right:= char(16);
47460	    eraseline:= char(15); erasescreen:= char(28);
47490	    address_screen:= char(17); home:= char(18);
47520	    direct_cursor_addressing:=
47550	    line_erasable:= leftsingle:=
47580	    rightsingle:= addaltmode:= TRUE;
47610	    delline:= char(19); insline:= char(26);
47640	    insertline:- maketext(fill,lineinsfillers+2);
47670	    insertline.putchar(altmode); insertline.putchar(insline);
47700	    deleteline:- copy(insertline);
47730	    deleteline.setpos(2); deleteline.putchar(delline);
47760	    delchar:= '3'; inschar:= ':';
47790	    deletechar:- maketext(fill,lineinsfillers//2+2);
47820	    deletechar.putchar(altmode); deletechar.putchar(delchar);
47850	    insertchar:- copy(deletechar); insertchar.setpos(2);
47880	    insertchar.putchar(inschar);
47910	  END ELSE GOTO bad;
47940	
47970	  IF line_erasable THEN
48000	  BEGIN
48030	    eraseeol:- maketext(fill,2+lineinsfillers//28);
48060	    IF addaltmode AND NOT linesingle THEN eraseeol.putchar(altmode);
48090	    eraseeol.putchar(eraseline);
48120	  END;
48150	  COMMENT%IFNOT MVISTA;
48180	  IF terminaltype < vt52
48210	  OR terminaltype >= minitec AND terminaltype <= sattelite
48240	  OR terminaltype = elite1521
48270	  OR terminaltype >= volker414h
48300	  THEN ttyform:= trmop(8r2006,terminalout,1); !.TTY FORM;
48330	  COMMENT VIDED does this in the VIDED code;
48360	
48390	  IF NOT typec.more THEN ! no / in user given terminal type;
48420	  BEGIN typec:- storbokstav(extraparameters);
48450	    GOTO scanslash;
48480	  END;
48510	  WHILE typec.pos + 2 <= typec.length DO
48540	  BEGIN leftimage:- typec.sub(typec.pos,3);
48570	    IF leftimage = "DCA" THEN direct_cursor_addressing:= TRUE
48600	    ELSE IF leftimage = "-DC" THEN direct_cursor_addressing:= FALSE
48630	    ELSE IF leftimage = "ALF" THEN allow_cr:= FALSE
48660	    ELSE IF leftimage = "-AL" THEN allow_cr:= TRUE;
48690	    scanslash: scanto(typec,'/');
48720	  END;
48750	  COMMENT%IFEND MVISTA;
48780	
48810	  q_display_output:= TRUE;
48840	  COMMENT%IFNOT MVISTA;
48870	  echo(terminalin,IF q_echoenabled THEN 4 ELSE 2);
48900	  COMMENT%IFEND MVISTA;
48930	  leftimage:- blanks(terminalin.length);
48960	  depchar(leftimage,1,left);
48990	  terminalout.linesperpage(-1);
49020	  trmop(8r2010,terminalout,1); ! .TTY NO CRLF;
49050	  widthm1:= width-1; heightm1:= height-1;
49080	  FOR q_verticalpos:= heightm1 STEP -1 UNTIL 0 DO
49110	  screen[q_verticalpos]:- blanks(width);
49140	  COMMENT%IFNOT MVISTA;
49170	  normaltext;
49200	  COMMENT%IFEND MVISTA;
49230	  blank_the_screen;
49260	END;
49290	COMMENT%IF MVISTA
49320	END OF CLASS mvistax;
49350	COMMENT%IFEND MACRO;
49380	END;