From e11743c5216226ffa5319612d67fbc95db99684c Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 24 Nov 2024 20:10:29 -0500 Subject: [PATCH] Add AWE64 CT4380 no IDE variant --- src/include/86box/sound.h | 1 + src/sound/snd_sb.c | 88 +++++++++++++++++++++++++++------------ src/sound/sound.c | 1 + 3 files changed, 63 insertions(+), 27 deletions(-) diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index 2a41b98f8..e83006130 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -157,6 +157,7 @@ extern const device_t sb_awe32_device; extern const device_t sb_awe32_pnp_device; extern const device_t sb_awe64_value_device; extern const device_t sb_awe64_device; +extern const device_t sb_awe64_ide_device; extern const device_t sb_awe64_gold_device; /* Crystal CS423x */ diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 05cd16d0f..91b49eafc 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -43,13 +43,21 @@ #include <86box/snd_sb.h> #include <86box/plat_unused.h> +#define SB_32_PNP 0 +#define SB_AWE32_PNP 1 +#define SB_AWE64_VALUE 2 +#define SB_AWE64_NOIDE 3 +#define SB_AWE64_IDE 4 +#define SB_AWE64_GOLD 5 + #define PNP_ROM_SB_16_PNP "roms/sound/creative/CTL0024A.BIN" #define PNP_ROM_SB_VIBRA16XV "roms/sound/creative/CT4170 PnP.BIN" #define PNP_ROM_SB_VIBRA16C "roms/sound/creative/CT4180 PnP.BIN" #define PNP_ROM_SB_32_PNP "roms/sound/creative/CT3600 PnP.BIN" #define PNP_ROM_SB_AWE32_PNP "roms/sound/creative/CT3980 PnP.BIN" #define PNP_ROM_SB_AWE64_VALUE "roms/sound/creative/CT4520 PnP.BIN" -#define PNP_ROM_SB_AWE64 "roms/sound/creative/CTL009DA.BIN" +#define PNP_ROM_SB_AWE64_NOIDE "roms/sound/creative/CT4380 PnP noIDE.BIN" +#define PNP_ROM_SB_AWE64_IDE "roms/sound/creative/CTL009DA.BIN" #define PNP_ROM_SB_AWE64_GOLD "roms/sound/creative/CT4540 PnP.BIN" /* TODO: Find real ESS PnP ROM dumps. */ #define PNP_ROM_ESS0100 "roms/sound/ess/ESS0100.BIN" @@ -2219,7 +2227,7 @@ sb_awe32_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, vo } static void -sb_awe64_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, void *priv) +sb_awe64_pnp_ide_config_changed(const uint8_t ld, isapnp_device_config_t *config, void *priv) { sb_t *sb = (sb_t *) priv; @@ -2240,7 +2248,7 @@ sb_awe64_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, vo } static void -sb_awe64_gold_pnp_config_changed(const uint8_t ld, isapnp_device_config_t *config, void *priv) +sb_awe64_pnp_noide_config_changed(const uint8_t ld, isapnp_device_config_t *config, void *priv) { sb_t *sb = (sb_t *) priv; @@ -3495,9 +3503,15 @@ sb_awe64_value_available(void) } static int -sb_awe64_available(void) +sb_awe64_noide_available(void) { - return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64); + return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64_NOIDE); +} + +static int +sb_awe64_ide_available(void) +{ + return sb_awe32_available() && rom_present(PNP_ROM_SB_AWE64_IDE); } static int @@ -3592,7 +3606,7 @@ sb_awe32_pnp_init(const device_t *info) sb->opl_enabled = 1; fm_driver_get(FM_YMF262, &sb->opl); - sb_dsp_init(&sb->dsp, ((info->local == 2) || (info->local == 3) || (info->local == 4)) ? + sb_dsp_init(&sb->dsp, (info->local >= SB_AWE64_VALUE) ? SBAWE64 : SBAWE32PNP, SB_SUBTYPE_DEFAULT, sb); sb_dsp_setdma16_supported(&sb->dsp, 1); sb_ct1745_mixer_reset(sb); @@ -3619,30 +3633,35 @@ sb_awe32_pnp_init(const device_t *info) sb->gameport = gameport_add(&gameport_pnp_device); - if ((info->local != 2) && (info->local != 4)) { + // Does it have IDE? + if ((info->local != SB_AWE64_VALUE) && (info->local != SB_AWE64_NOIDE) && (info->local != SB_AWE64_GOLD)) { device_add(&ide_qua_pnp_device); other_ide_present++; } const char *pnp_rom_file = NULL; switch (info->local) { - case 0: + case SB_32_PNP: pnp_rom_file = PNP_ROM_SB_32_PNP; break; - case 1: + case SB_AWE32_PNP: pnp_rom_file = PNP_ROM_SB_AWE32_PNP; break; - case 2: + case SB_AWE64_VALUE: pnp_rom_file = PNP_ROM_SB_AWE64_VALUE; break; - case 3: - pnp_rom_file = PNP_ROM_SB_AWE64; + case SB_AWE64_NOIDE: + pnp_rom_file = PNP_ROM_SB_AWE64_NOIDE; break; - case 4: + case SB_AWE64_IDE: + pnp_rom_file = PNP_ROM_SB_AWE64_IDE; + break; + + case SB_AWE64_GOLD: pnp_rom_file = PNP_ROM_SB_AWE64_GOLD; break; @@ -3661,21 +3680,22 @@ sb_awe32_pnp_init(const device_t *info) } switch (info->local) { - case 0: + case SB_32_PNP: isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_16_pnp_config_changed, NULL, NULL, NULL, sb); break; - case 1: + case SB_AWE32_PNP: isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe32_pnp_config_changed, NULL, NULL, NULL, sb); break; - case 3: - isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_pnp_config_changed, NULL, NULL, NULL, sb); + case SB_AWE64_IDE: + isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_pnp_ide_config_changed, NULL, NULL, NULL, sb); break; - case 2: - case 4: - isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_gold_pnp_config_changed, NULL, NULL, NULL, sb); + case SB_AWE64_VALUE: + case SB_AWE64_NOIDE: + case SB_AWE64_GOLD: + isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_pnp_noide_config_changed, NULL, NULL, NULL, sb); break; default: @@ -3688,7 +3708,7 @@ sb_awe32_pnp_init(const device_t *info) sb_dsp_setdma16(&sb->dsp, ISAPNP_DMA_DISABLED); mpu401_change_addr(sb->mpu, 0); - if ((info->local != 2) && (info->local != 4)) + if ((info->local != SB_AWE64_VALUE) && (info->local != SB_AWE64_NOIDE) && (info->local != SB_AWE64_GOLD)) ide_remove_handlers(3); emu8k_change_addr(&sb->emu8k, 0); @@ -5772,7 +5792,7 @@ const device_t sb_32_pnp_device = { .name = "Sound Blaster 32 PnP", .internal_name = "sb32_pnp", .flags = DEVICE_ISA | DEVICE_AT, - .local = 0, + .local = SB_32_PNP, .init = sb_awe32_pnp_init, .close = sb_awe32_close, .reset = NULL, @@ -5800,7 +5820,7 @@ const device_t sb_awe32_pnp_device = { .name = "Sound Blaster AWE32 PnP", .internal_name = "sbawe32_pnp", .flags = DEVICE_ISA | DEVICE_AT, - .local = 1, + .local = SB_AWE32_PNP, .init = sb_awe32_pnp_init, .close = sb_awe32_close, .reset = NULL, @@ -5814,7 +5834,7 @@ const device_t sb_awe64_value_device = { .name = "Sound Blaster AWE64 Value", .internal_name = "sbawe64_value", .flags = DEVICE_ISA | DEVICE_AT, - .local = 2, + .local = SB_AWE64_VALUE, .init = sb_awe32_pnp_init, .close = sb_awe32_close, .reset = NULL, @@ -5828,11 +5848,25 @@ const device_t sb_awe64_device = { .name = "Sound Blaster AWE64", .internal_name = "sbawe64", .flags = DEVICE_ISA | DEVICE_AT, - .local = 3, + .local = SB_AWE64_NOIDE, .init = sb_awe32_pnp_init, .close = sb_awe32_close, .reset = NULL, - .available = sb_awe64_available, + { .available = sb_awe64_noide_available }, + .speed_changed = sb_speed_changed, + .force_redraw = NULL, + .config = sb_awe64_config +}; + +const device_t sb_awe64_ide_device = { + .name = "Sound Blaster AWE64 (IDE)", + .internal_name = "sbawe64_ide", + .flags = DEVICE_ISA | DEVICE_AT, + .local = SB_AWE64_IDE, + .init = sb_awe32_pnp_init, + .close = sb_awe32_close, + .reset = NULL, + .available = sb_awe64_ide_available, .speed_changed = sb_speed_changed, .force_redraw = NULL, .config = sb_awe64_config @@ -5842,7 +5876,7 @@ const device_t sb_awe64_gold_device = { .name = "Sound Blaster AWE64 Gold", .internal_name = "sbawe64_gold", .flags = DEVICE_ISA | DEVICE_AT, - .local = 4, + .local = SB_AWE64_GOLD, .init = sb_awe32_pnp_init, .close = sb_awe32_close, .reset = NULL, diff --git a/src/sound/sound.c b/src/sound/sound.c index d2d3dc313..625c50ea1 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -127,6 +127,7 @@ static const SOUND_CARD sound_cards[] = { { &sb_awe32_pnp_device }, { &sb_awe64_value_device }, { &sb_awe64_device }, + { &sb_awe64_ide_device }, { &sb_awe64_gold_device }, { &sb_vibra16c_device }, { &sb_vibra16s_device },