diff --git a/src/ints/int10_vesa.cpp b/src/ints/int10_vesa.cpp index 2d452f0f..644c45ae 100644 --- a/src/ints/int10_vesa.cpp +++ b/src/ints/int10_vesa.cpp @@ -31,6 +31,10 @@ static struct { Bitu setwindow; } callback; +static char string_oem[]="S3 Incorporated. Trio64"; +static char string_vendorname[]="DOSBox Development Team"; +static char string_productname[]="DOSBox - The DOS Emulator"; +static char string_productrev[]="DOSBox "VERSION; #ifdef _MSC_VER #pragma pack (1) @@ -80,7 +84,7 @@ Bit8u VESA_GetSVGAInformation(Bit16u seg,Bit16u off) { /* Fill 256 byte buffer with VESA information */ PhysPt buffer=PhysMake(seg,off); Bitu i; - bool vbe2=false; + bool vbe2=false;Bit16u vbe2_pos=256+off; if (mem_readd(buffer)==0x32454256) vbe2=true; if (vbe2) { for (i=0;i<0x200;i++) mem_writeb(buffer+i,0); @@ -88,9 +92,22 @@ Bit8u VESA_GetSVGAInformation(Bit16u seg,Bit16u off) { for (i=0;i<0x100;i++) mem_writeb(buffer+i,0); } /* Fill common data */ - MEM_BlockWrite(buffer,(void *)"VESA",4); //Identification - mem_writew(buffer+0x04,0x102); //Vesa version - mem_writed(buffer+0x06,int10.rom.oemstring); //Oemstring + MEM_BlockWrite(buffer,(void *)"VESA",4); //Identification + if (vbe2) { + mem_writew(buffer+0x04,0x200); //Vesa version 0x200 + mem_writed(buffer+0x06,RealMake(seg,vbe2_pos)); + for (i=0;itype) { case M_LIN8: //Linear 8-bit - WLE(minfo.ModeAttributes,0x1b); //No bios output support, although would be easy + WLE(minfo.ModeAttributes,0x9b); WLE(minfo.WinAAttributes,0x7); //Exists/readable/writable WLE(minfo.WinGranularity,64); WLE(minfo.WinSize,64); WLE(minfo.WinASegment,0xa000); - WLE(minfo.WinBSegment,0xa000); +// WLE(minfo.WinBSegment,0xa000); WLE(minfo.WinFuncPtr,CALLBACK_RealPointer(callback.setwindow)); WLE(minfo.BytesPerScanLine,mblock->swidth); WLE(minfo.NumberOfPlanes,0x1); @@ -134,6 +151,8 @@ foundit: WLE(minfo.YResolution,mblock->sheight); WLE(minfo.XCharSize,mblock->cwidth); WLE(minfo.YCharSize,mblock->cheight); + WLE(minfo.PhysBasePtr,S3_LFB_BASE); + MEM_BlockWrite(buf,&minfo,sizeof(MODE_INFO)); return 0x00; } @@ -150,7 +169,7 @@ Bit8u VESA_GetSVGAMode(Bit16u & mode) { } Bit8u VESA_SetCPUWindow(Bit8u window,Bit16u address) { -//TODO Check with univbe if it doesn't check for window param either + if (window) return 0x1; if ((address<32)) { IO_Write(0x3d4,0x6a); IO_Write(0x3d5,(Bit8u)address); @@ -159,7 +178,7 @@ Bit8u VESA_SetCPUWindow(Bit8u window,Bit16u address) { } Bit8u VESA_GetCPUWindow(Bit8u window,Bit16u & address) { -//TODO Check with univbe if it doesn't check for window param either + if (window) return 0x1; IO_Write(0x3d4,0x6a); address=IO_Read(0x3d5); return 0x0; @@ -230,12 +249,26 @@ Bit8u VESA_ScanLineLength(Bit8u subcall,Bit16u & bytes,Bit16u & pixels,Bit16u & return 0x0; } + +/* Based of the s3 univbe driver */ +static Bit8u PmodeInterface[]={ + 0x08,0x00,0x19,0x00,0x57,0x00,0x00,0x00,0x50,0x52,0x8b,0xc2,0x8a,0xe0,0xb0,0x6a, + 0x66,0xba,0xd4,0x03,0x66,0xef,0x5a,0x58,0xc3,0x52,0x66,0xba,0xda,0x03,0xec,0xa8, + 0x01,0x75,0xfb,0x5a,0x53,0x8a,0xf9,0xb3,0x0d,0xb1,0x0c,0x66,0x8b,0xf2,0x66,0xba, + 0xd4,0x03,0x66,0x8b,0xc3,0x66,0xef,0x66,0x8b,0xc1,0x66,0xef,0x66,0x8b,0xde,0x8a, + 0xe3,0xb0,0x69,0x66,0xef,0x5b,0x52,0xf6,0xc3,0x80,0x74,0x09,0x66,0xba,0xda,0x03, + 0xec,0xa8,0x08,0x74,0xfb,0x5a,0xc3,0xf6,0xc3,0x80,0x74,0x10,0x52,0x66,0xba,0xda, + 0x03,0xec,0xa8,0x08,0x75,0xfb,0xec,0xa8,0x08,0x74,0xfb,0x5a,0x1e,0x06,0x1f,0x0f, + 0xb7,0xc9,0x8b,0xc2,0x66,0xba,0xc8,0x03,0xee,0x42,0xfc,0x8a,0x47,0x02,0xee,0x8a, + 0x47,0x01,0xee,0x8a,0x07,0xee,0x83,0xc7,0x04,0x49,0x75,0xef,0x1f,0xc3 +}; + Bit8u VESA_SetDisplayStart(Bit16u x,Bit16u y) { //TODO Maybe do things differently with lowres double line modes? Bitu start; switch (CurMode->type) { case M_LIN8: - start=vga.config.scan_len*4*y+x; + start=vga.config.scan_len*8*y+x; vga.config.display_start=start/4; IO_Read(0x3da); IO_Write(0x3c0,0x13+32); @@ -248,8 +281,8 @@ Bit8u VESA_SetDisplayStart(Bit16u x,Bit16u y) { } Bit8u VESA_GetDisplayStart(Bit16u & x,Bit16u & y) { - Bitu times=vga.config.display_start/(vga.config.scan_len*4); - Bitu rem=vga.config.display_start % (vga.config.scan_len*4); + Bitu times=(vga.config.display_start*4)/(vga.config.scan_len*8); + Bitu rem=(vga.config.display_start*4) % (vga.config.scan_len*8); Bitu pan=vga.config.pel_panning; switch (CurMode->type) { case M_LIN8: @@ -265,11 +298,11 @@ Bit8u VESA_GetDisplayStart(Bit16u & x,Bit16u & y) { } -static char oemstring[]="S3 Incorporated. Trio64"; static Bitu SetWindowPositionHandler(void) { - if (reg_bh) VESA_GetCPUWindow(reg_bl,reg_dx); - else VESA_SetCPUWindow(reg_bl,reg_dx); + if (reg_bh) reg_ah=VESA_GetCPUWindow(reg_bl,reg_dx); + else reg_ah=VESA_SetCPUWindow(reg_bl,reg_dx); + reg_al=0x4f; return 0; } @@ -290,10 +323,17 @@ void INT10_SetupVESA(void) { phys_writew(PhysMake(0xc000,int10.rom.used),0xffff); int10.rom.used+=2; int10.rom.oemstring=RealMake(0xc000,int10.rom.used); - Bitu len=strlen(oemstring)+1; + Bitu len=strlen(string_oem)+1; for (i=0;i