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 $
48 * $DragonFly: src/sys/dev/video/pcvt/i386/Attic/pcvt_out.c,v 1.4 2003/08/07 21:17:16 dillon Exp $
50 *---------------------------------------------------------------------------*/
55 #define PCVT_INCLUDE_VT_SELATTR /* get inline function from pcvt_hdr.h */
57 #include "pcvt_hdr.h" /* global include */
59 #include <vm/vm_param.h>
62 extern u_short csd_ascii[]; /* pcvt_tbl.h */
63 extern u_short csd_supplemental[];
65 static void write_char (struct video_state *svsp, int attrib, int ch);
66 static void check_scroll ( struct video_state *svsp );
67 static void hp_entry ( U_char ch, struct video_state *svsp );
68 static void vt_coldinit ( void );
69 static void wrfkl ( int num, u_char *string, struct video_state *svsp );
70 static void writefkl ( int num, u_char *string, struct video_state *svsp );
72 static int check_scrollback ( struct video_state *svsp );
74 /*---------------------------------------------------------------------------*
75 * do character set transformation and write to display memory (inline)
76 *---------------------------------------------------------------------------*/
78 #define video (svsp->Crtat + svsp->cur_offset)
80 static __inline void write_char (svsp, attrib, ch)
81 struct video_state *svsp;
82 u_short attrib, ch; /* XXX inefficient interface */
84 if ((ch >= 0x20) && (ch <= 0x7f)) /* use GL if ch >= 0x20 */
86 if(!svsp->ss) /* single shift G2/G3 -> GL ? */
88 *video = attrib | (*svsp->GL)[ch-0x20];
92 *video = attrib | (*svsp->Gs)[ch-0x20];
100 if(ch >= 0x80) /* display controls C1 */
102 if(ch >= 0xA0) /* use GR if ch >= 0xA0 */
104 *video = attrib | (*svsp->GR)[ch-0xA0];
108 if(vgacs[svsp->vga_charset].secondloaded)
110 *video = attrib | ((ch-0x60) | CSH);
112 else /* use normal ibm charset for
115 *video = attrib | ch;
119 else /* display controls C0 */
121 if(vgacs[svsp->vga_charset].secondloaded)
123 *video = attrib | (ch | CSH);
125 else /* use normal ibm charset for control display*/
127 *video = attrib | ch;
133 /*---------------------------------------------------------------------------*
134 * emulator main entry
135 *---------------------------------------------------------------------------*/
137 sput (u_char *s, U_char kernel, int len, int page)
139 struct video_state *svsp;
144 if(page >= PCVT_NSCREENS) /* failsafe */
147 svsp = &vs[page]; /* pointer to current screen state */
149 if(do_initialization) /* first time called ? */
150 vt_coldinit(); /* yes, we have to init ourselves */
152 if(svsp == vsp) /* on current displayed page ? */
154 cursor_pos_valid = 0; /* do not update cursor */
157 if(scrnsv_active) /* screen blanked ? */
158 pcvt_scrnsv_reset(); /* unblank NOW ! */
160 reset_screen_saver = 1; /* do it asynchronously */
161 #endif /* PCVT_SCREENSAVER */
165 attrib = kernel ? kern_attr : svsp->c_attr;
168 if((ch = *(s++)) > 0)
173 if(((ch <= 0x1f) || (ch == 0x7f)) && (svsp->transparent == 0))
176 /* always process control-chars in the range 0x00..0x1f, 0x7f !!! */
180 if(svsp->lastchar && svsp->m_awm
181 && (svsp->lastrow == svsp->row))
190 bcopy((svsp->Crtat + svsp->cur_offset),
191 (svsp->Crtat + svsp->cur_offset) + 1,
192 (((svsp->maxcol)-1) - svsp->col)*CHR);
194 write_char(svsp, attrib, ch);
198 if(svsp->col >= ((svsp->maxcol)-1)
199 && ch != 0x0a && ch != 0x0b && ch != 0x0c)
202 svsp->lastrow = svsp->row;
204 else if(ch == 0x0a || ch == 0x0b || ch == 0x0c)
206 svsp->cur_offset -= svsp->col;
207 svsp->cur_offset += svsp->maxcol;
210 check_scroll(svsp); /* check scroll up */
234 sysbeep(PCVT_SYSBEEPF/1500, hz/4);
246 while(svsp->col < ((svsp->maxcol)-1))
250 tab_stops[++svsp->col])
258 if (check_scrollback(svsp))
260 extra = (svsp->cur_offset %
264 svsp->cur_offset - extra,
272 svsp->cur_offset -= svsp->col;
286 svsp->cur_offset -= svsp->col;
291 svsp->GL = &svsp->G1;
295 svsp->GL = &svsp->G0;
299 case 0x11: /* DC1/XON */
301 case 0x13: /* DC3/XOFF */
309 svsp->state = STATE_INIT;
317 svsp->state = STATE_INIT;
322 svsp->state = STATE_ESC;
338 /* char range 0x20...0x73, 0x80...0xff processing */
339 /* depends on current state */
344 if(svsp->lastchar && svsp->m_awm &&
345 (svsp->lastrow == svsp->row))
351 if (check_scrollback(svsp))
368 + svsp->cur_offset) + 1,
372 write_char(svsp, attrib, ch);
376 if(svsp->col >= ((svsp->maxcol)-1))
379 svsp->lastrow = svsp->row;
392 case ' ': /* ESC sp family */
393 svsp->state = STATE_BLANK;
396 case '#': /* ESC # family */
397 svsp->state = STATE_HASH;
400 case '&': /* ESC & family (HP) */
401 if(svsp->vt_pure_mode ==
414 case '(': /* ESC ( family */
415 svsp->state = STATE_BROPN;
418 case ')': /* ESC ) family */
419 svsp->state = STATE_BRCLO;
422 case '*': /* ESC * family */
423 svsp->state = STATE_STAR;
426 case '+': /* ESC + family */
427 svsp->state = STATE_PLUS;
430 case '-': /* ESC - family */
431 svsp->state = STATE_MINUS;
434 case '.': /* ESC . family */
435 svsp->state = STATE_DOT;
438 case '/': /* ESC / family */
439 svsp->state = STATE_SLASH;
442 case '7': /* SAVE CURSOR */
444 svsp->state = STATE_INIT;
447 case '8': /* RESTORE CURSOR */
450 attrib = svsp->c_attr;
451 svsp->state = STATE_INIT;
454 case '=': /* keypad application mode */
455 #if !PCVT_INHIBIT_NUMLOCK
458 svsp->state = STATE_INIT;
461 case '>': /* keypad numeric mode */
462 #if !PCVT_INHIBIT_NUMLOCK
465 svsp->state = STATE_INIT;
468 case 'D': /* INDEX */
470 svsp->state = STATE_INIT;
473 case 'E': /* NEXT LINE */
475 svsp->state = STATE_INIT;
478 case 'H': /* set TAB at current col */
479 svsp->tab_stops[svsp->col] = 1;
480 svsp->state = STATE_INIT;
483 case 'M': /* REVERSE INDEX */
485 svsp->state = STATE_INIT;
488 case 'N': /* SINGLE SHIFT G2 */
489 svsp->Gs = &svsp->G2;
491 svsp->state = STATE_INIT;
494 case 'O': /* SINGLE SHIFT G3 */
495 svsp->Gs = &svsp->G3;
497 svsp->state = STATE_INIT;
500 case 'P': /* DCS detected */
501 svsp->dcs_state = DCS_INIT;
502 svsp->state = STATE_DCS;
505 case 'Z': /* What are you = ESC [ c */
507 svsp->state = STATE_INIT;
510 case '[': /* CSI detected */
512 svsp->state = STATE_CSI;
515 case '\\': /* String Terminator */
516 svsp->state = STATE_INIT;
519 case 'c': /* hard reset */
522 attrib = svsp->c_attr;
523 svsp->state = STATE_INIT;
527 case 'd': /* set color sgr */
530 /* set shiftwidth=4 */
540 svsp->state = STATE_INIT;
542 #endif /* PCVT_SETCOLOR */
543 case 'n': /* Lock Shift G2 -> GL */
544 svsp->GL = &svsp->G2;
545 svsp->state = STATE_INIT;
548 case 'o': /* Lock Shift G3 -> GL */
549 svsp->GL = &svsp->G3;
550 svsp->state = STATE_INIT;
553 case '}': /* Lock Shift G2 -> GR */
554 svsp->GR = &svsp->G2;
555 svsp->state = STATE_INIT;
558 case '|': /* Lock Shift G3 -> GR */
559 svsp->GR = &svsp->G3;
560 svsp->state = STATE_INIT;
563 case '~': /* Lock Shift G1 -> GR */
564 svsp->GR = &svsp->G1;
565 svsp->state = STATE_INIT;
569 svsp->state = STATE_INIT;
574 case STATE_BLANK: /* ESC space [FG], which are */
575 svsp->state = STATE_INIT; /* currently ignored*/
581 case '3': /* double height top half */
582 case '4': /*double height bottom half*/
583 case '5': /*single width sngle height*/
584 case '6': /*double width sngle height*/
585 svsp->state = STATE_INIT;
588 case '8': /* fill sceen with 'E's */
590 svsp->state = STATE_INIT;
593 default: /* anything else */
594 svsp->state = STATE_INIT;
599 case STATE_BROPN: /* designate G0 */
600 case STATE_BRCLO: /* designate G1 */
601 case STATE_STAR: /* designate G2 */
602 case STATE_PLUS: /* designate G3 */
603 case STATE_MINUS: /* designate G1 (96) */
604 case STATE_DOT: /* designate G2 (96) */
605 case STATE_SLASH: /* designate G3 (96) */
606 svsp->which[svsp->whichi++] = ch;
607 if(ch >= 0x20 && ch <= 0x2f
608 && svsp->whichi <= 2)
610 else if(ch >=0x30 && ch <= 0x7e)
612 svsp->which[svsp->whichi] = '\0';
616 svsp->state = STATE_INIT;
619 case STATE_CSIQM: /* DEC private modes */
631 case '9': /* parameters */
632 svsp->parms[svsp->parmi] *= 10;
633 svsp->parms[svsp->parmi] +=
637 case ';': /* next parameter */
639 (svsp->parmi+1 < MAXPARMS) ?
640 svsp->parmi+1 : svsp->parmi;
643 case 'h': /* set mode */
644 vt_set_dec_priv_qm(svsp);
645 svsp->state = STATE_INIT;
648 case 'l': /* reset mode */
649 vt_reset_dec_priv_qm(svsp);
650 svsp->state = STATE_INIT;
653 case 'n': /* Reports */
655 svsp->state = STATE_INIT;
658 case 'K': /* selective erase in line */
660 svsp->state = STATE_INIT;
663 case 'J':/*selective erase in display*/
665 svsp->state = STATE_INIT;
669 svsp->state = STATE_INIT;
687 case '9': /* parameters */
688 svsp->parms[svsp->parmi] *= 10;
689 svsp->parms[svsp->parmi] +=
693 case ';': /* next parameter */
695 (svsp->parmi+1 < MAXPARMS) ?
696 svsp->parmi+1 : svsp->parmi;
699 case '?': /* ESC [ ? family */
700 svsp->state = STATE_CSIQM;
703 case '@': /* insert char */
705 svsp->state = STATE_INIT;
708 case '"': /* select char attribute */
709 svsp->state = STATE_SCA;
712 case '\'': /* for DECELR/DECSLE */
713 /* XXX */ /* another state needed -hm */
716 case '!': /* soft terminal reset */
717 svsp->state = STATE_STR;
720 case 'A': /* cursor up */
722 svsp->state = STATE_INIT;
725 case 'B': /* cursor down */
727 svsp->state = STATE_INIT;
730 case 'C': /* cursor forward */
732 svsp->state = STATE_INIT;
735 case 'D': /* cursor backward */
737 svsp->state = STATE_INIT;
740 case 'H': /* direct cursor addressing*/
742 svsp->state = STATE_INIT;
745 case 'J': /* erase screen */
747 svsp->state = STATE_INIT;
750 case 'K': /* erase line */
752 svsp->state = STATE_INIT;
753 if (svsp->scr_offset > 0 &&
758 case 'L': /* insert line */
760 svsp->state = STATE_INIT;
763 case 'M': /* delete line */
765 svsp->state = STATE_INIT;
768 case 'P': /* delete character */
770 svsp->state = STATE_INIT;
773 case 'S': /* scroll up */
775 svsp->state = STATE_INIT;
778 case 'T': /* scroll down */
780 svsp->state = STATE_INIT;
783 case 'X': /* erase character */
785 svsp->state = STATE_INIT;
788 case 'c': /* device attributes */
790 svsp->state = STATE_INIT;
793 case 'f': /* direct cursor addressing*/
795 svsp->state = STATE_INIT;
798 case 'g': /* clear tabs */
800 svsp->state = STATE_INIT;
803 case 'h': /* set mode(s) */
805 svsp->state = STATE_INIT;
808 case 'i': /* media copy */
810 svsp->state = STATE_INIT;
813 case 'l': /* reset mode(s) */
815 svsp->state = STATE_INIT;
818 case 'm': /* select graphic rendition*/
821 attrib = svsp->c_attr;
822 svsp->state = STATE_INIT;
825 case 'n': /* reports */
827 svsp->state = STATE_INIT;
830 case 'r': /* set scrolling region */
832 svsp->state = STATE_INIT;
835 case 'x': /*request/report parameters*/
837 svsp->state = STATE_INIT;
840 case 'y': /* invoke selftest(s) */
842 svsp->state = STATE_INIT;
845 case 'z': /* DECELR, ignored */
846 case '{': /* DECSLE, ignored */
847 svsp->state = STATE_INIT;
851 svsp->state = STATE_INIT;
861 vt_dcsentry(ch,svsp);
869 svsp->state = STATE_INIT;
873 svsp->state = STATE_INIT;
881 case 'p': /* soft terminal reset */
884 attrib = svsp->c_attr;
885 svsp->state = STATE_INIT;
889 svsp->state = STATE_INIT;
894 default: /* failsafe */
895 svsp->state = STATE_INIT;
901 svsp->row = svsp->cur_offset / svsp->maxcol; /* current row update */
903 /* take care of last character on line behaviour */
905 if(svsp->lastchar && (svsp->col < ((svsp->maxcol)-1)))
909 if(svsp == vsp) /* on current displayed page ? */
910 cursor_pos_valid = 1; /* position is valid now */
913 /*---------------------------------------------------------------------------*
914 * this is the absolute cold initialization of the emulator
915 *---------------------------------------------------------------------------*/
919 u_short volatile *cp;
924 struct video_state *svsp;
926 Crtat = (u_short *)MONO_BUF; /* XXX assume static relocation works */
928 cp = Crtat + (CGA_BUF-MONO_BUF)/CHR;
930 do_initialization = 0; /* reset init necessary flag */
932 /* get the equipment byte from the RTC chip */
934 equipment = ((rtcin(RTC_EQUIPMENT)) >> 4) & 0x03;
940 /* set memory start to CGA == B8000 */
942 Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR;
944 /* find out, what monitor is connected */
947 *cp = (u_short) 0xA55A;
950 addr_6845 = MONO_BASE;
956 addr_6845 = CGA_BASE;
960 if(vga_test()) /* EGA or VGA ? */
962 adaptor_type = VGA_ADAPTOR;
968 Crtat = SaveCrtat; /* mono start */
971 /* find out which chipset we are running on */
972 vga_type = vga_chipset();
976 adaptor_type = EGA_ADAPTOR;
982 Crtat = SaveCrtat; /* mono start */
986 /* decouple ega/vga charsets and intensity */
991 case EQ_40COLOR: /* XXX should panic in 40 col mode ! */
993 Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR;
994 addr_6845 = CGA_BASE;
995 adaptor_type = CGA_ADAPTOR;
1001 addr_6845 = MONO_BASE;
1002 adaptor_type = MDA_ADAPTOR;
1008 /* establish default colors */
1012 kern_attr = (COLOR_KERNEL_FG | COLOR_KERNEL_BG) << 8;
1013 user_attr = sgr_tab_color[0] << 8;
1017 kern_attr = (MONO_KERNEL_FG | MONO_KERNEL_BG) << 8;
1018 if(adaptor_type == MDA_ADAPTOR)
1019 user_attr = sgr_tab_imono[0] << 8;
1021 user_attr = sgr_tab_mono[0] << 8;
1024 totalscreens = 1; /* for now until malloced */
1026 for(nscr = 0, svsp = vs; nscr < PCVT_NSCREENS; nscr++, svsp++)
1028 svsp->Crtat = Crtat; /* all same until malloc'ed */
1029 svsp->Memory = Crtat; /* until malloc'ed */
1030 svsp->Scrollback = 0; /* until malloc'ed */
1031 svsp->scr_offset = 0; /* scrollback offset (lines) */
1032 svsp->scrolling = 0; /* current scrollback page */
1033 svsp->cur_offset = 0; /* cursor offset */
1034 svsp->c_attr = user_attr; /* non-kernel attributes */
1035 svsp->bell_on = 1; /* enable bell */
1036 svsp->sevenbit = 0; /* set to 8-bit path */
1037 svsp->dis_fnc = 0; /* disable display functions */
1038 svsp->transparent = 0; /* disable internal tranparency */
1039 svsp->lastchar = 0; /* VTxxx behaviour of last */
1041 svsp->report_chars = NULL; /* VTxxx reports init */
1042 svsp->report_count = 0; /* VTxxx reports init */
1043 svsp->state = STATE_INIT; /* main state machine init */
1044 svsp->m_awm = 1; /* enable auto wrap mode */
1045 svsp->m_om = 0; /* origin mode = absolute */
1046 svsp->sc_flag = 0; /* init saved cursor flag */
1047 svsp->which_fkl = SYS_FKL; /* display system fkey-labels */
1048 svsp->labels_on = 1; /* if in HP-mode, display */
1050 svsp->attribute = 0; /* HP mode init */
1051 svsp->key = 0; /* HP mode init */
1052 svsp->l_len = 0; /* HP mode init */
1053 svsp->s_len = 0; /* HP mode init */
1054 svsp->m_len = 0; /* HP mode init */
1055 svsp->i = 0; /* HP mode init */
1056 svsp->vt_pure_mode = M_PUREVT; /* initial mode: pure VT220*/
1057 svsp->vga_charset = CH_SET0; /* use bios default charset */
1059 #if PCVT_24LINESDEF /* true compatibility */
1060 svsp->screen_rows = 24; /* default 24 rows on screen */
1061 #else /* full screen */
1062 svsp->screen_rows = 25; /* default 25 rows on screen */
1063 #endif /* PCVT_24LINESDEF */
1065 svsp->screen_rowsize = 25; /* default 25 rows on screen */
1066 svsp->max_off = svsp->screen_rowsize * SCROLLBACK_PAGES - 1;
1067 svsp->scrr_beg = 0; /* scrolling region begin row*/
1068 svsp->scrr_len = svsp->screen_rows; /* scrolling region length*/
1069 svsp->scrr_end = svsp->scrr_len - 1;/* scrolling region end */
1073 if(adaptor_type == VGA_ADAPTOR)
1075 /* only VGA can read cursor shape registers ! */
1076 /* Preserve initial cursor shape */
1077 outb(addr_6845,CRTC_CURSTART);
1078 svsp->cursor_start = inb(addr_6845+1);
1079 outb(addr_6845,CRTC_CUREND);
1080 svsp->cursor_end = inb(addr_6845+1);
1084 /* MDA,HGC,CGA,EGA registers are write-only */
1085 svsp->cursor_start = 0;
1086 svsp->cursor_end = 15;
1091 svsp->cursor_start = vs[0].cursor_start;
1092 svsp->cursor_end = vs[0].cursor_end;
1096 svsp->cursor_start = 0;
1097 svsp->cursor_end = 15; /* cursor lower scanline */
1100 svsp->cursor_on = 1; /* cursor is on */
1101 svsp->ckm = 1; /* normal cursor key mode */
1102 svsp->irm = 0; /* replace mode */
1103 svsp->lnm = 0; /* CR only */
1104 svsp->selchar = 0; /* selective attribute off */
1105 svsp->G0 = csd_ascii; /* G0 = ascii */
1106 svsp->G1 = csd_ascii; /* G1 = ascii */
1107 svsp->G2 = csd_supplemental; /* G2 = supplemental */
1108 svsp->G3 = csd_supplemental; /* G3 = supplemental */
1109 svsp->GL = &svsp->G0; /* GL = G0 */
1110 svsp->GR = &svsp->G2; /* GR = G2 */
1111 svsp->whichi = 0; /* char set designate init */
1112 svsp->which[0] = '\0'; /* char set designate init */
1113 svsp->hp_state = SHP_INIT; /* init HP mode state machine*/
1114 svsp->dcs_state = DCS_INIT; /* init DCS mode state machine*/
1115 svsp->ss = 0; /* init single shift 2/3 */
1116 svsp->Gs = NULL; /* Gs single shift 2/3 */
1117 svsp->maxcol = SCR_COL80; /* 80 columns now (MUST!!!) */
1118 svsp->wd132col = 0; /* help good old WD .. */
1119 svsp->scroll_lock = 0; /* scrollock off */
1121 #if PCVT_INHIBIT_NUMLOCK
1122 svsp->num_lock = 0; /* numlock off */
1124 svsp->num_lock = 1; /* numlock on */
1127 svsp->caps_lock = 0; /* capslock off */
1128 svsp->shift_lock = 0; /* shiftlock off */
1130 #if PCVT_24LINESDEF /* true compatibility */
1131 svsp->force24 = 1; /* force 24 lines */
1132 #else /* maximum screen size */
1133 svsp->force24 = 0; /* no 24 lines force yet */
1134 #endif /* PCVT_24LINESDEF */
1136 vt_clearudk(svsp); /* clear vt220 udk's */
1138 vt_str(svsp); /* init emulator */
1143 * Preserve data on the startup screen that
1144 * precedes the cursor position. Leave the
1145 * cursor where it was found.
1150 /* CRTC regs 0x0e and 0x0f are r/w everywhere */
1152 outb(addr_6845, CRTC_CURSORH);
1153 cursorat = inb(addr_6845+1) << 8;
1154 outb(addr_6845, CRTC_CURSORL);
1155 cursorat |= inb(addr_6845+1);
1158 * Reject cursors that are more than one row off a
1159 * 25-row screen. syscons sets the cursor offset
1160 * to 0xffff. The scroll up fixup fails for this
1161 * because the assignment to svsp->row overflows
1162 * and perhaps for other reasons.
1164 if (cursorat > 25 * svsp->maxcol)
1165 cursorat = 25 * svsp->maxcol;
1167 svsp->cur_offset = cursorat;
1168 svsp->row = cursorat / svsp->maxcol;
1169 svsp->col = cursorat % svsp->maxcol;
1171 if (svsp->row >= svsp->screen_rows)
1175 * Scroll up; this should only happen when
1176 * PCVT_24LINESDEF is set
1180 - svsp->screen_rows;
1182 + nscroll*svsp->maxcol,
1185 * svsp->maxcol * CHR);
1186 svsp->row -= nscroll;
1188 nscroll * svsp->maxcol;
1191 filllen = (svsp->maxcol * svsp->screen_rowsize)
1195 fillw(user_attr | ' ',
1196 svsp->Crtat+svsp->cur_offset,
1200 #if PCVT_USL_VT_COMPAT
1201 svsp->smode.mode = VT_AUTO;
1202 svsp->smode.relsig = svsp->smode.acqsig =
1203 svsp->smode.frsig = 0;
1205 svsp->pid = svsp->vt_status = 0;
1206 #endif /* PCVT_USL_VT_COMPAT */
1210 for(charset = 0;charset < NVGAFONTS;charset++)
1212 vgacs[charset].loaded = 0; /* not populated yet */
1213 vgacs[charset].secondloaded = 0; /* not populated yet */
1215 switch(adaptor_type)
1220 * for a VGA, do not assume any
1221 * constant - instead, read the actual
1222 * values. This avoid problems with
1223 * LCD displays that apparently happen
1224 * to use font matrices up to 19
1225 * scan lines and 475 scan lines
1226 * total in order to make use of the
1230 outb(addr_6845, CRTC_VDE);
1231 vgacs[charset].scr_scanlines =
1233 outb(addr_6845, CRTC_MAXROW);
1234 vgacs[charset].char_scanlines =
1239 /* 0x5D for 25 lines */
1240 vgacs[charset].scr_scanlines = 0x5D;
1241 /* 0x4D for 25 lines */
1242 vgacs[charset].char_scanlines = 0x4D;
1248 /* These shouldn't be used for CGA/MDA */
1249 vgacs[charset].scr_scanlines = 0;
1250 vgacs[charset].char_scanlines = 0;
1253 vgacs[charset].screen_size = SIZ_25ROWS; /* set screen size */
1256 vgacs[0].loaded = 1; /* The BIOS loaded this at boot */
1258 /* set cursor for first screen */
1260 outb(addr_6845,CRTC_CURSTART); /* cursor start reg */
1261 outb(addr_6845+1,vs[0].cursor_start);
1262 outb(addr_6845,CRTC_CUREND); /* cursor end reg */
1263 outb(addr_6845+1,vs[0].cursor_end);
1265 /* this is to satisfy ddb */
1267 if(!keyboard_is_initialized)
1271 /*---------------------------------------------------------------------------*
1272 * get kernel memory for virtual screens
1274 * CAUTION: depends on "can_do_132col" being set properly, or
1275 * depends on vga_type() being run before calling this !!!
1277 *---------------------------------------------------------------------------*/
1282 int screen_max_size;
1284 /* we need to initialize in case we are not the console */
1286 if(do_initialization)
1289 switch(adaptor_type)
1294 screen_max_size = MAXROW_MDACGA * MAXCOL_MDACGA * CHR;
1298 screen_max_size = MAXROW_EGA * MAXCOL_EGA * CHR;
1304 MAXROW_VGA * MAXCOL_SVGA * CHR;
1307 MAXROW_VGA * MAXCOL_VGA * CHR;
1310 for(nscr = 0; nscr < PCVT_NSCREENS; nscr++)
1312 if((vs[nscr].Memory = (u_short *)malloc(screen_max_size * 2,
1313 M_DEVBUF, M_WAITOK)) == NULL)
1315 printf("pcvt: screen memory malloc failed, "
1316 "NSCREEN=%d, nscr=%d\n",
1317 PCVT_NSCREENS, nscr);
1323 vs[nscr].Crtat = vs[nscr].Memory;
1324 fillw(user_attr | ' ',
1326 vs[nscr].maxcol * vs[nscr].screen_rowsize);
1330 vs[nscr].scrollback_pages = SCROLLBACK_PAGES;
1332 reallocate_scrollbuffer(&(vs[nscr]), vs[nscr].scrollback_pages);
1336 /*---------------------------------------------------------------------------*
1337 * check if we must scroll up screen
1338 *---------------------------------------------------------------------------*/
1340 check_scroll(struct video_state *svsp)
1342 if(!svsp->abs_write)
1344 /* we write within scroll region */
1346 if(svsp->cur_offset >= ((svsp->scrr_end + 1) * svsp->maxcol))
1348 /* the following piece of code has to be protected */
1349 /* from trying to switch to another virtual screen */
1350 /* while being in there ... */
1352 critical_scroll = 1; /* flag protect ON */
1354 roll_up(svsp, 1); /* rolling up .. */
1356 svsp->cur_offset -= svsp->maxcol;/* update position */
1358 if(switch_page != -1) /* someone wanted to switch ? */
1360 vgapage(switch_page); /* yes, then switch ! */
1361 switch_page = -1; /* reset switch flag */
1364 critical_scroll = 0; /* flag protect OFF */
1369 /* clip, if outside of screen */
1371 if (svsp->cur_offset >= svsp->screen_rows * svsp->maxcol)
1372 svsp->cur_offset -= svsp->maxcol;
1377 check_scrollback(struct video_state *svsp)
1379 /* still waiting for scrollback memory or not on current page */
1380 if (!svsp->Scrollback || svsp != vsp)
1383 /* remove first line of scrollback buffer to make room for new line */
1384 if (svsp->scr_offset == svsp->max_off)
1386 bcopy(svsp->Scrollback + svsp->maxcol, svsp->Scrollback,
1387 svsp->maxcol * svsp->max_off * CHR);
1391 /* still room left, increase scroll offset (lines) */
1397 /*---------------------------------------------------------------------------*
1398 * write to one user function key label
1399 *---------------------------------------------------------------------------*/
1401 writefkl(int num, u_char *string, struct video_state *svsp)
1403 if((num < 0) || (num > 7)) /* range ok ? */
1406 strncpy(svsp->ufkl[num], string, 16); /* save string in static array */
1408 if(svsp->which_fkl == USR_FKL)
1409 wrfkl(num,string,svsp);
1412 /*---------------------------------------------------------------------------*
1413 * write to one system function key label
1414 *---------------------------------------------------------------------------*/
1416 swritefkl(int num, u_char *string, struct video_state *svsp)
1418 if((num < 0) || (num > 7)) /* range ok ? */
1421 strncpy(svsp->sfkl[num], string, 16); /* save string in static array */
1423 if(svsp->which_fkl == SYS_FKL)
1424 wrfkl(num,string,svsp);
1427 /*---------------------------------------------------------------------------*
1428 * write function key label onto screen
1429 *---------------------------------------------------------------------------*/
1431 wrfkl(int num, u_char *string, struct video_state *svsp)
1437 if(!svsp->labels_on || (svsp->vt_pure_mode == M_PUREVT))
1441 + (svsp->screen_rows * svsp->maxcol)); /* screen_rows+1 line */
1443 if(svsp->maxcol == SCR_COL80)
1445 if(num < 4) /* labels 1 .. 4 */
1446 p += (num * LABEL_LEN);
1447 else /* labels 5 .. 8 */
1448 p += ((num * LABEL_LEN) + LABEL_MID + 1);
1452 if(num < 4) /* labels 1 .. 4 */
1453 p += (num * (LABEL_LEN + 6));
1454 else /* labels 5 .. 8 */
1455 p += ((num * (LABEL_LEN + 6)) + LABEL_MID + 11);
1458 p1 = p + svsp->maxcol; /* second label line */
1460 while((*string != '\0') && (cnt < 8))
1462 *p = ((0x70 << 8) + (*string & 0xff));
1469 *p = ((0x70 << 8) + ' ');
1474 while((*string != '\0') && (cnt < 16))
1476 *p1 = ((0x70 << 8) + (*string & 0xff));
1483 *p1 = ((0x70 << 8) + ' ');
1489 /*---------------------------------------------------------------------------*
1490 * remove (=blank) function key labels, row/col and status line
1491 *---------------------------------------------------------------------------*/
1493 fkl_off(struct video_state *svsp)
1499 svsp->labels_on = 0;
1501 if((vgacs[svsp->vga_charset].screen_size==SIZ_28ROWS) && svsp->force24)
1506 p = (svsp->Crtat + (svsp->screen_rows * svsp->maxcol));
1508 for(num = 0; num < (size * svsp->maxcol); num++)
1512 /*---------------------------------------------------------------------------*
1513 * (re-) display function key labels, row/col and status line
1514 *---------------------------------------------------------------------------*/
1516 fkl_on(struct video_state *svsp)
1518 svsp->labels_on = 1;
1520 if(svsp->which_fkl == SYS_FKL)
1522 else if(svsp->which_fkl == USR_FKL)
1526 /*---------------------------------------------------------------------------*
1527 * set emulation mode, switch between pure VTxxx mode and HP/VTxxx mode
1528 *---------------------------------------------------------------------------*/
1530 set_emulation_mode(struct video_state *svsp, int mode)
1532 if(svsp->vt_pure_mode == mode)
1535 clr_parms(svsp); /* escape parameter init */
1536 svsp->state = STATE_INIT; /* initial state */
1537 svsp->scrr_beg = 0; /* start of scrolling region */
1538 svsp->sc_flag = 0; /* invalidate saved cursor position */
1539 svsp->transparent = 0; /* disable control code processing */
1541 if(mode == M_HPVT) /* vt-pure -> hp/vt-mode */
1543 svsp->screen_rows = svsp->screen_rowsize - 3;
1544 if (svsp->force24 && svsp->screen_rows == 25)
1545 svsp->screen_rows = 24;
1547 if (svsp->row >= svsp->screen_rows) {
1549 int nscroll = svsp->row + 1 - svsp->screen_rows;
1550 bcopy (svsp->Crtat + nscroll * svsp->maxcol,
1552 svsp->screen_rows * svsp->maxcol * CHR);
1553 svsp->row -= nscroll;
1554 svsp->cur_offset -= nscroll * svsp->maxcol;
1557 svsp->vt_pure_mode = M_HPVT;
1560 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1562 svsp->scrr_len = svsp->screen_rows;
1563 svsp->scrr_end = svsp->scrr_len - 1;
1567 else if(mode == M_PUREVT) /* hp/vt-mode -> vt-pure */
1569 fillw(user_attr | ' ',
1570 svsp->Crtat + svsp->screen_rows * svsp->maxcol,
1571 (svsp->screen_rowsize - svsp->screen_rows)
1574 svsp->vt_pure_mode = M_PUREVT;
1576 svsp->screen_rows = svsp->screen_rowsize;
1577 if (svsp->force24 && svsp->screen_rows == 25)
1578 svsp->screen_rows = 24;
1581 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1583 svsp->scrr_len = svsp->screen_rows;
1584 svsp->scrr_end = svsp->scrr_len - 1;
1588 if (svsp->vs_tty && svsp->vs_tty->t_pgrp)
1589 pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
1590 #endif /* PCVT_SIGWINCH */
1594 /*---------------------------------------------------------------------------*
1595 * initialize user function key labels
1596 *---------------------------------------------------------------------------*/
1598 init_ufkl(struct video_state *svsp)
1600 writefkl(0,(u_char *)" f1",svsp); /* init fkey labels */
1601 writefkl(1,(u_char *)" f2",svsp);
1602 writefkl(2,(u_char *)" f3",svsp);
1603 writefkl(3,(u_char *)" f4",svsp);
1604 writefkl(4,(u_char *)" f5",svsp);
1605 writefkl(5,(u_char *)" f6",svsp);
1606 writefkl(6,(u_char *)" f7",svsp);
1607 writefkl(7,(u_char *)" f8",svsp);
1610 /*---------------------------------------------------------------------------*
1611 * initialize system user function key labels
1612 *---------------------------------------------------------------------------*/
1614 init_sfkl(struct video_state *svsp)
1616 /* 1234567812345678 */
1618 /* 1234567812345678 */
1619 swritefkl(0,(u_char *)"132 COLUMNS ",svsp);
1621 swritefkl(0,(u_char *)" ",svsp);
1623 /* 1234567812345678 */
1624 swritefkl(1,(u_char *)"SOFT-RSTTERMINAL",svsp);
1627 swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp);
1629 swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp);
1631 #if PCVT_SHOWKEYS /* 1234567812345678 */
1633 swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp);
1635 swritefkl(3,(u_char *)" ",svsp);
1637 swritefkl(3,(u_char *)" ",svsp);
1638 #endif /* PCVT_SHOWKEYS */
1640 /* 1234567812345678 */
1642 swritefkl(4,(u_char *)"BELL ENABLE *",svsp);
1644 swritefkl(4,(u_char *)"BELL ENABLE ",svsp);
1647 swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp);
1649 swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp);
1651 swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp);
1653 swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp);
1654 /* 1234567812345678 */
1657 /*---------------------------------------------------------------------------*
1658 * switch display to user function key labels
1659 *---------------------------------------------------------------------------*/
1661 sw_ufkl(struct video_state *svsp)
1664 svsp->which_fkl = USR_FKL;
1665 for(i = 0; i < 8; i++)
1666 wrfkl(i,svsp->ufkl[i],svsp);
1669 /*---------------------------------------------------------------------------*
1670 * switch display to system function key labels
1671 *---------------------------------------------------------------------------*/
1673 sw_sfkl(struct video_state *svsp)
1676 svsp->which_fkl = SYS_FKL;
1677 for(i = 0; i < 8; i++)
1678 wrfkl(i,svsp->sfkl[i],svsp);
1681 /*---------------------------------------------------------------------------*
1682 * toggle force 24 lines
1683 *---------------------------------------------------------------------------*/
1685 toggl_24l(struct video_state *svsp)
1687 if(svsp->which_fkl == SYS_FKL)
1692 swritefkl(2,(u_char *)"FORCE24 ENABLE ",svsp);
1697 swritefkl(2,(u_char *)"FORCE24 ENABLE *",svsp);
1699 set_screen_size(svsp, vgacs[(svsp->vga_charset)].screen_size);
1704 /*---------------------------------------------------------------------------*
1705 * toggle keyboard scancode display
1706 *---------------------------------------------------------------------------*/
1708 toggl_kbddbg(struct video_state *svsp)
1710 if((svsp->which_fkl == SYS_FKL) && (svsp == &vs[0]))
1715 swritefkl(3,(u_char *)"KEYBSCANDISPLAY ",svsp);
1720 swritefkl(3,(u_char *)"KEYBSCANDISPLAY*",svsp);
1724 #endif /* PCVT_SHOWKEYS */
1726 /*---------------------------------------------------------------------------*
1727 * toggle display functions
1728 *---------------------------------------------------------------------------*/
1730 toggl_dspf(struct video_state *svsp)
1732 if(svsp->which_fkl == SYS_FKL)
1737 swritefkl(6,(u_char *)"DISPLAY FUNCTNS ",svsp);
1742 swritefkl(6,(u_char *)"DISPLAY FUNCTNS*",svsp);
1747 /*---------------------------------------------------------------------------*
1749 *---------------------------------------------------------------------------*/
1751 toggl_awm(struct video_state *svsp)
1753 if(svsp->which_fkl == SYS_FKL)
1758 swritefkl(7,(u_char *)"AUTOWRAPENABLE ",svsp);
1763 swritefkl(7,(u_char *)"AUTOWRAPENABLE *",svsp);
1768 /*---------------------------------------------------------------------------*
1770 *---------------------------------------------------------------------------*/
1772 toggl_bell(struct video_state *svsp)
1774 if(svsp->which_fkl == SYS_FKL)
1779 swritefkl(4,(u_char *)"BELL ENABLE ",svsp);
1784 swritefkl(4,(u_char *)"BELL ENABLE *",svsp);
1789 /*---------------------------------------------------------------------------*
1791 *---------------------------------------------------------------------------*/
1793 toggl_sevenbit(struct video_state *svsp)
1795 if(svsp->which_fkl == SYS_FKL)
1800 swritefkl(5,(u_char *)"8-BIT ENABLE *",svsp);
1805 swritefkl(5,(u_char *)"8-BIT ENABLE ",svsp);
1810 /*---------------------------------------------------------------------------*
1812 *---------------------------------------------------------------------------*/
1814 toggl_columns(struct video_state *svsp)
1816 if(svsp->which_fkl == SYS_FKL)
1818 if(svsp->maxcol == SCR_COL132)
1820 if(vt_col(svsp, SCR_COL80))
1825 if(vt_col(svsp, SCR_COL132))
1831 /*---------------------------------------------------------------------------*
1832 * toggle vga 80/132 column operation
1833 *---------------------------------------------------------------------------*/
1835 vt_col(struct video_state *svsp, int cols)
1837 if(vga_col(svsp, cols) == 0)
1840 if(cols == SCR_COL80)
1841 swritefkl(0,(u_char *)"132 COLUMNS ",svsp);
1843 swritefkl(0,(u_char *)"132 COLUMNS*",svsp);
1845 fillw(user_attr | ' ',
1847 svsp->maxcol * svsp->screen_rowsize);
1849 clr_parms(svsp); /* escape parameter init */
1850 svsp->state = STATE_INIT; /* initial state */
1851 svsp->col = 0; /* init row */
1852 svsp->row = 0; /* init col */
1853 svsp->cur_offset = 0; /* cursor offset init */
1854 svsp->sc_flag = 0; /* invalidate saved cursor position */
1855 svsp->scrr_beg = 0; /* reset scrolling region */
1856 svsp->scrr_len = svsp->screen_rows; /*reset scrolling region legnth */
1857 svsp->scrr_end = svsp->scrr_len - 1;
1858 svsp->transparent = 0; /* disable control code processing */
1859 svsp->selchar = 0; /* selective attr off */
1860 vt_initsel(svsp); /* re-init sel attr */
1862 update_hp(svsp); /* update labels, row/col, page ind */
1864 /* Update winsize struct to reflect screen size */
1868 svsp->vs_tty->t_winsize.ws_row = svsp->screen_rows;
1869 svsp->vs_tty->t_winsize.ws_col = svsp->maxcol;
1871 svsp->vs_tty->t_winsize.ws_xpixel =
1872 (cols == SCR_COL80)? 720: 1056;
1873 svsp->vs_tty->t_winsize.ws_ypixel = 400;
1876 if(svsp->vs_tty->t_pgrp)
1877 pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1);
1878 #endif /* PCVT_SIGWINCH */
1881 reallocate_scrollbuffer(svsp, svsp->scrollback_pages);
1885 /*---------------------------------------------------------------------------*
1886 * update HP stuff on screen
1887 *---------------------------------------------------------------------------*/
1889 update_hp(struct video_state *svsp)
1891 if(svsp->vt_pure_mode != M_HPVT)
1894 fillw (user_attr | ' ',
1895 svsp->Crtat + svsp->screen_rows * svsp->maxcol,
1896 (svsp->screen_rowsize - svsp->screen_rows) * svsp->maxcol);
1898 if (!svsp->labels_on)
1901 /* update fkey labels */
1908 /* update current displayed screen indicator */
1910 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1911 + svsp->maxcol - 3) = user_attr | '[';
1912 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1913 + svsp->maxcol - 2) = user_attr | (current_video_screen + '0');
1914 *((svsp->Crtat + ((svsp->screen_rows + 2) * svsp->maxcol))
1915 + svsp->maxcol - 1) = user_attr | ']';
1919 /*---------------------------------------------------------------------------*
1920 * initialize ANSI escape sequence parameter buffers
1921 *---------------------------------------------------------------------------*/
1923 clr_parms(struct video_state *svsp)
1926 for(i=0; i < MAXPARMS; i++)
1932 /*---------------------------------------------------------------------------*
1934 * partial HP 2392 ANSI mode Emulator
1935 * ==================================
1937 * this part takes over the emulation of some escape sequences
1938 * needed to handle the function key labels
1940 * They are modeled after the corresponding escape sequences
1941 * introduced with the HP2392 terminals from Hewlett-Packard.
1944 * "HP2392A, Display Terminal Reference Manual",
1945 * HP Manual Part Number 02390-90001
1947 * Reference Manual Supplement
1948 * "2392A Display Terminal Option 049, ANSI Operation"
1949 * HP Manual Part Number 02390-90023EN
1951 *---------------------------------------------------------------------------*/
1954 hp_entry(U_char ch, struct video_state *svsp)
1956 switch(svsp->hp_state)
1962 svsp->hp_state = SHP_AND_F;
1963 svsp->attribute = 0;
1972 svsp->hp_state = SHP_AND_J;
1976 svsp->hp_state = SHP_AND_ETE;
1980 svsp->hp_state = SHP_INIT;
1981 svsp->state = STATE_INIT;
1987 if((ch >= '0') && (ch <= '8'))
1989 svsp->attribute = ch;
1990 svsp->hp_state = SHP_AND_Fa;
1994 svsp->hp_state = SHP_INIT;
1995 svsp->state = STATE_INIT;
2001 svsp->hp_state = SHP_AND_Fak;
2004 svsp->key = svsp->attribute;
2005 svsp->hp_state = SHP_AND_Fakd;
2009 svsp->hp_state = SHP_INIT;
2010 svsp->state = STATE_INIT;
2015 if((ch >= '1') && (ch <= '8'))
2018 svsp->hp_state = SHP_AND_Fak1;
2022 svsp->hp_state = SHP_INIT;
2023 svsp->state = STATE_INIT;
2029 svsp->hp_state = SHP_AND_Fakd;
2032 svsp->hp_state = SHP_INIT;
2033 svsp->state = STATE_INIT;
2038 if(svsp->l_len > 16)
2040 svsp->hp_state = SHP_INIT;
2041 svsp->state = STATE_INIT;
2043 else if(ch >= '0' && ch <= '9')
2046 svsp->l_len += (ch -'0');
2049 svsp->hp_state = SHP_AND_FakdL;
2052 svsp->hp_state = SHP_INIT;
2053 svsp->state = STATE_INIT;
2058 if(svsp->s_len > 80)
2060 svsp->hp_state = SHP_INIT;
2061 svsp->state = STATE_INIT;
2063 else if(ch >= '0' && ch <= '9')
2066 svsp->s_len += (ch -'0');
2070 svsp->hp_state = SHP_AND_FakdLl;
2071 svsp->transparent = 1;
2075 svsp->hp_state = SHP_INIT;
2076 svsp->state = STATE_INIT;
2080 case SHP_AND_FakdLl:
2081 svsp->l_buf[svsp->i] = ch;
2082 if(svsp->i >= svsp->l_len-1)
2084 svsp->hp_state = SHP_AND_FakdLls;
2086 if(svsp->s_len == 0)
2088 svsp->state = STATE_INIT;
2089 svsp->hp_state = SHP_INIT;
2090 svsp->transparent = 0;
2092 svsp->l_buf[svsp->l_len] = '\0';
2093 svsp->s_buf[svsp->s_len] = '\0';
2094 writefkl((svsp->key - '0' -1),
2102 case SHP_AND_FakdLls:
2103 svsp->s_buf[svsp->i] = ch;
2104 if(svsp->i >= svsp->s_len-1)
2106 svsp->state = STATE_INIT;
2107 svsp->hp_state = SHP_INIT;
2108 svsp->transparent = 0;
2110 svsp->l_buf[svsp->l_len] = '\0';
2111 svsp->s_buf[svsp->s_len] = '\0';
2112 writefkl((svsp->key - '0' -1), svsp->l_buf,
2122 case '@': /* enable user keys, remove */
2123 /* all labels & status from */
2125 svsp->hp_state = SHP_INIT;
2126 svsp->state = STATE_INIT;
2130 case 'A': /* enable & display "modes" */
2131 svsp->hp_state = SHP_INIT;
2132 svsp->state = STATE_INIT;
2137 case 'B': /* enable & display "user" */
2138 svsp->hp_state = SHP_INIT;
2139 svsp->state = STATE_INIT;
2144 case 'C': /* remove (clear) status line*/
2145 /* and restore current labels*/
2146 svsp->hp_state = SHP_INIT;
2147 svsp->state = STATE_INIT;
2151 case 'R': /* enable usr/menu keys */
2152 /* and fkey label modes */
2153 svsp->hp_state = SHP_INIT;
2154 svsp->state = STATE_INIT;
2157 case 'S': /* disable usr/menu keys */
2158 /* and fkey label modes */
2159 svsp->hp_state = SHP_INIT;
2160 svsp->state = STATE_INIT;
2172 case '9': /* parameters for esc & j xx L mm */
2174 svsp->m_len += (ch -'0');
2178 svsp->hp_state = SHP_AND_JL;
2180 svsp->transparent = 1;
2184 svsp->hp_state = SHP_INIT;
2185 svsp->state = STATE_INIT;
2193 svsp->m_buf[svsp->i] = ch;
2194 if(svsp->i >= svsp->m_len-1)
2196 svsp->state = STATE_INIT;
2197 svsp->hp_state = SHP_INIT;
2198 svsp->transparent = 0;
2200 svsp->m_buf[svsp->m_len] = '\0';
2201 /* display status line */
2202 /* needs to be implemented */
2203 /* see 2392 man, 3-14 */
2210 case SHP_AND_ETE: /* eat chars until uppercase */
2211 if(ch >= '@' && ch <= 'Z')
2213 svsp->hp_state = SHP_INIT;
2214 svsp->state = STATE_INIT;
2215 svsp->transparent = 0;
2220 svsp->hp_state = SHP_INIT;
2221 svsp->state = STATE_INIT;
2222 svsp->transparent = 0;
2227 #endif /* NVT > 0 */
2229 /* ------------------------- E O F ------------------------------------------*/