📄 pcvt_ext.c
字号:
{ static char *vga_tab[] = { "generic", "et4000", "et3000", "pvga1a", "wd90c00", "wd90c10", "wd90c11", "v7 vega", "v7 fast", "v7 ver5", "v7 1024i", "unknown v7", "tvga 8800br", "tvga 8800cs", "tvga 8900b", "tvga 8900c", "tvga 8900cl", "tvga 9000", "tvga 9100", "tvga 9200", "unknown trident", "s3 911", "s3 924", "s3 801/805", "s3 928", "unkown s3", "cl-gd5402", "cl-gd5402r1", "cl-gd5420", "cl-gd5420r1", "cl-gd5422", "cl-gd5424", "cl-gd5426", "cl-gd5428" }; return(vga_tab[number]);}/*---------------------------------------------------------------------------* * toggle vga 80/132 column operation *---------------------------------------------------------------------------*/intvga_col(struct video_state *svsp, int cols){ int ret = 0; if(adaptor_type != VGA_ADAPTOR) return(0); switch(vga_type) { case VGA_ET4000: ret = et4000_col(cols); break; case VGA_WD90C11: ret = wd90c11_col(cols); break; case VGA_TR8900B: case VGA_TR8900C: case VGA_TR8900CL: case VGA_TR9000: ret = tri9000_col(cols); break; case VGA_V71024I: ret = v7_1024i_col(cols); break; case VGA_S3_928: ret = s3_928_col(cols); break; case VGA_CL_GD5402: case VGA_CL_GD5402r1: case VGA_CL_GD5420: case VGA_CL_GD5420r1: case VGA_CL_GD5422: case VGA_CL_GD5424: case VGA_CL_GD5426: case VGA_CL_GD5428: ret = cl_gd542x_col(cols); break; default:#if PCVT_132GENERIC ret = generic_col(cols);#endif /* PCVT_132GENERIC */ break; } if(ret == 0) return(0); /* failed */ svsp->maxcol = cols; return(1);}#if PCVT_132GENERIC/*---------------------------------------------------------------------------* * toggle 80/132 column operation for "generic" SVGAs * NB: this is supposed to work on any (S)VGA as long as the monitor * is able to sync down to 21.5 kHz horizontally. The resulting * vertical frequency is only 50 Hz, so if there is some better board * specific algorithm, we avoid using this generic one. * REPORT ANY FAILURES SO WE CAN IMPROVE THIS *---------------------------------------------------------------------------*/#if PCVT_EXP_132COL/* * Some improved (i.e. higher scan rates) figures for the horizontal * timing. USE AT YOUR OWN RISK, THIS MIGHT DAMAGE YOUR MONITOR DUE * TO A LOSS OF HORIZONTAL SYNC! * The figures have been tested with an ET3000 board along with a * NEC MultiSync 3D monitor. If you are playing here, consider * testing with several screen pictures (dark background vs. light * background, even enlightening the border color may impact the * result - you can do this e.g. by "scon -p black,42,42,42") * Remember that all horizontal timing values must be dividable * by 8! (The scheme below is taken so that nifty kernel hackers * are able to patch the figures at run-time.) * * The actual numbers result in 23 kHz line scan and 54 Hz vertical * scan. */#endif /* PCVT_EXP_132COL */intgeneric_col(int cols){ u_char *sp; u_char byte;#if !PCVT_EXP_132COL /* stable figures for any multisync monitor that syncs down to 22 kHz*/ static volatile u_short htotal = 1312; static volatile u_short displayend = 1056; static volatile u_short blankstart = 1072; static volatile u_short syncstart = 1112; static volatile u_short syncend = 1280;#else /* PCVT_EXP_132COL */ /* reduced sync-pulse width and sync delays */ static volatile u_short htotal = 1232; static volatile u_short displayend = 1056; static volatile u_short blankstart = 1056; static volatile u_short syncstart = 1104; static volatile u_short syncend = 1168;#endif /* PCVT_EXP_132COL */ vga_screen_off(); /* enable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); byte = inb(addr_6845+1); outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte & 0x7f); if(cols == SCR_COL132) /* switch 80 -> 132 */ { /* save state of board for 80 columns */ if(!regsaved) { regsaved = 1; sp = savearea.generic; outb(addr_6845, 0x00); /* Horizontal Total */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x01); /* Horizontal Display End */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x02); /* Horizontal Blank Start */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x03); /* Horizontal Blank End */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x05); /* Horizontal Retrace End */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x13); /* Row Offset Register */ *sp++ = inb(addr_6845+1); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ *sp++ = inb(TS_DATA); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Mode control */ outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); *sp++ = inb(ATC_DATAR); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Horizontal Pixel Panning */ outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); *sp++ = inb(ATC_DATAR); *sp++ = inb(GN_MISCOUTR); /* Misc output register */ } /* setup chipset for 132 column operation */ outb(addr_6845, 0x00); /* Horizontal Total */ outb(addr_6845+1, (htotal / 8) - 5); outb(addr_6845, 0x01); /* Horizontal Display End */ outb(addr_6845+1, (displayend / 8) - 1); outb(addr_6845, 0x02); /* Horizontal Blank Start */ outb(addr_6845+1, blankstart / 8); outb(addr_6845, 0x03); /* Horizontal Blank End */ outb(addr_6845+1, ((syncend / 8) & 0x1f) | 0x80); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ outb(addr_6845+1, syncstart / 8); outb(addr_6845, 0x05); /* Horizontal Retrace End */ outb(addr_6845+1, (((syncend / 8) & 0x20) * 4) | ((syncend / 8) & 0x1f)); outb(addr_6845, 0x13); /* Row Offset Register */ outb(addr_6845+1, 0x42); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ outb(TS_DATA, 0x01); /* 8 dot char clock */ if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); /* ATC Mode control */ outb(ATC_DATAW, 0x08); /* Line graphics disable */ if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); /* ATC Horizontal Pixel Panning */ outb(ATC_DATAW, 0x00); /* Misc output register */ /* use the 28.322 MHz clock */ outb(GN_MISCOUTW, (inb(GN_MISCOUTR) & ~0x0c) | 4); } else /* switch 132 -> 80 */ { if(!regsaved) /* failsafe */ { /* disable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte); vga_screen_on(); return(0); } sp = savearea.generic; outb(addr_6845, 0x00); /* Horizontal Total */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x01); /* Horizontal Display End */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x02); /* Horizontal Blank Start */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x03); /* Horizontal Blank End */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x05); /* Horizontal Retrace End */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x13); /* Row Offset Register */ outb(addr_6845+1, *sp++); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ outb(TS_DATA, *sp++); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Mode control */ outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); outb(ATC_DATAW, *sp++); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Horizontal Pixel Panning */ outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); outb(ATC_DATAW, *sp++); outb(GN_MISCOUTW, *sp++); /* Misc output register */ } /* disable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte); vga_screen_on(); return(1);}#endif /* PCVT_132GENERIC *//*---------------------------------------------------------------------------* * toggle 80/132 column operation for ET4000 based boards *---------------------------------------------------------------------------*/intet4000_col(int cols){ u_char *sp; u_char byte; vga_screen_off(); /* enable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); byte = inb(addr_6845+1); outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte & 0x7f); if(cols == SCR_COL132) /* switch 80 -> 132 */ { /* save state of board for 80 columns */ if(!regsaved) { regsaved = 1; sp = savearea.et4000; outb(addr_6845, 0x00); /* Horizontal Total */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x01); /* Horizontal Display End */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x02); /* Horizontal Blank Start */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x05); /* Horizontal Retrace End */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x13); /* Row Offset Register */ *sp++ = inb(addr_6845+1); outb(addr_6845, 0x34); /* 6845 Compatibility */ *sp++ = inb(addr_6845+1); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ *sp++ = inb(TS_DATA); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Mode control */ outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); *sp++ = inb(ATC_DATAR); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Horizontal Pixel Panning */ outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); *sp++ = inb(ATC_DATAR); *sp++ = inb(GN_MISCOUTR); /* Misc output register */ } /* setup chipset for 132 column operation */ outb(addr_6845, 0x00); /* Horizontal Total */ outb(addr_6845+1, 0x9f); outb(addr_6845, 0x01); /* Horizontal Display End */ outb(addr_6845+1, 0x83); outb(addr_6845, 0x02); /* Horizontal Blank Start */ outb(addr_6845+1, 0x84); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ outb(addr_6845+1, 0x8b); outb(addr_6845, 0x05); /* Horizontal Retrace End */ outb(addr_6845+1, 0x80); outb(addr_6845, 0x13); /* Row Offset Register */ outb(addr_6845+1, 0x42); outb(addr_6845, 0x34); /* 6845 Compatibility */ outb(addr_6845+1, 0x0a); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ outb(TS_DATA, 0x01); /* 8 dot char clock */ if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); /* ATC Mode control */ outb(ATC_DATAW, 0x08); /* Line graphics disable */ if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); /* ATC Horizontal Pixel Panning */ outb(ATC_DATAW, 0x00); /* Misc output register */ outb(GN_MISCOUTW, (inb(GN_MISCOUTR) & ~0x0c)); } else /* switch 132 -> 80 */ { if(!regsaved) /* failsafe */ { /* disable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte); vga_screen_on(); return(0); } sp = savearea.et4000; outb(addr_6845, 0x00); /* Horizontal Total */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x01); /* Horizontal Display End */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x02); /* Horizontal Blank Start */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x04); /* Horizontal Retrace Start */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x05); /* Horizontal Retrace End */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x13); /* Row Offset Register */ outb(addr_6845+1, *sp++); outb(addr_6845, 0x34); /* 6845 Compatibility */ outb(addr_6845+1, *sp++); outb(TS_INDEX, TS_MODE);/* Timing Sequencer */ outb(TS_DATA, *sp++); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Mode control */ outb(ATC_INDEX, ATC_MODE | ATC_ACCESS); outb(ATC_DATAW, *sp++); if(color) inb(GN_INPSTAT1C); else inb(GN_INPSTAT1M); /* ATC Horizontal Pixel Panning */ outb(ATC_INDEX, ATC_HORPIXPAN | ATC_ACCESS); outb(ATC_DATAW, *sp++); outb(GN_MISCOUTW, *sp++); /* Misc output register */ } /* disable access to first 7 CRTC registers */ outb(addr_6845, CRTC_VSYNCE); outb(addr_6845+1, byte); vga_screen_on(); return(1);}/*---------------------------------------------------------------------------* * toggle 80/132 column operation for WD/Paradise based boards * * when this card does 132 cols, the char map select register (TS_INDEX, * TS_FONTSEL) function bits get REDEFINED. whoever did design this, * please don't cross my way ever ....... * *---------------------------------------------------------------------------*/intwd90c11_col(int cols){#if !PCVT_BACKUP_FONTS static unsigned char *sv_fontwd[NVGAFONTS];#endif /* !PCVT_BACKUP_FONTS */ u_char *sp; u_char byte; int i; vga_screen_off(); /* enable access to first 7 CRTC registers */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -