Fixed BT485 BPP setting, fixes some Windows 3.1 drivers;

More fixes to BT485 RAM DAC accesses from the Vision964.
This commit is contained in:
OBattler
2018-10-02 00:06:30 +02:00
parent 83b6756b95
commit 68a5dbd653
2 changed files with 38 additions and 32 deletions

View File

@@ -9,7 +9,7 @@
* Brooktree BT485 true colour RAMDAC emulation.
*
*
* Version: @(#)vid_bt485_ramdac.c 1.0.5 2018/01/10
* Version: @(#)vid_bt485_ramdac.c 1.0.6 2018/10/02
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* TheCollector1995,
@@ -28,6 +28,32 @@
#include "vid_bt485_ramdac.h"
static void
bt485_set_bpp(bt485_ramdac_t *ramdac, svga_t *svga)
{
if (!(ramdac->cr2 & 0x20))
svga->bpp = 8;
else switch ((ramdac->cr1 >> 5) & 0x03) {
case 0:
svga->bpp = 32;
break;
case 1:
if (ramdac->cr1 & 0x08)
svga->bpp = 16;
else
svga->bpp = 15;
break;
case 2:
svga->bpp = 8;
break;
case 3:
svga->bpp = 4;
break;
}
svga_recalctimings(svga);
}
void
bt485_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, bt485_ramdac_t *ramdac, svga_t *svga)
{
@@ -85,38 +111,12 @@ bt485_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, bt485_ramdac_t *r
break;
case 0x08: /* Command Register 1 (RS value = 1000) */
ramdac->cr1 = val;
switch ((val >> 5) & 0x03) {
case 0:
if (val & 0x10)
svga->bpp = 32;
else
svga->bpp = 8;
break;
case 1:
if (val & 0x10) {
if (val & 0x08)
svga->bpp = 16;
else
svga->bpp = 15;
} else
svga->bpp = 8;
break;
case 2:
svga->bpp = 8;
break;
case 3:
svga->bpp = 4;
break;
}
svga_recalctimings(svga);
bt485_set_bpp(ramdac, svga);
break;
case 0x09: /* Command Register 2 (RS value = 1001) */
ramdac->cr2 = val;
svga->hwcursor.ena = !!(val & 0x03);
svga_recalctimings(svga);
bt485_set_bpp(ramdac, svga);
break;
case 0x0a:
switch (ramdac->set_reg0a) {

View File

@@ -8,7 +8,7 @@
*
* S3 emulation.
*
* Version: @(#)vid_s3.c 1.0.19 2018/10/01
* Version: @(#)vid_s3.c 1.0.20 2018/10/02
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -1042,11 +1042,17 @@ void s3_out(uint16_t addr, uint8_t val, void *p)
break;
case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9:
rs2 = (svga->crtc[0x55] & 0x01) || !!(svga->crtc[0x43] & 2);
if ((svga->crtc[0x55] & 0x03) == 0x00)
rs2 = !!(svga->crtc[0x43] & 2);
else
rs2 = (svga->crtc[0x55] & 0x01);
if (s3->chip == S3_TRIO32 || s3->chip == S3_TRIO64)
svga_out(addr, val, svga);
else if (s3->chip == S3_VISION964) {
rs3 = !!(svga->crtc[0x55] & 0x02);
if (!(svga->crtc[0x45] & 0x02))
rs3 = !!(svga->crtc[0x55] & 0x02);
else
rs3 = 0;
bt485_ramdac_out(addr, rs2, rs3, val, &s3->bt485_ramdac, svga);
} else
sdac_ramdac_out(addr, rs2, val, &s3->ramdac, svga);