📄 init301.c
字号:
} } } } /* LCDA */}/* TW: Checked against 650/301LV and 630/301B (II) BIOS *//* TW: Pass 2: Checked with 650/301LVx (1.10.6s) and 630/301B (2.04.5a) */voidSiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex){ USHORT push1,push2; USHORT tempax,tempbx,tempcx,temp; USHORT resinfo,modeflag; if(ModeNo<=0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } /* TW: The following is only done if bridge is in slave mode: */ tempax = 0xFFFF; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr); /* TW: 630/301B does not check this flag, assumes it is set */ /* 650/LV and 650/301LVx BIOS do not check this either; so we set it... */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { modeflag |= Charx8Dot; } if(modeflag & Charx8Dot) tempcx = 0x08; else tempcx = 0x09; if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT; if(modeflag & HalfDCLK) tempax >>= 1; tempax = (tempax / tempcx) - 5; tempbx = tempax & 0xFF; temp = 0xFF; /* set MAX HT */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,temp); tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */ if(modeflag & HalfDCLK) tempax >>= 1; tempax = (tempax / tempcx) - 1; tempbx |= ((tempax & 0x00FF) << 8); temp = tempax & 0xFF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,temp); temp = (tempbx & 0xFF00) >> 8; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV){ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { temp += 2; }#ifdef oldHV if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { if(resinfo == 7) temp -= 2; }#endif } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */#ifdef oldHV if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { temp = (tempbx & 0x00FF) - 1; if(!(modeflag & HalfDCLK)) { temp -= 6; if(SiS_Pr->SiS_SetFlag & TVSimuMode) { temp -= 2; if(ModeNo > 0x13) temp -= 10; } } } else {#endif tempcx = tempbx & 0x00FF; tempbx = (tempbx & 0xFF00) >> 8; tempcx = (tempcx + tempbx) >> 1; temp = (tempcx & 0x00FF) + 2; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV){ temp--; if(!(modeflag & HalfDCLK)){ if((modeflag & Charx8Dot)){ temp += 4; if(SiS_Pr->SiS_VGAHDE >= 800) temp -= 6; /* TW: Inserted from 650/301 BIOS, 630/301B/301 don't do this */ if(HwDeviceExtension->jChipType >= SIS_315H) { if(SiS_Pr->SiS_VGAHDE == 800) temp += 2; } } } } else { if(!(modeflag & HalfDCLK)) { temp -= 4; if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { if(SiS_Pr->SiS_VGAHDE >= 800){ temp -= 7; if(HwDeviceExtension->jChipType < SIS_315H) { /* 650/301LV(x) does not do this, 630/301B does */ if(SiS_Pr->SiS_ModeType == ModeEGA){ if(SiS_Pr->SiS_VGAVDE == 1024){ temp += 15; if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) temp += 7; } } } if(SiS_Pr->SiS_VGAHDE >= 1280){ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) temp += 28; } } } } } }#ifdef oldHV }#endif SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,temp); /* 0x07 Horizontal Retrace Start */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00); /* 0x08 Horizontal Retrace End */ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { if(SiS_Pr->SiS_SetFlag & TVSimuMode) { if(ModeNo <= 1) { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2a); if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x61); } else { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x41); } } else if(SiS_Pr->SiS_ModeType == ModeText) { if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x54); } else { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x55); } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00); } else if(ModeNo <= 0x13) { if(modeflag & HalfDCLK) { if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); } else { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x02); } } else { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x5b); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); } } else if( ((HwDeviceExtension->jChipType >= SIS_315H) && (ModeNo == 0x50)) || ((HwDeviceExtension->jChipType < SIS_315H) && (resinfo == 0 || resinfo == 1)) ) { if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); } else { SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03); } } } } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x03); /* 0x18 SR08 */ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x19,0xF0); tempbx = SiS_Pr->SiS_VGAVT; push1 = tempbx; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ tempcx = 0x121; tempbx = SiS_Pr->SiS_VGAVDE; /* 0x0E Vertical Display End */ if(tempbx == 357) tempbx = 350; if(tempbx == 360) tempbx = 350; if(tempbx == 375) tempbx = 350; if(tempbx == 405) tempbx = 400; if(tempbx == 420) tempbx = 400; if(tempbx == 525) tempbx = 480; push2 = tempbx; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { if(tempbx == 350) tempbx += 5; if(tempbx == 480) tempbx += 5; } } } tempbx--; temp = tempbx & 0x00FF; tempbx--; temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* 0x10 vertical Blank Start */ tempbx = push2; tempbx--; temp = tempbx & 0x00FF;#if 0 /* TW: Missing code from 630/301B 2.04.5a and 650/301LVx 1.10.6s (calles int 2f) */ if(xxx()) { if(temp == 0xdf) temp = 0xda; }#endif SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp); if(tempbx & 0x0100) { tempcx |= 0x0002; if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x000a; } tempax = 0x000B; if(modeflag & DoubleScanMode) tempax |= 0x8000; if(tempbx & 0x0200) { tempcx |= 0x0040; if(SiS_Pr->SiS_VBType & VB_SIS301) tempax |= 0x2000; } if(SiS_Pr->SiS_VBType & VB_SIS301) { if(SiS_Pr->SiS_VBInfo & SetPALTV) { if(SiS_Pr->SiS_VGAVDE == 480) { tempax = (tempax & 0x00ff) | 0x2000; if(modeflag & DoubleScanMode) tempax |= 0x8000; } } } temp = (tempax & 0xFF00) >> 8; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); if(tempbx & 0x0400) tempcx |= 0x0600; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */ tempax = push1; tempax -= tempbx; tempax >>= 2; push1 = tempax; if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted from 650/301LVx 1.10.6s */ if(ModeNo > 0x13) { if(resinfo != 0x09) { tempax <<= 1; tempbx += tempax; } } else { if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) { tempax <<= 1; tempbx += tempax; } } } else if((resinfo != 0x09) || (SiS_Pr->SiS_VBType & VB_SIS301)) { tempax <<= 1; tempbx += tempax; }#ifdef oldHV if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { tempbx -= 10; } else {#endif if(SiS_Pr->SiS_SetFlag & TVSimuMode) { if(SiS_Pr->SiS_VBInfo & SetPALTV) { if(!(SiS_Pr->SiS_HiVision & 0x03)) { tempbx += 40; if(HwDeviceExtension->jChipType >= SIS_315H) { if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; } } } }#ifdef oldHV }#endif tempax = push1; tempax >>= 2; tempax++; tempax += tempbx; push1 = tempax; if(SiS_Pr->SiS_VBInfo & SetPALTV) { if(tempbx <= 513) { if(tempax >= 513) tempbx = 513; } } temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */ if(!(SiS_Pr->SiS_VBType & VB_SIS301)) { tempbx--; temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); if(tempbx & 0x0100) tempcx |= 0x0008; if(tempbx & 0x0200) { SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x0B,0x20); } tempbx++; } if(tempbx & 0x0100) tempcx |= 0x0004; if(tempbx & 0x0200) tempcx |= 0x0080; if(tempbx & 0x0400) { if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800; else tempcx |= 0x0C00; } tempbx = push1; temp = tempbx & 0x00FF; temp &= 0x0F; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* 0x0D vertical Retrace End */ if(tempbx & 0x0010) tempcx |= 0x2000; temp = tempcx & 0x00FF; if(SiS_Pr->SiS_VBType & VB_SIS301) { if(SiS_Pr->SiS_VBInfo & SetPALTV) { if(SiS_Pr->SiS_VGAVDE == 480) temp = 0xa3; } } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */ temp = (tempcx & 0xFF00) >> 8; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* 0x17 SR0A */ tempax = modeflag; temp = (tempax & 0xFF00) >> 8; temp = (temp >> 1) & 0x09; /* TW: Inserted from 630/301B and 650/301(LV/LVX) BIOS; not in 630/301 BIOS */ if(!(SiS_Pr->SiS_VBType & VB_SIS301)) { temp |= 0x01; } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted from 650/301LVx 1.10.6s */ if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { temp = 0x80; } } else temp = 0x80;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -