From 3c56968921ae5a622ae943bfc3aee69f3e36873f Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:37:06 -0600 Subject: [PATCH 1/3] Give the OPTi 931 its PnP quaternary IDE controller --- src/disk/hdc_ide.c | 30 ++++++++++++++++++++++++++++++ src/include/86box/hdc_ide.h | 1 + src/sound/snd_optimc.c | 10 +++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 6b116697f..fb844da8f 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -3010,6 +3010,36 @@ ide_pnp_config_changed_1addr(uint8_t ld, isapnp_device_config_t *config, void *p } } +/* OPTi 931 PnP ROM flips the main and side IDE I/O port ranges */ +void +ide_pnp_config_changed_opti931(uint8_t ld, isapnp_device_config_t *config, void *priv) +{ + intptr_t board = (intptr_t) priv; + + if (ld) + return; + + if (ide_boards[board]->base[0] || ide_boards[board]->base[1]) { + ide_remove_handlers(board); + ide_boards[board]->base[0] = ide_boards[board]->base[1] = 0; + } + + ide_boards[board]->irq = -1; + + if (config->activate) { + ide_boards[board]->base[1] = (config->io[0].base != ISAPNP_IO_DISABLED) ? + config->io[0].base : 0x0000; + ide_boards[board]->base[0] = (config->io[1].base != ISAPNP_IO_DISABLED) ? + config->io[1].base : 0x0000; + + if (ide_boards[board]->base[0] && ide_boards[board]->base[1]) + ide_set_handlers(board); + + if (config->irq[0].irq != ISAPNP_IRQ_DISABLED) + ide_boards[board]->irq = config->irq[0].irq; + } +} + void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) { diff --git a/src/include/86box/hdc_ide.h b/src/include/86box/hdc_ide.h index 99d97efd9..a1c22d045 100644 --- a/src/include/86box/hdc_ide.h +++ b/src/include/86box/hdc_ide.h @@ -210,6 +210,7 @@ extern void ide_handlers(uint8_t board, int set); extern void ide_board_set_force_ata3(int board, int force_ata3); #ifdef EMU_ISAPNP_H extern void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv); +extern void ide_pnp_config_changed_opti931(uint8_t ld, isapnp_device_config_t *config, void *priv); extern void ide_pnp_config_changed_1addr(uint8_t ld, isapnp_device_config_t *config, void *priv); #endif diff --git a/src/sound/snd_optimc.c b/src/sound/snd_optimc.c index 7c72104ae..e9198b9f0 100644 --- a/src/sound/snd_optimc.c +++ b/src/sound/snd_optimc.c @@ -38,7 +38,9 @@ #include <86box/mem.h> #include <86box/rom.h> #include <86box/plat_unused.h> +#include <86box/hdc.h> #include <86box/isapnp.h> +#include <86box/hdc_ide.h> #include <86box/log.h> #define PNP_ROM_OPTI931 "roms/sound/opti931/adsrom.bin" @@ -889,7 +891,8 @@ opti931_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pri optimc_log(optimc->log, "PnP Config changed\n"); switch (ld) { - case 0: /* Aux Device */ + case 0: /* IDE CD-ROM */ + ide_pnp_config_changed_opti931(0, config, (void *) 3); break; case 1: /* WSS/OPL3/SBPro/Control regs */ if (optimc->cur_wss_addr) { @@ -1155,6 +1158,11 @@ optimc_init(const device_t *info) /* Set up ISAPnP handlers to intercept Read Data port changes */ io_sethandler(0x279, 0x0001, NULL, NULL, NULL, opti931_isapnp_write, NULL, NULL, optimc); io_sethandler(0xA79, 0x0001, NULL, NULL, NULL, opti931_isapnp_write, NULL, NULL, optimc); + + /* Add ISAPnP quaternary IDE controller */ + device_add(&ide_qua_pnp_device); + other_ide_present++; + ide_remove_handlers(3); } /* OPTi 930 DOS sound test utility starts DMA playback without setting a time constant likely making */ From f957b4bb33252f20378bfce39ddf4d46d62ebdfa Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:40:23 -0600 Subject: [PATCH 2/3] Make the Yamaha YMF701/71x use the YMF289B variant of the OPL3 per the YMF-715 datasheet --- src/sound/snd_ymf701.c | 2 +- src/sound/snd_ymf71x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sound/snd_ymf701.c b/src/sound/snd_ymf701.c index 3b3529320..c6b1467c8 100644 --- a/src/sound/snd_ymf701.c +++ b/src/sound/snd_ymf701.c @@ -428,7 +428,7 @@ ymf701_init(const device_t *info) ymf701->sb->opl_mixer = ymf701; ymf701->sb->opl_mix = ymf701_filter_opl; - fm_driver_get(FM_YMF262, &ymf701->sb->opl); + fm_driver_get(FM_YMF289B, &ymf701->sb->opl); io_sethandler(ymf701->cur_sb_addr + 0, 0x0004, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); io_sethandler(ymf701->cur_sb_addr + 8, 0x0002, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); io_sethandler(0x0388, 0x0004, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); diff --git a/src/sound/snd_ymf71x.c b/src/sound/snd_ymf71x.c index c79263ce0..70ccf6872 100644 --- a/src/sound/snd_ymf71x.c +++ b/src/sound/snd_ymf71x.c @@ -718,7 +718,7 @@ ymf71x_init(const device_t *info) ymf71x->sb->opl_mixer = ymf71x; ymf71x->sb->opl_mix = ymf71x_filter_opl; - fm_driver_get(FM_YMF262, &ymf71x->sb->opl); + fm_driver_get(FM_YMF289B, &ymf71x->sb->opl); sound_add_handler(ymf71x_get_buffer, ymf71x); music_add_handler(sb_get_music_buffer_sbpro, ymf71x->sb); From 1fabffaa3b2119d83ece881aea2f737173df4fa4 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:49:54 -0600 Subject: [PATCH 3/3] Add config migration for the Aztech 1605/2316 codec type selection --- src/config.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/config.c b/src/config.c index 86dc95cca..197ed6b27 100644 --- a/src/config.c +++ b/src/config.c @@ -740,6 +740,25 @@ load_sound(void) } } + /* Correct Aztech codec selection in old configs so the OPTi 930 AD1848 type isn't selected */ + for (int i = 0; i < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); i++) { + sprintf(temp, "Aztech Sound Galaxy Pro 16 AB (Washington) #%i", i + 1); + ini_section_t c = ini_find_section(config, temp); + if (c != NULL) { + if (ini_section_get_int(c, "codec", 1) == 2) + ini_section_set_int(c, "codec", 3); + } + } + for (int i = 0; i < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); i++) { + sprintf(temp, "Aztech Sound Galaxy Nova 16 Extra (Clinton) #%i", i + 1); + ini_section_t c = ini_find_section(config, temp); + if (c != NULL) { + if (ini_section_get_int(c, "codec", 1) == 2) + ini_section_set_int(c, "codec", 3); + } + } + + memset(temp, '\0', sizeof(temp)); p = ini_section_get_string(cat, "sound_type", "float"); if (strlen(p) > 511)