From 433055ea09157da08a4d860ac6a3672f2349eef3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 20 Mar 2018 13:52:06 +0100 Subject: [PATCH] A minor fix to the ATI Korean VGA by greatpsycho; Added the Cirrus Logic CL-GD 5446 (two variants) and CL-GD 5480. --- src/video/vid_ati28800.c | 24 +++++----- src/video/vid_cl54xx.c | 95 ++++++++++++++++++++++++++++++++++++---- src/video/vid_cl54xx.h | 5 ++- src/video/vid_table.c | 9 ++-- src/video/video.h | 11 +++-- 5 files changed, 115 insertions(+), 29 deletions(-) diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index 17c6f7b71..a85acab9f 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -8,7 +8,7 @@ * * ATI 28800 emulation (VGA Charger and Korean VGA) * - * Version: @(#)vid_ati28800.c 1.0.14 2018/03/19 + * Version: @(#)vid_ati28800.c 1.0.15 2018/03/20 * * Authors: Sarah Walker, * Miran Grca, @@ -553,17 +553,6 @@ ati28800_force_redraw(void *priv) ati->svga.fullchange = changeframecount; } -void ati28800k_add_status_info(char *s, int max_len, void *p) -{ - ati28800_t *ati28800 = (ati28800_t *)p; - char temps[128]; - - svga_add_status_info(s, max_len, &ati28800->svga); - - sprintf(temps, "Korean SVGA mode enabled : %s\n\n", ati28800->ksc5601_mode_enabled ? "Yes" : "No"); - strncat(s, temps, max_len); -} - static void ati28800_add_status_info(char *s, int max_len, void *priv) { ati28800_t *ati = (ati28800_t *)priv; @@ -571,6 +560,17 @@ static void ati28800_add_status_info(char *s, int max_len, void *priv) svga_add_status_info(s, max_len, &ati->svga); } +void ati28800k_add_status_info(char *s, int max_len, void *p) +{ + ati28800_t *ati28800 = (ati28800_t *)p; + char temps[128]; + + ati28800_add_status_info(s, max_len, p); + + sprintf(temps, "Korean SVGA mode enabled : %s\n\n", ati28800->ksc5601_mode_enabled ? "Yes" : "No"); + strncat(s, temps, max_len); +} + static const device_config_t ati28800_config[] = { diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index de04c6fb2..168f1586b 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -9,7 +9,7 @@ * Emulation of select Cirrus Logic cards (CL-GD 5428, * CL-GD 5429, CL-GD 5430, CL-GD 5434 and CL-GD 5436 are supported). * - * Version: @(#)vid_cl_54xx.c 1.0.10 2018/03/18 + * Version: @(#)vid_cl_54xx.c 1.0.11 2018/03/20 * * Authors: Sarah Walker, * Barry Rodewald, @@ -39,7 +39,6 @@ #include "vid_svga_render.h" #include "vid_cl54xx.h" -#define BIOS_GD5424_PATH L"roms/video/cirruslogic/cl5424.bin" #define BIOS_GD5426_PATH L"roms/video/cirruslogic/Diamond SpeedStar PRO VLB v3.04.bin" #define BIOS_GD5428_PATH L"roms/video/cirruslogic/vlbusjapan.BIN" #define BIOS_GD5429_PATH L"roms/video/cirruslogic/5429.vbi" @@ -47,14 +46,18 @@ #define BIOS_GD5430_PCI_PATH L"roms/video/cirruslogic/pci.bin" #define BIOS_GD5434_PATH L"roms/video/cirruslogic/gd5434.bin" #define BIOS_GD5436_PATH L"roms/video/cirruslogic/5436.vbi" +#define BIOS_GD5446_PATH L"roms/video/cirruslogic/5446BV.VBI" +#define BIOS_GD5446_STB_PATH L"roms/video/cirruslogic/stb nitro64v.BIN" +#define BIOS_GD5480_PATH L"roms/video/cirruslogic/clgd5480.rom" -#define CIRRUS_ID_CLGD5424 0x94 #define CIRRUS_ID_CLGD5426 0x90 #define CIRRUS_ID_CLGD5428 0x98 #define CIRRUS_ID_CLGD5429 0x9c #define CIRRUS_ID_CLGD5430 0xa0 #define CIRRUS_ID_CLGD5434 0xa8 #define CIRRUS_ID_CLGD5436 0xac +#define CIRRUS_ID_CLGD5446 0xb8 +#define CIRRUS_ID_CLGD5480 0xbc /* sequencer 0x07 */ #define CIRRUS_SR7_BPP_VGA 0x00 @@ -588,13 +591,13 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx) } } else if (gd54xx->pci) { base = gd54xx->lfb_base; - if (svga->crtc[0x27] == CIRRUS_ID_CLGD5436) + if (svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) size = 16 * 1024 * 1024; else size = 4 * 1024 * 1024; } else { /*VLB*/ base = 128*1024*1024; - if (svga->crtc[0x27] == CIRRUS_ID_CLGD5436) + if (svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) size = 16 * 1024 * 1024; else size = 4 * 1024 * 1024; @@ -1690,7 +1693,7 @@ gd543x_mmio_write(uint32_t addr, uint8_t val, void *p) else gd54xx->blt.dst_addr &= 0x1fffff; - if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5436) && (gd54xx->blt.status & CIRRUS_BLT_AUTOSTART)) { + if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) && (gd54xx->blt.status & CIRRUS_BLT_AUTOSTART)) { if (gd54xx->blt.mode == CIRRUS_BLTMODE_MEMSYSSRC) { gd54xx->blt.sys_tx = 1; gd54xx->blt.sys_cnt = 0; @@ -1729,7 +1732,7 @@ gd543x_mmio_write(uint32_t addr, uint8_t val, void *p) break; case 0x1b: - if (svga->crtc[0x27] == CIRRUS_ID_CLGD5436) + if (svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) gd54xx->blt.modeext = val; break; @@ -2294,7 +2297,7 @@ static void { gd54xx_t *gd54xx = malloc(sizeof(gd54xx_t)); svga_t *svga = &gd54xx->svga; - int id = info->local; + int id = info->local & 0xff; wchar_t *romfn = NULL; memset(gd54xx, 0, sizeof(gd54xx_t)); @@ -2328,7 +2331,18 @@ static void case CIRRUS_ID_CLGD5436: romfn = BIOS_GD5436_PATH; break; - } + + case CIRRUS_ID_CLGD5446: + if (info->local & 0x100) + romfn = BIOS_GD5446_STB_PATH; + else + romfn = BIOS_GD5446_PATH; + break; + + case CIRRUS_ID_CLGD5480: + romfn = BIOS_GD5480_PATH; + break; + } gd54xx->vram_size = device_get_config_int("memory"); gd54xx->vram_mask = (gd54xx->vram_size << 20) - 1; @@ -2413,6 +2427,24 @@ gd5436_available(void) return rom_present(BIOS_GD5436_PATH); } +static int +gd5446_available(void) +{ + return rom_present(BIOS_GD5446_PATH); +} + +static int +gd5446_stb_available(void) +{ + return rom_present(BIOS_GD5446_STB_PATH); +} + +static int +gd5480_available(void) +{ + return rom_present(BIOS_GD5480_PATH); +} + void gd54xx_close(void *p) { @@ -2669,3 +2701,48 @@ const device_t gd5436_pci_device = gd54xx_add_status_info, gd5434_config }; + +const device_t gd5446_pci_device = +{ + "Cirrus Logic CL-GD 5446 (PCI)", + DEVICE_PCI, + CIRRUS_ID_CLGD5446, + gd54xx_init, + gd54xx_close, + NULL, + gd5446_available, + gd54xx_speed_changed, + gd54xx_force_redraw, + gd54xx_add_status_info, + gd5434_config +}; + +const device_t gd5446_stb_pci_device = +{ + "STB Nitro 64V (PCI)", + DEVICE_PCI, + CIRRUS_ID_CLGD5446, + gd54xx_init, + gd54xx_close, + NULL, + gd5446_stb_available, + gd54xx_speed_changed, + gd54xx_force_redraw, + gd54xx_add_status_info, + gd5434_config +}; + +const device_t gd5480_pci_device = +{ + "Cirrus Logic CL-GD 5480 (PCI)", + DEVICE_PCI, + CIRRUS_ID_CLGD5480, + gd54xx_init, + gd54xx_close, + NULL, + gd5480_available, + gd54xx_speed_changed, + gd54xx_force_redraw, + gd54xx_add_status_info, + gd5434_config +}; diff --git a/src/video/vid_cl54xx.h b/src/video/vid_cl54xx.h index af7707f0a..91bfa44aa 100644 --- a/src/video/vid_cl54xx.h +++ b/src/video/vid_cl54xx.h @@ -11,4 +11,7 @@ extern const device_t gd5430_pci_device; extern const device_t gd5434_isa_device; extern const device_t gd5434_vlb_device; extern const device_t gd5434_pci_device; -extern const device_t gd5436_pci_device; \ No newline at end of file +extern const device_t gd5436_pci_device; +extern const device_t gd5446_pci_device; +extern const device_t gd5446_stb_pci_device; +extern const device_t gd5480_pci_device; \ No newline at end of file diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 365619145..fcb8ff503 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -8,7 +8,7 @@ * * Define all known video cards. * - * Version: @(#)vid_table.c 1.0.25 2018/03/19 + * Version: @(#)vid_table.c 1.0.26 2018/03/20 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -131,6 +131,8 @@ video_cards[] = { {"[PCI] Cirrus Logic CL-GD 5430", "cl_gd5430_pci", &gd5430_pci_device, GFX_CL_GD5430_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, {"[PCI] Cirrus Logic CL-GD 5434", "cl_gd5434_pci", &gd5434_pci_device, GFX_CL_GD5434_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, {"[PCI] Cirrus Logic CL-GD 5436", "cl_gd5436_pci", &gd5436_pci_device, GFX_CL_GD5436_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, + {"[PCI] Cirrus Logic CL-GD 5446", "cl_gd5446_pci", &gd5446_pci_device, GFX_CL_GD5446_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, + {"[PCI] Cirrus Logic CL-GD 5480", "cl_gd5480_pci", &gd5480_pci_device, GFX_CL_GD5480_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, #if defined(DEV_BRANCH) && defined(USE_STEALTH32) {"[PCI] Diamond Stealth 32 (Tseng ET4000/w32p)", "stealth32_pci", &et4000w32p_pci_device, GFX_ET4000W32_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}}, #endif @@ -149,6 +151,7 @@ video_cards[] = { {"[PCI] Phoenix S3 Trio64", "px_trio64_pci", &s3_phoenix_trio64_pci_device, GFX_PHOENIX_TRIO64_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 3, 2, 4, 25, 25, 40}}, {"[PCI] S3 ViRGE/DX", "virge375_pci", &s3_virge_375_pci_device, GFX_VIRGEDX_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 3, 28, 28, 45}}, {"[PCI] S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20_pci", &s3_virge_375_4_pci_device, GFX_VIRGEDX4_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 3, 28, 28, 45}}, + {"[PCI] STB Nitro 64V (CL-GD 5446)", "cl_gd5446_stb_pci", &gd5446_stb_pci_device, GFX_CL_GD5446_STB_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, {"[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device, GFX_TGUI9440_PCI, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 8, 16, 4, 8, 16}}, {"[VLB] ATI Graphics Pro Turbo (Mach64 GX)", "mach64gx_vlb", &mach64gx_vlb_device, GFX_MACH64GX_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 1, 20, 20, 21}}, {"[VLB] Cardex Tseng ET4000/w32p", "et4000w32p_vlb", &et4000w32p_cardex_vlb_device, GFX_ET4000W32_CARDEX_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}}, @@ -158,8 +161,8 @@ video_cards[] = { #if defined(DEV_BRANCH) && defined(USE_STEALTH32) {"[VLB] Diamond Stealth 32 (Tseng ET4000/w32p)", "stealth32_vlb", &et4000w32p_vlb_device, GFX_ET4000W32_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 4, 10, 10, 10}}, #endif - {"[VLB] Diamond SpeedStar PRO (CL-GD5426)", "cl_gd5426_vlb", &gd5426_vlb_device, GFX_CL_GD5426_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, - {"[VLB] Diamond SpeedStar PRO SE (CL-GD5430)", "cl_gd5430_vlb", &gd5430_vlb_device, GFX_CL_GD5430_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, + {"[VLB] Diamond SpeedStar PRO (CL-GD 5426)", "cl_gd5426_vlb", &gd5426_vlb_device, GFX_CL_GD5426_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, + {"[VLB] Diamond SpeedStar PRO SE (CL-GD 5430)", "cl_gd5430_vlb", &gd5430_vlb_device, GFX_CL_GD5430_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 4, 4, 8, 10, 10, 20}}, {"[VLB] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_vlb", &s3_virge_vlb_device, GFX_VIRGE_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 3, 28, 28, 45}}, {"[VLB] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_vlb", &s3_virge_988_vlb_device, GFX_VIRGEVX_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}}, {"[VLB] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_vlb", &s3_diamond_stealth64_vlb_device, GFX_STEALTH64_VLB, VIDEO_FLAG_TYPE_SPECIAL, {VIDEO_BUS, 2, 2, 4, 26, 26, 42}}, diff --git a/src/video/video.h b/src/video/video.h index 4bb7e8dc4..99b54a66f 100644 --- a/src/video/video.h +++ b/src/video/video.h @@ -8,7 +8,7 @@ * * Definitions for the video controller module. * - * Version: @(#)video.h 1.0.24 2018/03/19 + * Version: @(#)video.h 1.0.25 2018/03/20 * * Authors: Sarah Walker, * Miran Grca, @@ -84,9 +84,12 @@ enum { GFX_CL_GD5430_VLB, /* Diamond SpeedStar PRO SE (Cirrus Logic CL-GD 5430) VLB */ GFX_CL_GD5430_PCI, /* Cirrus Logic CL-GD 5430 PCI */ GFX_CL_GD5434_ISA, /* Cirrus Logic CL-GD 5434 ISA */ - GFX_CL_GD5434_VLB, /* Cirrus Logic CL-GD 5434 VLB */ - GFX_CL_GD5434_PCI, /* Cirrus Logic CL-GD 5434 PCI */ - GFX_CL_GD5436_PCI, /* Cirrus Logic CL-GD 5436 PCI */ + GFX_CL_GD5434_VLB, /* Cirrus Logic CL-GD 5434 VLB */ + GFX_CL_GD5434_PCI, /* Cirrus Logic CL-GD 5434 PCI */ + GFX_CL_GD5436_PCI, /* Cirrus Logic CL-GD 5436 PCI */ + GFX_CL_GD5446_PCI, /* Cirrus Logic CL-GD 5446 PCI */ + GFX_CL_GD5446_STB_PCI, /* STB Nitro 64V (Cirrus Logic CL-GD 5446) PCI */ + GFX_CL_GD5480_PCI, /* Cirrus Logic CL-GD 5480 PCI */ #if defined(DEV_BRANCH) && defined(USE_RIVA) GFX_RIVATNT, /* nVidia Riva TNT */ GFX_RIVATNT2, /* nVidia Riva TNT2 */