Merge pull request #1018 from 86Box/tc1995

Built-in video card device fixes from selected machines, such as Tand…
This commit is contained in:
Miran Grča
2020-10-06 18:07:47 +02:00
committed by GitHub
8 changed files with 152 additions and 34 deletions

View File

@@ -387,6 +387,7 @@ extern int machine_at_ficva502_init(const machine_t *);
extern int machine_at_ficpa2012_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t *at_thor_get_device(void);
extern const device_t *at_pb640_get_device(void);
#endif
@@ -458,6 +459,9 @@ extern const device_t europc_device;
/* m_oivetti_m24.c */
extern int machine_olim24_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t *m24_get_device(void);
#endif
/* m_pcjr.c */
extern int machine_pcjr_init(const machine_t *);
@@ -502,6 +506,7 @@ extern int machine_tandy1000sl2_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t *tandy1k_get_device(void);
extern const device_t *tandy1k_hx_get_device(void);
extern const device_t *tandy1k_sl_get_device(void);
#endif
/* m_xt.c */
@@ -527,7 +532,8 @@ extern int machine_xt_hed919_init(const machine_t *);
#endif
/* m_xt_compaq.c */
extern int machine_xt_compaq_init(const machine_t *);
extern int machine_xt_compaq_deskpro_init(const machine_t *);
extern int machine_xt_compaq_portable_init(const machine_t *);
/* m_xt_laserxt.c */
#if defined(DEV_BRANCH) && defined(USE_LASERXT)

View File

@@ -349,6 +349,7 @@ extern const device_t ibm_ps1_2121_device;
/* Trident TVGA 8900 */
extern const device_t tvga8900b_device;
extern const device_t tvga8900d_device;
extern const device_t tvga9000b_device;
/* IBM VGA */
extern const device_t vga_device;

View File

@@ -818,6 +818,12 @@ const device_t m24_device = {
NULL
};
const device_t *
m24_get_device(void)
{
return &m24_device;
}
static void
kbd_reset(void *priv)

View File

@@ -1192,6 +1192,12 @@ tandy1k_hx_get_device(void)
return &vid_device_hx;
}
const device_t *
tandy1k_sl_get_device(void)
{
return &vid_device_sl;
}
static void
eep_write(uint16_t addr, uint8_t val, void *priv)

View File

@@ -37,9 +37,37 @@
#include <86box/lpt.h>
#include <86box/machine.h>
int
machine_xt_compaq_deskpro_init(const machine_t *model)
{
int ret;
ret = bios_load_linear(L"roms/machines/deskpro/Compaq - BIOS - Revision J - 106265-002.bin",
0x000fe000, 8192, 0);
if (bios_only || !ret)
return ret;
machine_common_init(model);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_compaq_device);
if (fdc_type == FDC_INTERNAL)
device_add(&fdc_xt_device);
nmi_init();
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
lpt1_remove();
lpt1_init(0x03bc);
return ret;
}
int
machine_xt_compaq_init(const machine_t *model)
machine_xt_compaq_portable_init(const machine_t *model)
{
int ret;

View File

@@ -97,7 +97,7 @@ const machine_t machines[] = {
{ "[8088] AMI XT clone", "amixt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 640, 64, 0, machine_xt_amixt_init, NULL },
{ "[8088] Tandy 1000", "tandy", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_tandy_init, tandy1k_get_device },
{ "[8088] Tandy 1000 HX", "tandy1000hx", MACHINE_TYPE_8088, {{"Intel", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 256, 640, 128, 0, machine_tandy1000hx_init, tandy1k_hx_get_device },
{ "[8088] Compaq Portable", "portable", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO, 128, 640, 128, 0, machine_xt_compaq_init, NULL },
{ "[8088] Compaq Portable", "portable", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 128, 640, 128, 0, machine_xt_compaq_portable_init, NULL },
{ "[8088] Generic XT clone", "genxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 640, 64, 0, machine_genxt_init, NULL },
{ "[8088] DTK XT clone", "dtk", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 640, 64, 0, machine_xt_dtk_init, NULL },
{ "[8088] Juko XT clone", "jukopc", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 640, 64, 0, machine_xt_jukopc_init, NULL },
@@ -118,9 +118,10 @@ const machine_t machines[] = {
{ "[8086] Amstrad PC3086", "pc3086", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 0, 63, machine_pc3086_init, pc3086_get_device },
{ "[8086] Amstrad PC20(0)", "pc200", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE | MACHINE_NONMI, 512, 640, 128, 63, machine_pc200_init, pc200_get_device },
{ "[8086] Amstrad PPC512/640", "ppc512", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE | MACHINE_NONMI, 512, 640, 128, 63, machine_ppc512_init, ppc512_get_device },
{ "[8086] Olivetti M24", "olivetti_m24", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 128, 640, 128, 0, machine_olim24_init, NULL },
{ "[8086] Compaq Deskpro", "deskpro", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 128, 640, 128, 0, machine_xt_compaq_deskpro_init, NULL },
{ "[8086] Olivetti M24", "olivetti_m24", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 128, 640, 128, 0, machine_olim24_init, m24_get_device },
{ "[8086] Schetmash Iskra-3104", "iskra3104", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 128, 640, 128, 0, machine_xt_iskra3104_init, NULL },
{ "[8086] Tandy 1000 SL/2", "tandy1000sl2", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 512, 768, 128, 0, machine_tandy1000sl2_init, NULL },
{ "[8086] Tandy 1000 SL/2", "tandy1000sl2", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 512, 768, 128, 0, machine_tandy1000sl2_init, tandy1k_sl_get_device },
{ "[8086] Toshiba T1200", "t1200", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO, 1024, 2048,1024, 63, machine_xt_t1200_init, t1200_get_device },
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
{ "[8086] VTech Laser XT3", "lxt3", MACHINE_TYPE_8086, {{"Intel", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 256, 640, 256, 0, machine_xt_lxt3_init, NULL },
@@ -285,7 +286,7 @@ const machine_t machines[] = {
{ "[i430FX] ASUS P/I-P54TP4XE", "p54tp4xe", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p54tp4xe_init, NULL },
{ "[i430FX] ASUS P/I-P54TP4XE (MR BIOS)", "mr586", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC | MACHINE_PS2, 8, 128, 8, 127, machine_at_mr586_init, NULL },
{ "[i430FX] Gateway 2000 P5-xxx", "gw2katx", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_gw2katx_init, NULL },
{ "[i430FX] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{ "[i430FX] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_thor_init, at_thor_get_device },
{ "[i430FX] Intel Advanced/ATX (MR BIOS)", "mrthor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_mrthor_init, NULL },
{ "[i430FX] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_endeavor_init, at_endeavor_get_device },
{ "[i430FX] Packard Bell PB640", "pb640", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_pb640_init, at_pb640_get_device },

View File

@@ -106,6 +106,7 @@ video_cards[] = {
{ "[ISA] SPEA V7 Mirage (S3 86c801)", "px_s3_v7_801_isa", &s3_v7mirage_86c801_isa_device },
{ "[ISA] Trident TVGA8900B", "tvga8900b", &tvga8900b_device },
{ "[ISA] Trident TVGA8900D", "tvga8900d", &tvga8900d_device },
{ "[ISA] Trident TVGA9000B", "tvga9000b", &tvga9000b_device },
{ "[ISA] Trigem Korean VGA (ET4000AX)", "tgkorvga", &et4000k_isa_device },
{ "[ISA] Tseng ET4000AX", "et4000ax", &et4000_isa_device },
{ "[ISA] VGA", "vga", &vga_device },

View File

@@ -32,10 +32,12 @@
#include <86box/vid_svga_render.h>
#define TVGA8900B_ID 0x03
#define TVGA9000B_ID 0x23
#define TVGA8900CLD_ID 0x33
#define ROM_TVGA_8900B L"roms/video/tvga/tvga8900B.VBI"
#define ROM_TVGA_8900CLD L"roms/video/tvga/trident.bin"
#define ROM_TVGA_9000B L"roms/video/tvga/tvga9000b/BIOS.BIN"
typedef struct tvga_t
{
@@ -56,7 +58,8 @@ typedef struct tvga_t
uint32_t vram_mask;
} tvga_t;
video_timings_t timing_tvga = {VIDEO_ISA, 3, 3, 6, 8, 8, 12};
video_timings_t timing_tvga8900 = {VIDEO_ISA, 3, 3, 6, 8, 8, 12};
video_timings_t timing_tvga9000 = {VIDEO_ISA, 7, 7, 12, 7, 7, 12};
static uint8_t crtc_mask[0x40] =
{
@@ -115,8 +118,11 @@ void tvga_out(uint16_t addr, uint8_t val, void *p)
break;
case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9:
tkd8001_ramdac_out(addr, val, svga->ramdac, svga);
return;
if (tvga->card_id != TVGA9000B_ID) {
tkd8001_ramdac_out(addr, val, svga->ramdac, svga);
return;
}
break;
case 0x3CF:
switch (svga->gdcaddr & 15)
@@ -143,35 +149,39 @@ void tvga_out(uint16_t addr, uint8_t val, void *p)
old = svga->crtc[svga->crtcreg];
val &= crtc_mask[svga->crtcreg];
svga->crtc[svga->crtcreg] = val;
if (old != val)
{
if (svga->crtcreg < 0xE || svga->crtcreg > 0x10)
{
if (old != val) {
if (svga->crtcreg < 0xE || svga->crtcreg > 0x10) {
svga->fullchange = changeframecount;
svga_recalctimings(svga);
}
}
switch (svga->crtcreg)
{
switch (svga->crtcreg) {
case 0x1e:
svga->vram_display_mask = (val & 0x80) ? tvga->vram_mask : 0x3ffff;
break;
}
return;
case 0x3D8:
if (svga->gdcreg[0xf] & 4)
{
if (svga->gdcreg[0xf] & 4) {
tvga->tvga_3d8 = val;
tvga_recalcbanking(tvga);
}
return;
case 0x3D9:
if (svga->gdcreg[0xf] & 4)
{
if (svga->gdcreg[0xf] & 4) {
tvga->tvga_3d9 = val;
tvga_recalcbanking(tvga);
}
return;
case 0x3DB:
if (tvga->card_id != TVGA9000B_ID) {
/*3db appears to be a 4 bit clock select register on 8900D*/
svga->miscout = (svga->miscout & ~0x0c) | ((val & 3) << 2);
tvga->newctrl2 = (tvga->newctrl2 & ~0x01) | ((val & 4) >> 2);
tvga->oldctrl1 = (tvga->oldctrl1 & ~0x10) | ((val & 8) << 1);
svga_recalctimings(svga);
}
break;
}
svga_out(addr, val, svga);
}
@@ -203,7 +213,10 @@ uint8_t tvga_in(uint16_t addr, void *p)
}
break;
case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9:
return tkd8001_ramdac_in(addr, svga->ramdac, svga);
if (tvga->card_id != TVGA9000B_ID) {
return tkd8001_ramdac_in(addr, svga->ramdac, svga);
}
break;
case 0x3D4:
return svga->crtcreg;
case 0x3D5:
@@ -233,6 +246,9 @@ static void tvga_recalcbanking(tvga_t *tvga)
void tvga_recalctimings(svga_t *svga)
{
tvga_t *tvga = (tvga_t *)svga->p;
int clksel;
int high_res_256 = 0;
if (!svga->rowoffset) svga->rowoffset = 0x100; /*This is the only sensible way I can see this being handled,
given that TVGA8900D has no overflow bits.
Some sort of overflow is required for 320x200x24 and 1024x768x16*/
@@ -264,18 +280,43 @@ void tvga_recalctimings(svga_t *svga)
if (svga->interlace)
svga->rowoffset >>= 1;
switch (((svga->miscout >> 2) & 3) | ((tvga->newctrl2 << 2) & 4))
{
case 2: svga->clock = (cpuclock * (double)(1ull << 32))/44900000.0; break;
case 3: svga->clock = (cpuclock * (double)(1ull << 32))/36000000.0; break;
case 4: svga->clock = (cpuclock * (double)(1ull << 32))/57272000.0; break;
case 5: svga->clock = (cpuclock * (double)(1ull << 32))/65000000.0; break;
case 6: svga->clock = (cpuclock * (double)(1ull << 32))/50350000.0; break;
case 7: svga->clock = (cpuclock * (double)(1ull << 32))/40000000.0; break;
if (tvga->card_id == TVGA8900CLD_ID)
clksel = ((svga->miscout >> 2) & 3) | ((tvga->newctrl2 & 0x01) << 2) | ((tvga->oldctrl1 & 0x10) >> 1);
else
clksel = ((svga->miscout >> 2) & 3) | ((tvga->newctrl2 & 0x01) << 2) | ((tvga->newctrl2 & 0x40) >> 3);
switch (clksel) {
case 0x2: svga->clock = (cpuclock * (double)(1ull << 32)) / 44900000.0; break;
case 0x3: svga->clock = (cpuclock * (double)(1ull << 32)) / 36000000.0; break;
case 0x4: svga->clock = (cpuclock * (double)(1ull << 32)) / 57272000.0; break;
case 0x5: svga->clock = (cpuclock * (double)(1ull << 32)) / 65000000.0; break;
case 0x6: svga->clock = (cpuclock * (double)(1ull << 32)) / 50350000.0; break;
case 0x7: svga->clock = (cpuclock * (double)(1ull << 32)) / 40000000.0; break;
case 0x8: svga->clock = (cpuclock * (double)(1ull << 32)) / 88000000.0; break;
case 0x9: svga->clock = (cpuclock * (double)(1ull << 32)) / 98000000.0; break;
case 0xa: svga->clock = (cpuclock * (double)(1ull << 32)) / 118800000.0; break;
case 0xb: svga->clock = (cpuclock * (double)(1ull << 32)) / 108000000.0; break;
case 0xc: svga->clock = (cpuclock * (double)(1ull << 32)) / 72000000.0; break;
case 0xd: svga->clock = (cpuclock * (double)(1ull << 32)) / 77000000.0; break;
case 0xe: svga->clock = (cpuclock * (double)(1ull << 32)) / 80000000.0; break;
case 0xf: svga->clock = (cpuclock * (double)(1ull << 32)) / 75000000.0; break;
}
if (tvga->oldctrl2 & 0x10)
if (tvga->card_id != TVGA8900CLD_ID) {
/*TVGA9000 doesn't seem to have support for a 'high res' 256 colour mode
(without the VGA pixel doubling). Instead it implements these modes by
doubling the horizontal pixel count and pixel clock. Hence we use a
basic heuristic to detect this*/
if (svga->interlace)
high_res_256 = (svga->htotal * 8) > (svga->vtotal * 4);
else
high_res_256 = (svga->htotal * 8) > (svga->vtotal * 2);
}
if ((tvga->oldctrl2 & 0x10) || high_res_256)
{
if (high_res_256)
svga->hdisp /= 2;
switch (svga->bpp)
{
case 8:
@@ -304,11 +345,16 @@ static void *tvga_init(const device_t *info)
const wchar_t *bios_fn;
tvga_t *tvga = malloc(sizeof(tvga_t));
memset(tvga, 0, sizeof(tvga_t));
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_tvga);
tvga->vram_size = device_get_config_int("memory") << 10;
tvga->vram_mask = tvga->vram_size - 1;
if (info->local == TVGA9000B_ID) {
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_tvga9000);
tvga->vram_size = 512 << 10;
} else {
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_tvga8900);
tvga->vram_size = device_get_config_int("memory") << 10;
}
tvga->vram_mask = tvga->vram_size - 1;
tvga->card_id = info->local;
@@ -320,6 +366,9 @@ static void *tvga_init(const device_t *info)
case TVGA8900CLD_ID:
bios_fn = ROM_TVGA_8900CLD;
break;
case TVGA9000B_ID:
bios_fn = ROM_TVGA_9000B;
break;
default:
free(tvga);
return NULL;
@@ -333,7 +382,8 @@ static void *tvga_init(const device_t *info)
NULL,
NULL);
tvga->svga.ramdac = device_add(&tkd8001_ramdac_device);
if (info->local != TVGA9000B_ID)
tvga->svga.ramdac = device_add(&tkd8001_ramdac_device);
io_sethandler(0x03c0, 0x0020, tvga_in, NULL, NULL, tvga_out, NULL, NULL, tvga);
@@ -350,6 +400,11 @@ static int tvga8900d_available(void)
return rom_present(ROM_TVGA_8900CLD);
}
static int tvga9000b_available(void)
{
return rom_present(ROM_TVGA_9000B);
}
void tvga_close(void *p)
{
tvga_t *tvga = (tvga_t *)p;
@@ -425,3 +480,17 @@ const device_t tvga8900d_device =
tvga_force_redraw,
tvga_config
};
const device_t tvga9000b_device =
{
"Trident TVGA 9000B",
DEVICE_ISA,
TVGA9000B_ID,
tvga_init,
tvga_close,
NULL,
tvga9000b_available,
tvga_speed_changed,
tvga_force_redraw,
NULL
};