From 2d4649af8497f29a3cafa64d4482b11b0d6f5a53 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 01:26:18 -0400 Subject: [PATCH 1/9] Cleanups in snd_sb.c --- src/sound/snd_sb.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 14726d358..1aef7d575 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3481,7 +3481,6 @@ sb_16_compat_init(const device_t *info) music_add_handler(sb_get_music_buffer_sb16_awe32, sb); sb->mpu = (mpu_t *) calloc(1, sizeof(mpu_t)); - memset(sb->mpu, 0, sizeof(mpu_t)); mpu401_init(sb->mpu, 0, 0, M_UART, (int) (intptr_t) info->local); sb_dsp_set_mpu(&sb->dsp, sb->mpu); @@ -3549,8 +3548,6 @@ sb_awe32_init(UNUSED(const device_t *info)) uint16_t emu_addr = device_get_config_hex16("emu_base"); int onboard_ram = device_get_config_int("onboard_ram"); - memset(sb, 0x00, sizeof(sb_t)); - sb->opl_enabled = device_get_config_int("opl"); if (sb->opl_enabled) fm_driver_get(FM_YMF262, &sb->opl); @@ -3594,7 +3591,6 @@ sb_awe32_init(UNUSED(const device_t *info)) if (mpu_addr) { sb->mpu = (mpu_t *) calloc(1, sizeof(mpu_t)); - memset(sb->mpu, 0, sizeof(mpu_t)); mpu401_init(sb->mpu, device_get_config_hex16("base401"), 0, M_UART, device_get_config_int("receive_input401")); } else @@ -4153,7 +4149,7 @@ static const device_config_t sb_config[] = { .spinner = { 0 }, .selection = { { 0 } }, .bios = { { 0 } } - }, + }, { .name = "", .description = "", .type = CONFIG_END } }; @@ -4178,8 +4174,8 @@ static const device_config_t sb15_config[] = { .bios = { { 0 } } }, { - .name = "irq", - .description = "IRQ", + .name = "irq", + .description = "IRQ", .type = CONFIG_SELECTION, .default_string = NULL, .default_int = 7, @@ -4247,8 +4243,8 @@ static const device_config_t sb15_config[] = { static const device_config_t sb2_config[] = { { - .name = "base", - .description = "Address", + .name = "base", + .description = "Address", .type = CONFIG_HEX16, .default_string = NULL, .default_int = 0x220, @@ -4298,7 +4294,7 @@ static const device_config_t sb2_config[] = { .name = "dma", .description = "DMA", .type = CONFIG_SELECTION, - .default_string = "", + .default_string = NULL, .default_int = 1, .file_filter = NULL, .spinner = { 0 }, @@ -4367,7 +4363,7 @@ static const device_config_t sb_mcv_config[] = { .name = "dma", .description = "DMA", .type = CONFIG_SELECTION, - .default_string = "", + .default_string = NULL, .default_int = 1, .file_filter = NULL, .spinner = { 0 }, @@ -5343,7 +5339,7 @@ static const device_config_t ess_1688_pnp_config[] = { .name = "control_pc_speaker", .description = "Control PC speaker", .type = CONFIG_BINARY, - .default_string = "", + .default_string = NULL, .default_int = 0, .file_filter = NULL, .spinner = { 0 }, @@ -5354,7 +5350,7 @@ static const device_config_t ess_1688_pnp_config[] = { .name = "receive_input", .description = "Receive MIDI input", .type = CONFIG_BINARY, - .default_string = "", + .default_string = NULL, .default_int = 1, .file_filter = NULL, .spinner = { 0 }, @@ -5365,7 +5361,7 @@ static const device_config_t ess_1688_pnp_config[] = { .name = "receive_input401", .description = "Receive MIDI input (MPU-401)", .type = CONFIG_BINARY, - .default_string = "", + .default_string = NULL, .default_int = 0, .file_filter = NULL, .spinner = { 0 }, From 7ffb65827eaec48b864e4f0c82d7a951dede72b0 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 4 Jul 2025 20:10:20 -0400 Subject: [PATCH 2/9] AWE32 (Non PNP) has a non-PNP gameport --- src/sound/snd_sb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 1aef7d575..917d321ef 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3602,7 +3602,7 @@ sb_awe32_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); - sb->gameport = gameport_add(&gameport_pnp_device); + sb->gameport = gameport_add(&gameport_device); sb->gameport_addr = 0x200; gameport_remap(sb->gameport, sb->gameport_addr); From b0a5a8559422a0f900f2d1a1ea394d324af8f173 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 01:37:28 -0400 Subject: [PATCH 3/9] Remove DMA option from older SB's You couldn't pick any DMA other than 1 --- src/sound/snd_sb.c | 47 +--------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 917d321ef..dd853d2ba 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2864,7 +2864,7 @@ sb_init(UNUSED(const device_t *info)) sb_dsp_init(&sb->dsp, model, SB_SUBTYPE_DEFAULT, sb); sb_dsp_setaddr(&sb->dsp, addr); sb_dsp_setirq(&sb->dsp, device_get_config_int("irq")); - sb_dsp_setdma8(&sb->dsp, device_get_config_int("dma")); + sb_dsp_setdma8(&sb->dsp, 1); // SB 1, SB1.5 and 2 don't support DMA3 if (mixer_addr > 0x0000) sb_ct1335_mixer_reset(sb); @@ -4113,21 +4113,6 @@ static const device_config_t sb_config[] = { }, .bios = { { 0 } } }, - { - .name = "dma", - .description = "DMA", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 1, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "DMA 1", .value = 1 }, - { .description = "DMA 3", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, { .name = "opl", .description = "Enable OPL", @@ -4190,21 +4175,6 @@ static const device_config_t sb15_config[] = { }, .bios = { { 0 } } }, - { - .name = "dma", - .description = "DMA", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 1, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "DMA 1", .value = 1 }, - { .description = "DMA 3", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, { .name = "opl", .description = "Enable OPL", @@ -4290,21 +4260,6 @@ static const device_config_t sb2_config[] = { }, .bios = { { 0 } } }, - { - .name = "dma", - .description = "DMA", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 1, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "DMA 1", .value = 1 }, - { .description = "DMA 3", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, { .name = "opl", .description = "Enable OPL", From 8774ff0182cc6badc106d966dd7ae1c810201da1 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 01:41:39 -0400 Subject: [PATCH 4/9] Add gameport to SB1, 1.5 and 2 --- src/sound/snd_sb.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index dd853d2ba..9fc04eefa 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2869,6 +2869,12 @@ sb_init(UNUSED(const device_t *info)) if (mixer_addr > 0x0000) sb_ct1335_mixer_reset(sb); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + /* DSP I/O handler is activated in sb_dsp_setaddr */ if (sb->opl_enabled) { // TODO: See if this applies to the SB1.5 as well @@ -4113,6 +4119,17 @@ static const device_config_t sb_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", @@ -4175,6 +4192,17 @@ static const device_config_t sb15_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", @@ -4260,6 +4288,17 @@ static const device_config_t sb2_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", From 60dde4dab7b27927672cf87b8f4dd12d7a39caa4 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 09:03:56 -0400 Subject: [PATCH 5/9] Add gameport to MCA Soundblasters --- src/sound/snd_sb.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 9fc04eefa..c60b5cfe0 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -2954,6 +2954,12 @@ sb_mcv_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + return sb; } @@ -3123,6 +3129,12 @@ sb_pro_mcv_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + return sb; } @@ -4368,6 +4380,17 @@ static const device_config_t sb_mcv_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", @@ -4468,6 +4491,17 @@ static const device_config_t sb_pro_config[] = { }; static const device_config_t sb_pro_mcv_config[] = { + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "receive_input", .description = "Receive MIDI input", From 43ee3d3e6b7af6a5a67ccc2c380237a8cea19f1e Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 09:04:23 -0400 Subject: [PATCH 6/9] Add gameport to Soundblaster Pro v1 and v2 --- src/sound/snd_sb.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index c60b5cfe0..0e67f7c22 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3042,6 +3042,12 @@ sb_pro_v1_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + return sb; } @@ -3096,6 +3102,12 @@ sb_pro_v2_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + return sb; } @@ -4465,6 +4477,17 @@ static const device_config_t sb_pro_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", From 870d06ae8a72a3ed4b6347761b636dc1fdaadf99 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 02:11:11 -0400 Subject: [PATCH 7/9] Allow SB16 (Non-PNP) gameport to be disabled --- src/sound/snd_sb.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 0e67f7c22..345b6346b 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3231,9 +3231,17 @@ sb_16_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); - sb->gameport = gameport_add(&gameport_pnp_device); - sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); + if (info->local == FM_YMF289B) { + sb->gameport = gameport_add(&gameport_pnp_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } else { + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } + } return sb; } @@ -4622,6 +4630,17 @@ static const device_config_t sb_16_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", From 7ab8987a2be60ec0868810b978fc6ecaf0c2c790 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 01:50:29 -0400 Subject: [PATCH 8/9] Allow AWE32 (Non-PNP) gameport to be disabled --- src/sound/snd_sb.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 345b6346b..d75ee5766 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3640,9 +3640,11 @@ sb_awe32_init(UNUSED(const device_t *info)) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &sb->dsp); - sb->gameport = gameport_add(&gameport_device); - sb->gameport_addr = 0x200; - gameport_remap(sb->gameport, sb->gameport_addr); + if (device_get_config_int("gameport")) { + sb->gameport = gameport_add(&gameport_device); + sb->gameport_addr = 0x200; + gameport_remap(sb->gameport, sb->gameport_addr); + } return sb; } @@ -4923,6 +4925,17 @@ static const device_config_t sb_awe32_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "opl", .description = "Enable OPL", From 87892e72d6afec5b3443d9d682c004a3de67b5a1 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 6 Jul 2025 02:42:10 -0400 Subject: [PATCH 9/9] Allow ES688/1688 (Non-PNP) gameport to be disabled --- src/sound/snd_sb.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index d75ee5766..e612250b7 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -3906,9 +3906,11 @@ ess_x688_init(UNUSED(const device_t *info)) sb_dsp_set_mpu(&ess->dsp, ess->mpu); } - ess->gameport = gameport_add(&gameport_pnp_device); - ess->gameport_addr = 0x200; - gameport_remap(ess->gameport, ess->gameport_addr); + if (device_get_config_int("gameport")) { + ess->gameport = gameport_add(&gameport_device); + ess->gameport_addr = 0x200; + gameport_remap(ess->gameport, ess->gameport_addr); + } if (ide_base > 0x0000) { device_add(&ide_qua_pnp_device); @@ -5265,6 +5267,17 @@ static const device_config_t ess_688_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "ide_ctrl", .description = "IDE Controller", @@ -5348,6 +5361,17 @@ static const device_config_t ess_1688_config[] = { }, .bios = { { 0 } } }, + { + .name = "gameport", + .description = "Enable Game port", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, { .name = "ide_ctrl", .description = "IDE Controller",