📄 pcvt_out.c
字号:
case '~': /* Lock Shift G1 -> GR */ svsp->GR = &svsp->G1; svsp->state = STATE_INIT; break; default: svsp->state = STATE_INIT; break; } break; case STATE_BLANK: /* ESC space [FG], which are */ svsp->state = STATE_INIT; /* currently ignored*/ break; case STATE_HASH: switch(ch) { case '3': /* double height top half */ case '4': /*double height bottom half*/ case '5': /*single width sngle height*/ case '6': /*double width sngle height*/ svsp->state = STATE_INIT; break; case '8': /* fill sceen with 'E's */ vt_aln(svsp); svsp->state = STATE_INIT; break; default: /* anything else */ svsp->state = STATE_INIT; break; } break; case STATE_BROPN: /* designate G0 */ case STATE_BRCLO: /* designate G1 */ case STATE_STAR: /* designate G2 */ case STATE_PLUS: /* designate G3 */ case STATE_MINUS: /* designate G1 (96) */ case STATE_DOT: /* designate G2 (96) */ case STATE_SLASH: /* designate G3 (96) */ svsp->which[svsp->whichi++] = ch; if(ch >= 0x20 && ch <= 0x2f && svsp->whichi <= 2) break; else if(ch >=0x30 && ch <= 0x7e) { svsp->which[svsp->whichi] = '\0'; vt_designate(svsp); } svsp->whichi = 0; svsp->state = STATE_INIT; break; case STATE_CSIQM: /* DEC private modes */ switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* parameters */ svsp->parms[svsp->parmi] *= 10; svsp->parms[svsp->parmi] += (ch -'0'); break; case ';': /* next parameter */ svsp->parmi = (svsp->parmi+1 < MAXPARMS) ? svsp->parmi+1 : svsp->parmi; break; case 'h': /* set mode */ vt_set_dec_priv_qm(svsp); svsp->state = STATE_INIT; break; case 'l': /* reset mode */ vt_reset_dec_priv_qm(svsp); svsp->state = STATE_INIT; break; case 'n': /* Reports */ vt_dsr(svsp); svsp->state = STATE_INIT; break; case 'K': /* selective erase in line */ vt_sel(svsp); svsp->state = STATE_INIT; break; case 'J':/*selective erase in display*/ vt_sed(svsp); svsp->state = STATE_INIT; break; default: svsp->state = STATE_INIT; break; } break; case STATE_CSI: switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* parameters */ svsp->parms[svsp->parmi] *= 10; svsp->parms[svsp->parmi] += (ch -'0'); break; case ';': /* next parameter */ svsp->parmi = (svsp->parmi+1 < MAXPARMS) ? svsp->parmi+1 : svsp->parmi; break; case '?': /* ESC [ ? family */ svsp->state = STATE_CSIQM; break; case '@': /* insert char */ vt_ic(svsp); svsp->state = STATE_INIT; break; case '"': /* select char attribute */ svsp->state = STATE_SCA; break; case '\'': /* for DECELR/DECSLE *//* XXX */ /* another state needed -hm */ break; case '!': /* soft terminal reset */ svsp->state = STATE_STR; break; case 'A': /* cursor up */ vt_cuu(svsp); svsp->state = STATE_INIT; break; case 'B': /* cursor down */ vt_cud(svsp); svsp->state = STATE_INIT; break; case 'C': /* cursor forward */ vt_cuf(svsp); svsp->state = STATE_INIT; break; case 'D': /* cursor backward */ vt_cub(svsp); svsp->state = STATE_INIT; break; case 'H': /* direct cursor addressing*/ vt_curadr(svsp); svsp->state = STATE_INIT; break; case 'J': /* erase screen */ vt_clreos(svsp); svsp->state = STATE_INIT; break; case 'K': /* erase line */ vt_clreol(svsp); svsp->state = STATE_INIT; break; case 'L': /* insert line */ vt_il(svsp); svsp->state = STATE_INIT; break; case 'M': /* delete line */ vt_dl(svsp); svsp->state = STATE_INIT; break; case 'P': /* delete character */ vt_dch(svsp); svsp->state = STATE_INIT; break; case 'S': /* scroll up */ vt_su(svsp); svsp->state = STATE_INIT; break; case 'T': /* scroll down */ vt_sd(svsp); svsp->state = STATE_INIT; break; case 'X': /* erase character */ vt_ech(svsp); svsp->state = STATE_INIT; break; case 'c': /* device attributes */ vt_da(svsp); svsp->state = STATE_INIT; break; case 'f': /* direct cursor addressing*/ vt_curadr(svsp); svsp->state = STATE_INIT; break; case 'g': /* clear tabs */ vt_clrtab(svsp); svsp->state = STATE_INIT; break; case 'h': /* set mode(s) */ vt_set_ansi(svsp); svsp->state = STATE_INIT; break; case 'i': /* media copy */ vt_mc(svsp); svsp->state = STATE_INIT; break; case 'l': /* reset mode(s) */ vt_reset_ansi(svsp); svsp->state = STATE_INIT; break; case 'm': /* select graphic rendition*/ vt_sgr(svsp); if (!kernel) attrib = svsp->c_attr; svsp->state = STATE_INIT; break; case 'n': /* reports */ vt_dsr(svsp); svsp->state = STATE_INIT; break; case 'r': /* set scrolling region */ vt_stbm(svsp); svsp->state = STATE_INIT; break; case 'x': /*request/report parameters*/ vt_reqtparm(svsp); svsp->state = STATE_INIT; break; case 'y': /* invoke selftest(s) */ vt_tst(svsp); svsp->state = STATE_INIT; break; case 'z': /* DECELR, ignored */ case '{': /* DECSLE, ignored */ svsp->state = STATE_INIT; break; default: svsp->state = STATE_INIT; break; } break; case STATE_AMPSND: hp_entry(ch,svsp); break; case STATE_DCS: vt_dcsentry(ch,svsp); break; case STATE_SCA: switch(ch) { case 'q': vt_sca(svsp); svsp->state = STATE_INIT; break; default: svsp->state = STATE_INIT; break; } break; case STATE_STR: switch(ch) { case 'p': /* soft terminal reset */ vt_str(svsp); if (!kernel) attrib = svsp->c_attr; svsp->state = STATE_INIT; break; default: svsp->state = STATE_INIT; break; } break; default: /* failsafe */ svsp->state = STATE_INIT; break; } } svsp->row = svsp->cur_offset / svsp->maxcol; /* current row update */ /* take care of last character on line behaviour */ if(svsp->lastchar && (svsp->col < ((svsp->maxcol)-1))) svsp->lastchar = 0; } if(svsp == vsp) /* on current displayed page ? */ cursor_pos_valid = 1; /* position is valid now */}/*---------------------------------------------------------------------------* * this is the absolute cold initialization of the emulator *---------------------------------------------------------------------------*/static voidvt_coldinit(void){ u_short volatile *cp; u_short was; int nscr, charset; int equipment; u_short *SaveCrtat; struct video_state *svsp; Crtat = (u_short *)MONO_BUF; /* XXX assume static relocation works */ SaveCrtat = Crtat; cp = Crtat + (CGA_BUF-MONO_BUF)/CHR; do_initialization = 0; /* reset init necessary flag */ /* get the equipment byte from the RTC chip */ equipment = ((rtcin(RTC_EQUIPMENT)) >> 4) & 0x03; switch(equipment) { case EQ_EGAVGA: /* set memory start to CGA == B8000 */ Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR; /* find out, what monitor is connected */ was = *cp; *cp = (u_short) 0xA55A; if (*cp != 0xA55A) { addr_6845 = MONO_BASE; color = 0; } else { *cp = was; addr_6845 = CGA_BASE; color = 1; } if(vga_test()) /* EGA or VGA ? */ { adaptor_type = VGA_ADAPTOR; totalfonts = 8; if(color == 0) { mda2egaorvga(); Crtat = SaveCrtat; /* mono start */ } /* find out which chipset we are running on */ vga_type = vga_chipset(); } else { adaptor_type = EGA_ADAPTOR; totalfonts = 4; if(color == 0) { mda2egaorvga(); Crtat = SaveCrtat; /* mono start */ } } /* decouple ega/vga charsets and intensity */ set_2ndcharset(); break; case EQ_40COLOR: /* XXX should panic in 40 col mode ! */ case EQ_80COLOR: Crtat = Crtat + (CGA_BUF-MONO_BUF)/CHR; addr_6845 = CGA_BASE; adaptor_type = CGA_ADAPTOR; color = 1; totalfonts = 0; break; case EQ_80MONO: addr_6845 = MONO_BASE; adaptor_type = MDA_ADAPTOR; color = 0; totalfonts = 0; break; } /* establish default colors */ if(color) { kern_attr = (COLOR_KERNEL_FG | COLOR_KERNEL_BG) << 8; user_attr = sgr_tab_color[0] << 8; } else { kern_attr = (MONO_KERNEL_FG | MONO_KERNEL_BG) << 8; if(adaptor_type == MDA_ADAPTOR) user_attr = sgr_tab_imono[0] << 8; else user_attr = sgr_tab_mono[0] << 8; } totalscreens = 1; /* for now until malloced */ for(nscr = 0, svsp = vs; nscr < PCVT_NSCREENS; nscr++, svsp++) { svsp->Crtat = Crtat; /* all same until malloc'ed */ svsp->Memory = Crtat; /* until malloc'ed */ svsp->cur_offset = 0; /* cursor offset */ svsp->c_attr = user_attr; /* non-kernel attributes */ svsp->bell_on = 1; /* enable bell */ svsp->sevenbit = 0; /* set to 8-bit path */ svsp->dis_fnc = 0; /* disable display functions */ svsp->transparent = 0; /* disable internal tranparency */ svsp->lastchar = 0; /* VTxxx behaviour of last */ /* char on line */ svsp->report_chars = NULL; /* VTxxx reports init */ svsp->report_count = 0; /* VTxxx reports init */ svsp->state = STATE_INIT; /* main state machine init */ svsp->m_awm = 1; /* enable auto wrap mode */ svsp->m_om = 0; /* origin mode = absolute */ svsp->sc_flag = 0; /* init saved cursor flag */ svsp->which_fkl = SYS_FKL; /* display system fkey-labels */ svsp->labels_on = 1; /* if in HP-mode, display */ /* fkey-labels */ svsp->attribute = 0; /* HP mode init */ svsp->key = 0; /* HP mode init */ svsp->l_len = 0; /* HP mode init */ svsp->s_len = 0; /* HP mode init */ svsp->m_len = 0; /* HP mode init */ svsp->i = 0; /* HP mode init */ svsp->vt_pure_mode = M_PUREVT; /* initial mode: pure VT220*/ svsp->vga_charset = CH_SET0; /* use bios default charset */#if PCVT_24LINESDEF /* true compatibility */ svsp->screen_rows = 24; /* default 24 rows on screen */#else /* full screen */ svsp->screen_rows = 25; /* default 25 rows on screen */#endif /* PCVT_24LINESDEF */ svsp->screen_rowsize = 25; /* default 25 rows on screen */ svsp->scrr_beg = 0; /* scrolling region begin row*/ svsp->scrr_len = svsp->screen_rows; /* scrolling region length*/ svsp->scrr_end = svsp->scrr_len - 1;/* scrolling region end */ if(nscr == 0) { if(adaptor_type == VGA_ADAPTOR) { /* only VGA can read cursor shape registers ! */ /* Preserve initial cursor shape */ outb(addr_6845,CRTC_CURSTART); svsp->cursor_start = inb(addr_6845+1); outb(addr_6845,CRTC_CUREND); svsp->cursor_end = inb(addr_6845+1); } else { /* MDA,HGC,CGA,EGA registers are write-only */ svsp->cursor_start = 0; svsp->cursor_end = 15; } } else { svsp->cursor_start = vs[0].cursor_start; svsp->cursor_end = vs[0].cursor_end; }#ifdef FAT_CURSOR svsp->cursor_start = 0; svsp->cursor_end = 15; /* cursor lower scanline */#endif svsp->cursor_on = 1; /* cursor is on */ svsp->ckm = 1; /* normal cursor key mode */ svsp->irm = 0; /* replace mode */ svsp->lnm = 0; /* CR only */ svsp->selchar = 0; /* selective attribute off */ svsp->G0 = csd_ascii; /* G0 = ascii */ svsp->G1 = csd_ascii; /* G1 = ascii */ svsp->G2 = csd_supplemental; /* G2 = supplemental */ svsp->G3 = csd_supplemental; /* G3 = supplemental */ svsp->GL = &svsp->G0; /* GL = G0 */ svsp->GR = &svsp->G2; /* GR = G2 */ svsp->whichi = 0; /* char set designate init */ svsp->which[0] = '\0'; /* char set designate init */ svsp->hp_state = SHP_INIT; /* init HP mode state machine*/ svsp->dcs_state = DCS_INIT; /* init DCS mode state machine*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -