Added the RTG3105 video card and fixed some wrong stuff in the RTG3106 as well.

This commit is contained in:
TC1995
2024-01-15 22:10:07 +01:00
parent 1d4a91ae7c
commit a74c1e907d
3 changed files with 77 additions and 55 deletions

View File

@@ -458,6 +458,7 @@ extern const device_t paradise_wd90c11_device;
extern const device_t paradise_wd90c30_device;
/* Realtek (S)VGA */
extern const device_t realtek_rtg3105_device;
extern const device_t realtek_rtg3106_device;
/* S3 9XX/8XX/Vision/Trio */

View File

@@ -29,7 +29,8 @@
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
#define BIOS_ROM_PATH "roms/video/rtg/realtekrtg3106.BIN"
#define RTG_3105_BIOS_ROM_PATH "roms/video/rtg/RTG3105I.VBI"
#define RTG_3106_BIOS_ROM_PATH "roms/video/rtg/realtekrtg3106.BIN"
typedef struct {
const char *name;
@@ -86,18 +87,18 @@ rtg_in(uint16_t addr, void *priv)
return svga->crtcreg;
case 0x3d5:
if (!(svga->crtc[0x1e] & 0x80) && (svga->crtcreg > 0x18))
return 0xff;
if (svga->crtcreg == 0x1a)
return dev->type << 6;
if (svga->crtcreg == 0x1e) {
ret = svga->crtc[0x1e];
ret &= ~3;
if (dev->vram_size == 1024)
ret = 2;
else if (dev->vram_size == 512)
ret = 1;
else
ret = 0;
return svga->crtc[0x1e] | ret;
return ret;
}
return svga->crtc[svga->crtcreg];
@@ -208,13 +209,10 @@ rtg_out(uint16_t addr, uint8_t val, void *priv)
static void
rtg_recalctimings(svga_t *svga)
{
svga->ma_latch = ((svga->crtc[0xc] << 8) | svga->crtc[0xd]) + ((svga->crtc[8] & 0x60) >> 5);
svga->ma_latch |= ((svga->crtc[0x19] & 0x10) << 16) | ((svga->crtc[0x19] & 0x40) << 17);
svga->interlace = (svga->crtc[0x19] & 1);
svga->lowres = svga->attrregs[0x10] & 0x40;
/*Clock table not available, currently a guesswork*/
switch (((svga->miscout >> 2) & 3) | ((svga->gdcreg[0x0c] & 0x20) >> 3)) {
case 0:
@@ -258,50 +256,41 @@ rtg_recalctimings(svga_t *svga)
break;
}
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
switch (svga->gdcreg[5] & 0x60) {
case 0x00:
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else {
svga->hdisp = svga->crtc[1] - ((svga->crtc[5] & 0x60) >> 5);
svga->hdisp++;
svga->hdisp *= 8;
if (!svga->scrblank && (svga->crtc[0x17] & 0x80) && svga->attr_palette_enable) {
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
switch (svga->gdcreg[5] & 0x60) {
case 0x00:
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else {
if (svga->hdisp == 1280)
svga->rowoffset >>= 1;
if (svga->hdisp == 1280)
svga->rowoffset >>= 1;
svga->render = svga_render_4bpp_highres;
}
break;
case 0x20: /*4 colours*/
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
else
svga->render = svga_render_2bpp_highres;
break;
case 0x40:
case 0x60:
svga->hdisp = svga->crtc[1] - ((svga->crtc[5] & 0x60) >> 5);
svga->hdisp++;
svga->hdisp *= (svga->seqregs[1] & 8) ? 16 : 8;
if (svga->crtc[0x19] & 2) {
if (svga->hdisp == 1280) {
svga->hdisp >>= 1;
} else
svga->rowoffset <<= 1;
svga->render = svga_render_8bpp_highres;
} else {
if (svga->lowres)
svga->render = svga_render_8bpp_lowres;
svga->render = svga_render_4bpp_highres;
}
break;
case 0x20: /*4 colours*/
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
else
svga->render = svga_render_8bpp_highres;
}
break;
svga->render = svga_render_2bpp_highres;
break;
case 0x40:
case 0x60:
if (svga->crtc[0x19] & 2) {
if (svga->hdisp == 1280)
svga->hdisp >>= 1;
else
svga->rowoffset <<= 1;
default:
break;
svga->render = svga_render_8bpp_highres;
} else
svga->render = svga_render_8bpp_lowres;
break;
default:
break;
}
}
}
}
@@ -316,13 +305,24 @@ rtg_init(const device_t *info)
memset(dev, 0x00, sizeof(rtg_t));
dev->name = info->name;
dev->type = info->local;
fn = BIOS_ROM_PATH;
fn = NULL;
switch (dev->type) {
case 2: /* ISA RTG3106 */
dev->vram_size = device_get_config_int("memory") << 10;
case 1: /* ISA RTG3105 */
fn = RTG_3105_BIOS_ROM_PATH;
dev->vram_size = device_get_config_int("memory");
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_rtg_isa);
svga_init(info, &dev->svga, dev, dev->vram_size,
svga_init(info, &dev->svga, dev, dev->vram_size << 10,
rtg_recalctimings, rtg_in, rtg_out,
NULL, NULL);
io_sethandler(0x03c0, 32,
rtg_in, NULL, NULL, rtg_out, NULL, NULL, dev);
break;
case 2: /* ISA RTG3106 */
fn = RTG_3106_BIOS_ROM_PATH;
dev->vram_size = device_get_config_int("memory");
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_rtg_isa);
svga_init(info, &dev->svga, dev, dev->vram_size << 10,
rtg_recalctimings, rtg_in, rtg_out,
NULL, NULL);
io_sethandler(0x03c0, 32,
@@ -371,9 +371,15 @@ rtg_force_redraw(void *priv)
}
static int
rtg_available(void)
rtg3105_available(void)
{
return rom_present(BIOS_ROM_PATH);
return rom_present(RTG_3105_BIOS_ROM_PATH);
}
static int
rtg3106_available(void)
{
return rom_present(RTG_3106_BIOS_ROM_PATH);
}
static const device_config_t rtg_config[] = {
@@ -407,6 +413,20 @@ static const device_config_t rtg_config[] = {
// clang-format on
};
const device_t realtek_rtg3105_device = {
.name = "Realtek RTG3105 (ISA)",
.internal_name = "rtg3105",
.flags = DEVICE_ISA | DEVICE_AT,
.local = 1,
.init = rtg_init,
.close = rtg_close,
.reset = NULL,
{ .available = rtg3105_available },
.speed_changed = rtg_speed_changed,
.force_redraw = rtg_force_redraw,
.config = rtg_config
};
const device_t realtek_rtg3106_device = {
.name = "Realtek RTG3106 (ISA)",
.internal_name = "rtg3106",
@@ -415,7 +435,7 @@ const device_t realtek_rtg3106_device = {
.init = rtg_init,
.close = rtg_close,
.reset = NULL,
{ .available = rtg_available },
{ .available = rtg3106_available },
.speed_changed = rtg_speed_changed,
.force_redraw = rtg_force_redraw,
.config = rtg_config

View File

@@ -133,6 +133,7 @@ video_cards[] = {
{ &pgc_device },
{ &cga_pravetz_device },
{ &radius_svga_multiview_isa_device },
{ &realtek_rtg3105_device },
{ &realtek_rtg3106_device },
{ &s3_diamond_stealth_vram_isa_device },
{ &s3_orchid_86c911_isa_device },