2 * Copyright (c) 1999 Hellmuth Michaelis
4 * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
6 * Copyright (c) 1992, 1993 Brian Dunford-Shore.
10 * This code is derived from software contributed to Berkeley by
11 * William Jolitz and Don Ahn.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by Hellmuth Michaelis,
24 * Brian Dunford-Shore and Joerg Wunsch.
25 * 4. The name authors may not be used to endorse or promote products
26 * derived from this software without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
33 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
37 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 /*---------------------------------------------------------------------------*
42 * pcvt_out.c VT220 Terminal Emulator
43 * ---------------------------------------
45 * Last Edit-Date: [Mon Dec 27 14:07:39 1999]
47 * $FreeBSD: src/sys/i386/isa/pcvt/pcvt_out.c,v 1.20 1999/12/30 16:17:10 hm Exp $
49 *---------------------------------------------------------------------------*/
54 #define PCVT_INCLUDE_VT_SELATTR /* get inline function from pcvt_hdr.h */
56 #include <i386/isa/pcvt/pcvt_hdr.h> /* global include */
58 #include <vm/vm_param.h>
61 extern u_short csd_ascii[]; /* pcvt_tbl.h */
62 extern u_short csd_supplemental[];
64 static void write_char (struct video_state *svsp, int attrib, int ch);
65 static void check_scroll ( struct video_state *svsp );
66 static void hp_entry ( U_char ch, struct video_state *svsp );
67 static void vt_coldinit ( void );
68 static void wrfkl ( int num, u_char *string, struct video_state *svsp );
69 static void writefkl ( int num, u_char *string, struct video_state *svsp );
71 static int check_scrollback ( struct video_state *svsp );
73 /*---------------------------------------------------------------------------*
74 * do character set transformation and write to display memory (inline)
75 *---------------------------------------------------------------------------*/
77 #define video (svsp->Crtat + svsp->cur_offset)
79 static __inline void write_char (svsp, attrib, ch)
80 struct video_state *svsp;
81 u_short attrib, ch; /* XXX inefficient interface */
83 if ((ch >= 0x20) && (ch <= 0x7f)) /* use GL if ch >= 0x20 */
85 if(!svsp->ss) /* single shift G2/G3 -> GL ? */
87 *video = attrib | (*svsp->GL)[ch-0x20];
91 *video = attrib | (*svsp->Gs)[ch-0x20];
99 if(ch >= 0x80) /* display controls C1 */
101 if(ch >= 0xA0) /* use GR if ch >= 0xA0 */
103 *video = attrib | (*svsp->GR)[ch-0xA0];
107 if(vgacs[svsp->vga_charset].secondloaded)
109 *video = attrib | ((ch-0x60) | CSH);
111 else /* use normal ibm charset for
114 *video = attrib | ch;
118 else /* display controls C0 */
120 if(vgacs[svsp->vga_charset].secondloaded)
122 *video = attrib | (ch | CSH);
124 else /* use normal ibm charset for control display*/
126 *video = attrib | ch;
132 /*---------------------------------------------------------------------------*
133 * emulator main entry
134 *---------------------------------------------------------------------------*/
136 sput (u_char *s, U_char kernel, int len, int page)
138 register struct video_state *svsp;
143 if(page >= PCVT_NSCREENS) /* failsafe */
146 svsp = &vs[page]; /* pointer to current screen state */
148 if(do_initialization) /* first time called ? */
149 vt_coldinit(); /* yes, we have to init ourselves */
151 if(svsp == vsp) /* on current displayed page ? */
153 cursor_pos_valid = 0; /* do not update cursor */
156 if(scrnsv_active) /* screen blanked ? */
157 pcvt_scrnsv_reset(); /* unblank NOW ! */
159 reset_screen_saver = 1; /* do it asynchronously */
160 #endif /* PCVT_SCREENSAVER */
164 attrib = kernel ? kern_attr : svsp->c_attr;
167 if((ch = *(s++)) > 0)
172 if(((ch <= 0x1f) || (ch == 0x7f)) && (svsp->transparent == 0))
175 /* always process control-chars in the range 0x00..0x1f, 0x7f !!! */
179 if(svsp->lastchar && svsp->m_awm
180 && (svsp->lastrow == svsp->row))
189 bcopy((svsp->Crtat + svsp->cur_offset),
190 (svsp->Crtat + svsp->cur_offset) + 1,
191 (((svsp->maxcol)-1) - svsp->col)*CHR);
193 write_char(svsp, attrib, ch);
197 if(svsp->col >= ((svsp->maxcol)-1)
198 && ch != 0x0a && ch != 0x0b && ch != 0x0c)
201 svsp->lastrow = svsp->row;
203 else if(ch == 0x0a || ch == 0x0b || ch == 0x0c)
205 svsp->cur_offset -= svsp->col;
206 svsp->cur_offset += svsp->maxcol;
209 check_scroll(svsp); /* check scroll up */
233 sysbeep(PCVT_SYSBEEPF/1500, hz/4);
245 while(svsp->col < ((svsp->maxcol)-1))
249 tab_stops[++svsp->col])
257 if (check_scrollback(svsp))
259 extra = (svsp->cur_offset %
263 svsp->cur_offset - extra,
271 svsp->cur_offset -= svsp->col;
285 svsp->cur_offset -= svsp->col;
290 svsp->GL = &svsp->G1;
294 svsp->GL = &svsp->G0;
298 case 0x11: /* DC1/XON */
300 case 0x13: /* DC3/XOFF */
308 svsp->state = STATE_INIT;
316 svsp->state = STATE_INIT;
321 svsp->state = STATE_ESC;
337 /* char range 0x20...0x73, 0x80...0xff processing */
338 /* depends on current state */
343 if(svsp->lastchar && svsp->m_awm &&
344 (svsp->lastrow == svsp->row))
350 if (check_scrollback(svsp))
367 + svsp->cur_offset) + 1,
371 write_char(svsp, attrib, ch);
375 if(svsp->col >= ((svsp->maxcol)-1))
378 svsp->lastrow = svsp->row;
391 case ' ': /* ESC sp family */
392 svsp->state = STATE_BLANK;
395 case '#': /* ESC # family */
396 svsp->state = STATE_HASH;
399 case '&': /* ESC & family (HP) */
400 if(svsp->vt_pure_mode ==
413 case '(': /* ESC ( family */
414 svsp->state = STATE_BROPN;
417 case ')': /* ESC ) family */
418 svsp->state = STATE_BRCLO;
421 case '*': /* ESC * family */
422 svsp->state = STATE_STAR;
425 case '+': /* ESC + family */
426 svsp->state = STATE_PLUS;
429 case '-': /* ESC - family */
430 svsp->state = STATE_MINUS;
433 case '.': /* ESC . family */
434 svsp->state = STATE_DOT;
437 case '/': /* ESC / family */
438 svsp->state = STATE_SLASH;
441 case '7': /* SAVE CURSOR */
443 svsp->state = STATE_INIT;
446 case '8': /* RESTORE CURSOR */
449 attrib = svsp->c_attr;
450 svsp->state = STATE_INIT;
453 case '=': /* keypad application mode */
454 #if !PCVT_INHIBIT_NUMLOCK
457 svsp->state = STATE_INIT;
460 case '>': /* keypad numeric mode */
461 #if !PCVT_INHIBIT_NUMLOCK
464 svsp->state = STATE_INIT;
467 case 'D': /* INDEX */
469 svsp->state = STATE_INIT;
472 case 'E': /* NEXT LINE */
474 svsp->state = STATE_INIT;
477 case 'H': /* set TAB at current col */
478 svsp->tab_stops[svsp->col] = 1;
479 svsp->state = STATE_INIT;
482 case 'M': /* REVERSE INDEX */
484 svsp->state = STATE_INIT;
487 case 'N': /* SINGLE SHIFT G2 */
488 svsp->Gs = &svsp->G2;
490 svsp->state = STATE_INIT;
493 case 'O': /* SINGLE SHIFT G3 */
494 svsp->Gs = &svsp->G3;
496 svsp->state = STATE_INIT;
499 case 'P': /* DCS detected */
500 svsp->dcs_state = DCS_INIT;
501 svsp->state = STATE_DCS;
504 case 'Z': /* What are you = ESC [ c */
506 svsp->state = STATE_INIT;
509 case '[': /* CSI detected */
511 svsp->state = STATE_CSI;
514 case '\\': /* String Terminator */
515 svsp->state = STATE_INIT;
518 case 'c': /* hard reset */
521 attrib = svsp->c_attr;
522 svsp->state = STATE_INIT;
526 case 'd': /* set color sgr */
529 /* set shiftwidth=4 */
539 svsp->state = STATE_INIT;
541 #endif /* PCVT_SETCOLOR */
542 case 'n': /* Lock Shift G2 -> GL */
543 svsp->GL = &svsp->G2;
544 svsp->state = STATE_INIT;
547 case 'o': /* Lock Shift G3 -> GL */
548 svsp->GL = &svsp->G3;
549 svsp->state = STATE_INIT;
552 case '}': /* Lock Shift G2 -> GR */
553 svsp->GR = &svsp->G2;
554 svsp->state = STATE_INIT;
557 case '|': /* Lock Shift G3 -> GR */
558 svsp->GR = &svsp->G3;
559 svsp->state = STATE_INIT;
562 case '~': /* Lock Shift G1 -> GR */
563 svsp->GR = &svsp->G1;
564 svsp->state = STATE_INIT;
568 svsp->state = STATE_INIT;
573 case STATE_BLANK: /* ESC space [FG], which are */
574 svsp->state = STATE_INIT; /* currently ignored*/
580 case '3': /* double height top half */
581 case '4': /*double height bottom half*/
582 case '5': /*single width sngle height*/
583 case '6': /*double width sngle height*/
584 svsp->state = STATE_INIT;
587 case '8': /* fill sceen with 'E's */
589 svsp->state = STATE_INIT;
592 default: /* anything else */
593 svsp->state = STATE_INIT;
598 case STATE_BROPN: /* designate G0 */
599 case STATE_BRCLO: /* designate G1 */
600 case STATE_STAR: /* designate G2 */
601 case STATE_PLUS: /* designate G3 */
602 case STATE_MINUS: /* designate G1 (96) */
603 case STATE_DOT: /* designate G2 (96) */
604 case STATE_SLASH: /* designate G3 (96) */
605 svsp->which[svsp->whichi++] = ch;
606 if(ch >= 0x20 && ch <= 0x2f
607 && svsp->whichi <= 2)
609 else if(ch >=0x30 && ch <= 0x7e)
611 svsp->which[svsp->whichi] = '\0';
615 svsp->state = STATE_INIT;
618 case STATE_CSIQM: /* DEC private modes */
630 case '9': /* parameters */
631 svsp->parms[svsp->parmi] *= 10;
632 svsp->parms[svsp->parmi] +=
636 case ';': /* next parameter */
638 (svsp->parmi+1 < MAXPARMS) ?
639 svsp->parmi+1 : svsp->parmi;
642 case 'h': /* set mode */
643 vt_set_dec_priv_qm(svsp);
644 svsp->state = STATE_INIT;
647 case 'l': /* reset mode */
648 vt_reset_dec_priv_qm(svsp);
649 svsp->state = STATE_INIT;
652 case 'n': /* Reports */
654 svsp->state = STATE_INIT;
657 case 'K': /* selective erase in line */
659 svsp->state = STATE_INIT;
662 case 'J':/*selective erase in display*/
664 svsp->state = STATE_INIT;
668 svsp->state = STATE_INIT;
686 case '9': /* parameters */
687 svsp->parms[svsp->parmi] *= 10;
688 svsp->parms[svsp->parmi] +=
692 case ';': /* next parameter */
694 (svsp->parmi+1 < MAXPARMS) ?
695 svsp->parmi+1 : svsp->parmi;
698 case '?': /* ESC [ ? family */
699 svsp->state = STATE_CSIQM;
702 case '@': /* insert char */
704 svsp->state = STATE_INIT;
707 case '"': /* select char attribute */
708 svsp->state = STATE_SCA;
711 case '\'': /* for DECELR/DECSLE */
712 /* XXX */ /* another state needed -hm */
715 case '!': /* soft terminal reset */
716 svsp->state = STATE_STR;
719 case 'A': /* cursor up */
721 svsp->state = STATE_INIT;
724 case 'B': /* cursor down */
726 svsp->state = STATE_INIT;
729 case 'C': /* cursor forward */
731 svsp->state = STATE_INIT;
734 case 'D': /* cursor backward */
736 svsp->state = STATE_INIT;
739 case 'H': /* direct cursor addressing*/
741 svsp->state = STATE_INIT;
744 case 'J': /* erase screen */
746 svsp->state = STATE_INIT;
749 case 'K': /* erase line */
751 svsp->state = STATE_INIT;
752 if (svsp->scr_offset > 0 &&
757 case 'L': /* insert line */
759 svsp->state = STATE_INIT;
762 case 'M': /* delete line */
764 svsp->state = STATE_INIT;
767 case 'P': /* delete character */
769 svsp->state = STATE_INIT;
772 case 'S': /* scroll up */
774 svsp->state = STATE_INIT;
777 case 'T': /* scroll down */
779 svsp->state = STATE_INIT;
782 case 'X': /* erase character */
784 svsp->state = STATE_INIT;
787 case 'c': /* device attributes */
789 svsp->state = STATE_INIT;
792 case 'f': /* direct cursor addressing*/
794 svsp->state = STATE_INIT;
797 case 'g': /* clear tabs */
799 svsp->state = STATE_INIT;
802 case 'h': /* set mode(s) */
804 svsp->state = STATE_INIT;
807 case 'i': /* media copy */
809 svsp->state = STATE_INIT;
812 case 'l': /* reset mode(s) */
814 svsp->state = STATE_INIT;
817 case 'm': /* select graphic rendition*/
820 attrib = svsp->c_attr;
821 svsp->state = STATE_INIT;
824 case 'n': /* reports */
826 svsp->state = STATE_INIT;
829 case 'r': /* set scrolling region */
831 svsp->state = STATE_INIT;
834 case 'x': /*request/report parameters*/
836 svsp->state = STATE_INIT;
839 case 'y': /* invoke selftest(s) */
841 svsp->state = STATE_INIT;
844 case 'z': /* DECELR, ignored */
845 case '{': /* DECSLE, ignored */
846 svsp->state = STATE_INIT;
850 svsp->state = STATE_INIT;
860 vt_dcsentry(ch,svsp);
868 svsp->state = STATE_INIT;
872 svsp->state = STATE_INIT;
880 case 'p': /* soft terminal reset */
883 attrib = svsp->c_attr;
884 svsp->state = STATE_INIT;
888 svsp->state = STATE_INIT;
893 default: /* failsafe */
894 svsp->state = STATE_INIT;
900 svsp->row = svsp->cur_offset / svsp->maxcol; /* current row update */
902 /* take care of last character on line behaviour */
904 if(svsp->lastchar && (svsp->col < ((svsp->maxcol)-1)))
908 if(svsp == vsp) /* on current displayed page ? */
909 cursor_pos_valid = 1; /* position is valid now */
912 /*---------------------------------------------------------------------------*
913 * this is the absolute cold initialization of the emulator
914 *---------------------------------------------------------------------------*/
918 u_short volatile *cp;
923 struct video_state *svsp;
925 Crtat = (u_short *)MONO_BUF; /* XXX assume static relocation works */
927 cp = Crtat + (CGA_BUF-MONO_BUF)/CHR;
929 do_initialization = 0; /* reset init necessary flag */
931 /* get the equipment byte from the RTC chip */
933 equipment = ((rtcin(RTC_EQUIPMENT)) >> 4) & 0x03;
939 /* set memory start to CGA == B8000 */
941 Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR;
943 /* find out, what monitor is connected */
946 *cp = (u_short) 0xA55A;
949 addr_6845 = MONO_BASE;
955 addr_6845 = CGA_BASE;
959 if(vga_test()) /* EGA or VGA ? */
961 adaptor_type = VGA_ADAPTOR;
967 Crtat = SaveCrtat; /* mono start */
970 /* find out which chipset we are running on */
971 vga_type = vga_chipset();
975 adaptor_type = EGA_ADAPTOR;
981 Crtat = SaveCrtat; /* mono start */
985 /* decouple ega/vga charsets and intensity */
990 case EQ_40COLOR: /* XXX should panic in 40 col mode ! */
992 Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR;
993 addr_6845 = CGA_BASE;
994 adaptor_type = CGA_ADAPTOR;
1000 addr_6845 = MONO_BASE;
1001 adaptor_type = MDA_ADAPTOR;
1007 /* establish default colors */
1011 kern_attr = (COLOR_KERNEL_FG | COLOR_KERNEL_BG) << 8;
1012 user_attr = sgr_tab_color[0] << 8;
1016 kern_attr = (MONO_KERNEL_FG | MONO_KERNEL_BG) << 8;
1017 if(adaptor_type == MDA_ADAPTOR)
1018 user_attr = sgr_tab_imono[0] << 8;
1020 user_attr = sgr_tab_mono[0] << 8;
1023 totalscreens = 1; /* for now until malloced */
1025 for(nscr = 0, svsp = vs; nscr < PCVT_NSCREENS; nscr++, svsp++)
1027 svsp->Crtat = Crtat; /* all same until malloc'ed */
1028 svsp->Memory = Crtat; /* until malloc'ed */
1029 svsp->Scrollback = 0; /* until malloc'ed */
1030 svsp->scr_offset = 0; /* scrollback offset (lines) */
1031 svsp->scrolling = 0; /* current scrollback page */
1032 svsp->cur_offset = 0; /* cursor offset */
1033 svsp->c_attr = user_attr; /* non-kernel attributes */
1034 svsp->bell_on = 1; /* enable bell */
1035 svsp->sevenbit = 0; /* set to 8-bit path */
1036 svsp->dis_fnc = 0; /* disable display functions */
1037 svsp->transparent = 0; /* disable internal tranparency */
1038 svsp->lastchar = 0; /* VTxxx behaviour of last */
1040 svsp->report_chars = NULL; /* VTxxx reports init */
1041 svsp->report_count = 0; /* VTxxx reports init */
1042 svsp->state = STATE_INIT; /* main state machine init */
1043 svsp->m_awm = 1; /* enable auto wrap mode */
1044 svsp->m_om = 0; /* origin mode = absolute */
1045 svsp->sc_flag = 0; /* init saved cursor flag */
1046 svsp->which_fkl = SYS_FKL; /* display system fkey-labels */
1047 svsp->labels_on = 1; /* if in HP-mode, display */
1049 svsp->attribute = 0; /* HP mode init */
1050 svsp->key = 0; /* HP mode init */
1051 svsp->l_len = 0; /* HP mode init */
1052 svsp->s_len = 0; /* HP mode init */
1053 svsp->m_len = 0; /* HP mode init */
1054 svsp->i = 0; /* HP mode init */
1055 svsp->vt_pure_mode = M_PUREVT; /* initial mode: pure VT220*/
1056 svsp->vga_charset = CH_SET0; /* use bios default charset */
1058 #if PCVT_24LINESDEF /* true compatibility */
1059 svsp->screen_rows = 24; /* default 24 rows on screen */
1060 #else /* full screen */
1061 svsp->screen_rows = 25; /* default 25 rows on screen */
1062 #endif /* PCVT_24LINESDEF */
1064 svsp->screen_rowsize = 25; /* default 25 rows on screen */
1065 svsp->max_off = svsp->screen_rowsize * SCROLLBACK_PAGES - 1;
1066 svsp->scrr_beg = 0; /* scrolling region begin row*/
1067 svsp->scrr_len = svsp->screen_rows; /* scrolling region length*/
1068 svsp->scrr_end = svsp->scrr_len - 1;/* scrolling region end */
1072 if(adaptor_type == VGA_ADAPTOR)
1074 /* only VGA can read cursor shape registers ! */
1075 /* Preserve initial cursor shape */
1076 outb(addr_6845,CRTC_CURSTART);
1077 svsp->cursor_start = inb(addr_6845+1);
1078 outb(addr_6845,CRTC_CUREND);
1079 svsp->cursor_end = inb(addr_6845+1);
1083 /* MDA,HGC,CGA,EGA registers are write-only */
1084 svsp->cursor_start = 0;
1085 svsp->cursor_end = 15;
1090 svsp->cursor_start = vs[0].cursor_start;
1091 svsp->cursor_end = vs[0].cursor_end;
1095 svsp->cursor_start = 0;
1096 svsp->cursor_end = 15; /* cursor lower scanline */
1099 svsp->cursor_on = 1; /* cursor is on */
1100 svsp->ckm = 1; /* normal cursor key mode */
1101 svsp->irm = 0; /* replace mode */
1102 svsp->lnm = 0; /* CR only */
1103 svsp->selchar = 0; /* selective attribute off */
1104 svsp->G0 = csd_ascii; /* G0 = ascii */
1105 svsp->G1 = csd_ascii; /* G1 = ascii */
1106 svsp->G2 = csd_supplemental; /* G2 = supplemental */
1107 svsp->G3 = csd_supplemental; /* G3 = supplemental */
1108 svsp->GL = &svsp->G0; /* GL = G0 */
1109 svsp->GR = &svsp->G2; /* GR = G2 */
1110 svsp->whichi = 0; /* char set designate init */
1111 svsp->which[0] = '\0'; /* char set designate init */
1112 svsp->hp_state = SHP_INIT; /* init HP mode state machine*/
1113 svsp->dcs_state = DCS_INIT; /* init DCS mode state machine*/
1114 svsp->ss = 0; /* init single shift 2/3 */
1115 svsp->Gs = NULL; /* Gs single shift 2/3 */
1116 svsp->maxcol = SCR_COL80; /* 80 columns now (MUST!!!) */
1117 svsp->wd132col = 0; /* help good old WD .. */
1118 svsp->scroll_lock = 0; /* scrollock off */
1120 #if PCVT_INHIBIT_NUMLOCK
1121 svsp->num_lock = 0; /* numlock off */
1123 svsp->num_lock = 1; /* numlock on */
1126 svsp->caps_lock = 0; /* capslock off */
1127 svsp->shift_lock = 0; /* shiftlock off */
1129 #if PCVT_24LINESDEF /* true compatibility */
1130 svsp->force24 = 1; /* force 24 lines */
1131 #else /* maximum screen size */
1132 svsp->force24 = 0; /* no 24 lines force yet */
1133 #endif /* PCVT_24LINESDEF */
1135 vt_clearudk(svsp); /* clear vt220 udk's */
1137 vt_str(svsp); /* init emulator */
1142 * Preserve data on the startup screen that
1143 * precedes the cursor position. Leave the
1144 * cursor where it was found.
1149 /* CRTC regs 0x0e and 0x0f are r/w everywhere */
1151 outb(addr_6845, CRTC_CURSORH);
1152 cursorat = inb(addr_6845+1) << 8;
1153 outb(addr_6845, CRTC_CURSORL);
1154 cursorat |= inb(addr_6845+1);
1157 * Reject cursors that are more than one row off a
1158 * 25-row screen. syscons sets the cursor offset
1159 * to 0xffff. The scroll up fixup fails for this
1160 * because the assignment to svsp->row overflows
1161 * and perhaps for other reasons.
1163 if (cursorat > 25 * svsp->maxcol)
1164 cursorat = 25 * svsp->maxcol;
1166 svsp->cur_offset = cursorat;
1167 svsp->row = cursorat / svsp->maxcol;
1168 svsp->col = cursorat % svsp->maxcol;
1170 if (svsp->row >= svsp->screen_rows)
1174 * Scroll up; this should only happen when
1175 * PCVT_24LINESDEF is set
1179 - svsp->screen_rows;
1181 + nscroll*svsp->maxcol,
1184 * svsp->maxcol * CHR);
1185 svsp->row -= nscroll;
1187 nscroll * svsp->maxcol;
1190 filllen = (svsp->maxcol * svsp->screen_rowsize)
1194 fillw(user_attr | ' ',
1195 svsp->Crtat+svsp->cur_offset,
1199 #if PCVT_USL_VT_COMPAT
1200 svsp->smode.mode = VT_AUTO;
1201 svsp->smode.relsig = svsp->smode.acqsig =
1202 svsp->smode.frsig = 0;
1204 svsp->pid = svsp->vt_status = 0;
1205 #endif /* PCVT_USL_VT_COMPAT */
1209 for(charset = 0;charset < NVGAFONTS;charset++)
1211 vgacs[charset].loaded = 0; /* not populated yet */
1212 vgacs[charset].secondloaded = 0; /* not populated yet */
1214 switch(adaptor_type)
1219 * for a VGA, do not assume any
1220 * constant - instead, read the actual
1221 * values. This avoid problems with
1222 * LCD displays that apparently happen
1223 * to use font matrices up to 19
1224 * scan lines and 475 scan lines
1225 * total in order to make use of the
1229 outb(addr_6845, CRTC_VDE);
1230 vgacs[charset].scr_scanlines =
1232 outb(addr_6845, CRTC_MAXROW);
1233 vgacs[charset].char_scanlines =
1238 /* 0x5D for 25 lines */
1239 vgacs[charset].scr_scanlines = 0x5D;
1240 /* 0x4D for 25 lines */
1241 vgacs[charset].char_scanlines = 0x4D;
1247 /* These shouldn't be used for CGA/MDA */
1248 vgacs[charset].scr_scanlines = 0;
1249 vgacs[charset].char_scanlines = 0;
1252 vgacs[charset].screen_size = SIZ_25ROWS; /* set screen size */
1255 vgacs[0].loaded = 1; /* The BIOS loaded this at boot */
1257 /* set cursor for first screen */
1259 outb(addr_6845,CRTC_CURSTART); /* cursor start reg */
1260 outb(addr_6845+1,vs[0].cursor_start);
1261 outb(addr_6845,CRTC_CUREND); /* cursor end reg */
1262 outb(addr_6845+1,vs[0].cursor_end);
1264 /* this is to satisfy ddb */
1266 if(!keyboard_is_initialized)
1270 /*---------------------------------------------------------------------------*
1271 * get kernel memory for virtual screens
1273 * CAUTION: depends on "can_do_132col" being set properly, or
1274 * depends on vga_type() being run before calling this !!!
1276 *---------------------------------------------------------------------------*/
1281 int screen_max_size;
1283 /* we need to initialize in case we are not the console */
1285 if(do_initialization)
1288 switch(adaptor_type)
1293 screen_max_size = MAXROW_MDACGA * MAXCOL_MDACGA * CHR;
1297 screen_max_size = MAXROW_EGA * MAXCOL_EGA * CHR;
1303 MAXROW_VGA * MAXCOL_SVGA * CHR;
1306 MAXROW_VGA * MAXCOL_VGA * CHR;
1309 for(nscr = 0; nscr < PCVT_NSCREENS; nscr++)
1311 if((vs[nscr].Memory = (u_short *)malloc(screen_max_size * 2,
1312 M_DEVBUF, M_WAITOK)) == NULL)
1314 printf("pcvt: screen memory malloc failed, "
1315 "NSCREEN=%d, nscr=%d\n",
1316 PCVT_NSCREENS, nscr);
1322 vs[nscr].Crtat = vs[nscr].Memory;
1323 fillw(user_attr | ' ',
1325 vs[nscr].maxcol * vs[nscr].screen_rowsize);
1329 vs[nscr].scrollback_pages = SCROLLBACK_PAGES;
1331 reallocate_scrollbuffer(&(vs[nscr]), vs[nscr].scrollback_pages);
1335 /*---------------------------------------------------------------------------*
1336 * check if we must scroll up screen
1337 *---------------------------------------------------------------------------*/
1339 check_scroll(struct video_state *svsp)
1341 if(!svsp->abs_write)
1343 /* we write within scroll region */
1345 if(svsp->cur_offset >= ((svsp->scrr_end + 1) * svsp->maxcol))
1347 /* the following piece of code has to be protected */
1348 /* from trying to switch to another virtual screen */
1349 /* while being in there ... */
1351 critical_scroll = 1; /* flag protect ON */
1353 roll_up(svsp, 1); /* rolling up .. */
1355 svsp->cur_offset -= svsp->maxcol;/* update position */
1357 if(switch_page != -1) /* someone wanted to switch ? */
1359 vgapage(switch_page); /* yes, then switch ! */
1360 switch_page = -1; /* reset switch flag */
1363 critical_scroll = 0; /* flag protect OFF */
1368 /* clip, if outside of screen */
1370 if (svsp->cur_offset >= svsp->screen_rows * svsp->maxcol)
1371 svsp->cur_offset -= svsp->maxcol;
1376 check_scrollback(struct video_state *svsp)
1378 /* still waiting for scrollback memory or not on current page */
1379 if (!svsp->Scrollback || svsp != vsp)
1382 /* remove first line of scrollback buffer to make room for new line */
1383 if (svsp->scr_offset == svsp->max_off)
1385 bcopy(svsp->Scrollback + svsp->maxcol, svsp->Scrollback,
1386 svsp->maxcol * svsp->max_off * CHR);
1390 /* still room left, increase scroll offset (lines) */
1396 /*---------------------------------------------------------------------------*
1397 * write to one user function key label
1398 *---------------------------------------------------------------------------*/
1400 writefkl(int num, u_char *string, struct video_state *svsp)
1402 if((num < 0) || (num > 7)) /* range ok ? */
1405 strncpy(svsp->ufkl[num], string, 16); /* save string in static array */
1407 if(svsp->which_fkl == USR_FKL)
1408 wrfkl(num,string,svsp);
1411 /*---------------------------------------------------------------------------*
1412 * write to one system function key label
1413 *---------------------------------------------------------------------------*/
1415 swritefkl(int num, u_char *string, struct video_state *svsp)
1417 if((num < 0) || (num > 7)) /* range ok ? */
1420 strncpy(svsp->sfkl[num], string, 16); /* save string in static array */
1422 if(svsp->which_fkl == SYS_FKL)
1423 wrfkl(num,string,svsp);
1426 /*---------------------------------------------------------------------------*
1427 * write function key label onto screen
1428 *---------------------------------------------------------------------------*/
1430 wrfkl(int num, u_char *string, struct video_state *svsp)
1432 register u_short *p;
1433 register u_short *p1;
1434 register int cnt = 0;
1436 if(!svsp->labels_on || (svsp->vt_pure_mode == M_PUREVT))
1440 + (svsp->screen_rows * svsp->maxcol)); /* screen_rows+1 line */
1442 if(svsp->maxcol == SCR_COL80)
1444 if(num < 4) /* labels 1 .. 4 */
1445 p += (num * LABEL_LEN);
1446 else /* labels 5 .. 8 */
1447 p += ((num * LABEL_LEN) + LABEL_MID + 1);
1451 if(num < 4) /* labels 1 .. 4 */
1452 p += (num * (LABEL_LEN + 6));
1453 else /* labels 5 .. 8 */
1454 p += ((num * (LABEL_LEN + 6)) + LABEL_MID + 11);
1457 p1 = p + svsp->maxcol; /* second label line */
1459 while((*string != '\0') && (cnt < 8))
1461 *p = ((0x70 << 8) + (*string & 0xff));
1468 *p = ((0x70 << 8) + ' ');
1473 while((*string != '\0') && (cnt < 16))
1475 *p1 = ((0x70 << 8) + (*string & 0xff));
1482 *p1 = ((0x70 << 8) + ' ');
1488 /*---------------------------------------------------------------------------*
1489 * remove (=blank) function key labels, row/col and status line
1490 *---------------------------------------------------------------------------*/
1492 fkl_off(struct video_state *svsp)
1494 register u_short *p;
1498 svsp->labels_on = 0;
1500 if((vgacs[svsp->vga_charset].screen_size==SIZ_28ROWS) && svsp->force24)
1505 p = (svsp->Crtat + (svsp->screen_rows * svsp->maxcol));
1507 for(num = 0; num < (size * svsp->maxcol); num++)
1511 /*---------------------------------------------------------------------------*
1512 * (re-) display function key labels, row/col and status line
1513 *---------------------------------------------------------------------------*/
1515 fkl_on(struct video_state *svsp)
1517 svsp->labels_on = 1;
1519 if(svsp->which_fkl == SYS_FKL)
1521 else if(svsp->which_fkl == USR_FKL)
1525 /*---------------------------------------------------------------------------*
1526 * set emulation mode, switch between pure VTxxx mode and HP/VTxxx mode
1527 *---------------------------------------------------------------------------*/
1529 set_emulation_mode(struct video_state *svsp, int mode)
1531 if(svsp->vt_pure_mode == mode)
1534 clr_parms(svsp); /* escape parameter init */
1535 svsp->state = STATE_INIT; /* initial state */
1536 svsp->scrr_beg = 0; /* start of scrolling region */
1537 svsp->sc_flag = 0; /* invalidate saved cursor position */
1538 svsp->transparent = 0; /* disable control code processing */
1540 if(mode == M_HPVT) /* vt-pure -> hp/vt-mode */
1542 svsp->screen_rows = svsp->screen_rowsize - 3;
1543 if (svsp->force24 && svsp->screen_rows == 25)
1544 svsp->screen_rows = 24;
1546 if (svsp->row >= svsp->screen_rows) {
1548 int nscroll = svsp->row + 1 - svsp->screen_rows;
1549 bcopy (svsp->Crtat + nscroll * svsp->maxcol,
1551 svsp->screen_rows * svsp->maxcol * CHR);
1552 svsp->row -= nscroll;
1553 svsp->cur_offset -= nscroll * svsp->maxcol;
1556 svsp->vt_pure_mode = M_HPVT;
1559 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1561 svsp->scrr_len = svsp->screen_rows;
1562 svsp->scrr_end = svsp->scrr_len - 1;
1566 else if(mode == M_PUREVT) /* hp/vt-mode -> vt-pure */
1568 fillw(user_attr | ' ',
1569 svsp->Crtat + svsp->screen_rows * svsp->maxcol,
1570 (svsp->screen_rowsize - svsp->screen_rows)
1573 svsp->vt_pure_mode = M_PUREVT;
1575 svsp->screen_rows = svsp->screen_rowsize;
1576 if (svsp->force24 && svsp->screen_rows == 25)
1577 svsp->screen_rows = 24;
1580 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1582 svsp->scrr_len = svsp->screen_rows;
1583 svsp->scrr_end = svsp->scrr_len - 1;
1587 if (svsp->vs_tty && svsp->vs_tty->t_pgrp)
1588 pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
1589 #endif /* PCVT_SIGWINCH */
1593 /*---------------------------------------------------------------------------*
1594 * initialize user function key labels
1595 *---------------------------------------------------------------------------*/
1597 init_ufkl(struct video_state *svsp)
1599 writefkl(0,(u_char *)" f1",svsp); /* init fkey labels */
1600 writefkl(1,(u_char *)" f2",svsp);
1601 writefkl(2,(u_char *)" f3",svsp);
1602 writefkl(3,(u_char *)" f4",svsp);
1603 writefkl(4,(u_char *)" f5",svsp);
1604 writefkl(5,(u_char *)" f6",svsp);
1605 writefkl(6,(u_char *)" f7",svsp);
1606 writefkl(7,(u_char *)" f8",svsp);
1609 /*---------------------------------------------------------------------------*
1610 * initialize system user function key labels
1611 *---------------------------------------------------------------------------*/
1613 init_sfkl(struct video_state *svsp)
1615 /* 1234567812345678 */
1617 /* 1234567812345678 */
1618 swritefkl(0,(u_char *)"132 COLUMNS ",svsp);
1620 swritefkl(0,(u_char *)" ",svsp);
1622 /* 1234567812345678 */
1623 swritefkl(1,(u_char *)"SOFT-RSTTERMINAL",svsp);
1626 swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp);
1628 swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp);
1630 #if PCVT_SHOWKEYS /* 1234567812345678 */
1632 swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp);
1634 swritefkl(3,(u_char *)" ",svsp);
1636 swritefkl(3,(u_char *)" ",svsp);
1637 #endif /* PCVT_SHOWKEYS */
1639 /* 1234567812345678 */
1641 swritefkl(4,(u_char *)"BELL ENABLE *",svsp);
1643 swritefkl(4,(u_char *)"BELL ENABLE ",svsp);
1646 swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp);
1648 swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp);
1650 swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp);
1652 swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp);
1653 /* 1234567812345678 */
1656 /*---------------------------------------------------------------------------*
1657 * switch display to user function key labels
1658 *---------------------------------------------------------------------------*/
1660 sw_ufkl(struct video_state *svsp)
1663 svsp->which_fkl = USR_FKL;
1664 for(i = 0; i < 8; i++)
1665 wrfkl(i,svsp->ufkl[i],svsp);
1668 /*---------------------------------------------------------------------------*
1669 * switch display to system function key labels
1670 *---------------------------------------------------------------------------*/
1672 sw_sfkl(struct video_state *svsp)
1675 svsp->which_fkl = SYS_FKL;
1676 for(i = 0; i < 8; i++)
1677 wrfkl(i,svsp->sfkl[i],svsp);
1680 /*---------------------------------------------------------------------------*
1681 * toggle force 24 lines
1682 *---------------------------------------------------------------------------*/
1684 toggl_24l(struct video_state *svsp)
1686 if(svsp->which_fkl == SYS_FKL)
1691 swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp);
1696 swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp);
1698 set_screen_size(svsp, vgacs[(svsp->vga_charset)].screen_size);
1703 /*---------------------------------------------------------------------------*
1704 * toggle keyboard scancode display
1705 *---------------------------------------------------------------------------*/
1707 toggl_kbddbg(struct video_state *svsp)
1709 if((svsp->which_fkl == SYS_FKL) && (svsp == &vs[0]))
1714 swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp);
1719 swritefkl(3,(u_char *)"KEYBSCANDISPLAY*",svsp);
1723 #endif /* PCVT_SHOWKEYS */
1725 /*---------------------------------------------------------------------------*
1726 * toggle display functions
1727 *---------------------------------------------------------------------------*/
1729 toggl_dspf(struct video_state *svsp)
1731 if(svsp->which_fkl == SYS_FKL)
1736 swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp);
1741 swritefkl(6,(u_char *)"DISPLAY FUNCTNS*",svsp);
1746 /*---------------------------------------------------------------------------*
1748 *---------------------------------------------------------------------------*/
1750 toggl_awm(struct video_state *svsp)
1752 if(svsp->which_fkl == SYS_FKL)
1757 swritefkl(7,(u_char *)"AUTOWRAPENABLE ",svsp);
1762 swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp);
1767 /*---------------------------------------------------------------------------*
1769 *---------------------------------------------------------------------------*/
1771 toggl_bell(struct video_state *svsp)
1773 if(svsp->which_fkl == SYS_FKL)
1778 swritefkl(4,(u_char *)"BELL ENABLE ",svsp);
1783 swritefkl(4,(u_char *)"BELL ENABLE *",svsp);
1788 /*---------------------------------------------------------------------------*
1790 *---------------------------------------------------------------------------*/
1792 toggl_sevenbit(struct video_state *svsp)
1794 if(svsp->which_fkl == SYS_FKL)
1799 swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp);
1804 swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp);
1809 /*---------------------------------------------------------------------------*
1811 *---------------------------------------------------------------------------*/
1813 toggl_columns(struct video_state *svsp)
1815 if(svsp->which_fkl == SYS_FKL)
1817 if(svsp->maxcol == SCR_COL132)
1819 if(vt_col(svsp, SCR_COL80))
1824 if(vt_col(svsp, SCR_COL132))
1830 /*---------------------------------------------------------------------------*
1831 * toggle vga 80/132 column operation
1832 *---------------------------------------------------------------------------*/
1834 vt_col(struct video_state *svsp, int cols)
1836 if(vga_col(svsp, cols) == 0)
1839 if(cols == SCR_COL80)
1840 swritefkl(0,(u_char *)"132 COLUMNS ",svsp);
1842 swritefkl(0,(u_char *)"132 COLUMNS*",svsp);
1844 fillw(user_attr | ' ',
1846 svsp->maxcol * svsp->screen_rowsize);
1848 clr_parms(svsp); /* escape parameter init */
1849 svsp->state = STATE_INIT; /* initial state */
1850 svsp->col = 0; /* init row */
1851 svsp->row = 0; /* init col */
1852 svsp->cur_offset = 0; /* cursor offset init */
1853 svsp->sc_flag = 0; /* invalidate saved cursor position */
1854 svsp->scrr_beg = 0; /* reset scrolling region */
1855 svsp->scrr_len = svsp->screen_rows; /*reset scrolling region legnth */
1856 svsp->scrr_end = svsp->scrr_len - 1;
1857 svsp->transparent = 0; /* disable control code processing */
1858 svsp->selchar = 0; /* selective attr off */
1859 vt_initsel(svsp); /* re-init sel attr */
1861 update_hp(svsp); /* update labels, row/col, page ind */
1863 /* Update winsize struct to reflect screen size */
1867 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1868 svsp->vs_tty->t_winsize.ws_col = svsp->maxcol;
1870 svsp->vs_tty->t_winsize.ws_xpixel =
1871 (cols == SCR_COL80)? 720: 1056;
1872 svsp->vs_tty->t_winsize.ws_ypixel = 400;
1875 if(svsp->vs_tty->t_pgrp)
1876 pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
1877 #endif /* PCVT_SIGWINCH */
1880 reallocate_scrollbuffer(svsp, svsp->scrollback_pages);
1884 /*---------------------------------------------------------------------------*
1885 * update HP stuff on screen
1886 *---------------------------------------------------------------------------*/
1888 update_hp(struct video_state *svsp)
1890 if(svsp->vt_pure_mode != M_HPVT)
1893 fillw (user_attr | ' ',
1894 svsp->Crtat + svsp->screen_rows * svsp->maxcol,
1895 (svsp->screen_rowsize - svsp->screen_rows) * svsp->maxcol);
1897 if (!svsp->labels_on)
1900 /* update fkey labels */
1907 /* update current displayed screen indicator */
1909 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1910 + svsp->maxcol - 3) = user_attr | '[';
1911 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1912 + svsp->maxcol - 2) = user_attr | (current_video_screen + '0');
1913 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1914 + svsp->maxcol - 1) = user_attr | ']';
1918 /*---------------------------------------------------------------------------*
1919 * initialize ANSI escape sequence parameter buffers
1920 *---------------------------------------------------------------------------*/
1922 clr_parms(struct video_state *svsp)
1925 for(i=0; i < MAXPARMS; i++)
1931 /*---------------------------------------------------------------------------*
1933 * partial HP 2392 ANSI mode Emulator
1934 * ==================================
1936 * this part takes over the emulation of some escape sequences
1937 * needed to handle the function key labels
1939 * They are modeled after the corresponding escape sequences
1940 * introduced with the HP2392 terminals from Hewlett-Packard.
1943 * "HP2392A, Display Terminal Reference Manual",
1944 * HP Manual Part Number 02390-90001
1946 * Reference Manual Supplement
1947 * "2392A Display Terminal Option 049, ANSI Operation"
1948 * HP Manual Part Number 02390-90023EN
1950 *---------------------------------------------------------------------------*/
1953 hp_entry(U_char ch, struct video_state *svsp)
1955 switch(svsp->hp_state)
1961 svsp->hp_state = SHP_AND_F;
1962 svsp->attribute = 0;
1971 svsp->hp_state = SHP_AND_J;
1975 svsp->hp_state = SHP_AND_ETE;
1979 svsp->hp_state = SHP_INIT;
1980 svsp->state = STATE_INIT;
1986 if((ch >= '0') && (ch <= '8'))
1988 svsp->attribute = ch;
1989 svsp->hp_state = SHP_AND_Fa;
1993 svsp->hp_state = SHP_INIT;
1994 svsp->state = STATE_INIT;
2000 svsp->hp_state = SHP_AND_Fak;
2003 svsp->key = svsp->attribute;
2004 svsp->hp_state = SHP_AND_Fakd;
2008 svsp->hp_state = SHP_INIT;
2009 svsp->state = STATE_INIT;
2014 if((ch >= '1') && (ch <= '8'))
2017 svsp->hp_state = SHP_AND_Fak1;
2021 svsp->hp_state = SHP_INIT;
2022 svsp->state = STATE_INIT;
2028 svsp->hp_state = SHP_AND_Fakd;
2031 svsp->hp_state = SHP_INIT;
2032 svsp->state = STATE_INIT;
2037 if(svsp->l_len > 16)
2039 svsp->hp_state = SHP_INIT;
2040 svsp->state = STATE_INIT;
2042 else if(ch >= '0' && ch <= '9')
2045 svsp->l_len += (ch -'0');
2048 svsp->hp_state = SHP_AND_FakdL;
2051 svsp->hp_state = SHP_INIT;
2052 svsp->state = STATE_INIT;
2057 if(svsp->s_len > 80)
2059 svsp->hp_state = SHP_INIT;
2060 svsp->state = STATE_INIT;
2062 else if(ch >= '0' && ch <= '9')
2065 svsp->s_len += (ch -'0');
2069 svsp->hp_state = SHP_AND_FakdLl;
2070 svsp->transparent = 1;
2074 svsp->hp_state = SHP_INIT;
2075 svsp->state = STATE_INIT;
2079 case SHP_AND_FakdLl:
2080 svsp->l_buf[svsp->i] = ch;
2081 if(svsp->i >= svsp->l_len-1)
2083 svsp->hp_state = SHP_AND_FakdLls;
2085 if(svsp->s_len == 0)
2087 svsp->state = STATE_INIT;
2088 svsp->hp_state = SHP_INIT;
2089 svsp->transparent = 0;
2091 svsp->l_buf[svsp->l_len] = '\0';
2092 svsp->s_buf[svsp->s_len] = '\0';
2093 writefkl((svsp->key - '0' -1),
2101 case SHP_AND_FakdLls:
2102 svsp->s_buf[svsp->i] = ch;
2103 if(svsp->i >= svsp->s_len-1)
2105 svsp->state = STATE_INIT;
2106 svsp->hp_state = SHP_INIT;
2107 svsp->transparent = 0;
2109 svsp->l_buf[svsp->l_len] = '\0';
2110 svsp->s_buf[svsp->s_len] = '\0';
2111 writefkl((svsp->key - '0' -1), svsp->l_buf,
2121 case '@': /* enable user keys, remove */
2122 /* all labels & status from */
2124 svsp->hp_state = SHP_INIT;
2125 svsp->state = STATE_INIT;
2129 case 'A': /* enable & display "modes" */
2130 svsp->hp_state = SHP_INIT;
2131 svsp->state = STATE_INIT;
2136 case 'B': /* enable & display "user" */
2137 svsp->hp_state = SHP_INIT;
2138 svsp->state = STATE_INIT;
2143 case 'C': /* remove (clear) status line*/
2144 /* and restore current labels*/
2145 svsp->hp_state = SHP_INIT;
2146 svsp->state = STATE_INIT;
2150 case 'R': /* enable usr/menu keys */
2151 /* and fkey label modes */
2152 svsp->hp_state = SHP_INIT;
2153 svsp->state = STATE_INIT;
2156 case 'S': /* disable usr/menu keys */
2157 /* and fkey label modes */
2158 svsp->hp_state = SHP_INIT;
2159 svsp->state = STATE_INIT;
2171 case '9': /* parameters for esc & j xx L mm */
2173 svsp->m_len += (ch -'0');
2177 svsp->hp_state = SHP_AND_JL;
2179 svsp->transparent = 1;
2183 svsp->hp_state = SHP_INIT;
2184 svsp->state = STATE_INIT;
2192 svsp->m_buf[svsp->i] = ch;
2193 if(svsp->i >= svsp->m_len-1)
2195 svsp->state = STATE_INIT;
2196 svsp->hp_state = SHP_INIT;
2197 svsp->transparent = 0;
2199 svsp->m_buf[svsp->m_len] = '\0';
2200 /* display status line */
2201 /* needs to be implemented */
2202 /* see 2392 man, 3-14 */
2209 case SHP_AND_ETE: /* eat chars until uppercase */
2210 if(ch >= '@' && ch <= 'Z')
2212 svsp->hp_state = SHP_INIT;
2213 svsp->state = STATE_INIT;
2214 svsp->transparent = 0;
2219 svsp->hp_state = SHP_INIT;
2220 svsp->state = STATE_INIT;
2221 svsp->transparent = 0;
2226 #endif /* NVT > 0 */
2228 /* ------------------------- E O F ------------------------------------------*/