mirror of
https://github.com/86Box/86Box.git
synced 2025-01-22 17:22:25 -05:00
Merge pull request #5074 from jriwanek-forks/ctpnp
Add SB16 CT2940 no IDE variant
This commit is contained in:
commit
bb9bf28a62
3 changed files with 76 additions and 26 deletions
|
@ -149,6 +149,7 @@ extern const device_t sb_vibra16xv_device;
|
|||
extern const device_t sb_vibra16c_onboard_device;
|
||||
extern const device_t sb_vibra16c_device;
|
||||
extern const device_t sb_16_pnp_device;
|
||||
extern const device_t sb_16_pnp_ide_device;
|
||||
extern const device_t sb_16_compat_device;
|
||||
extern const device_t sb_16_compat_nompu_device;
|
||||
extern const device_t sb_16_reply_mca_device;
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2024 Jasmine Iwanek.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
@ -43,6 +45,9 @@
|
|||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define SB_16_PNP_NOIDE 0
|
||||
#define SB_16_PNP_IDE 1
|
||||
|
||||
#define SB_32_PNP 0
|
||||
#define SB_AWE32_PNP 1
|
||||
#define SB_AWE64_VALUE 2
|
||||
|
@ -50,19 +55,20 @@
|
|||
#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_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"
|
||||
#define PNP_ROM_SB_16_PNP_NOIDE "roms/sound/creative/CT2941 PnP.BIN"
|
||||
#define PNP_ROM_SB_16_PNP_IDE "roms/sound/creative/CTL0024A.BIN" /* CT2940 */
|
||||
#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_NOIDE "roms/sound/creative/CT4380 PnP noIDE.BIN"
|
||||
#define PNP_ROM_SB_AWE64_IDE "roms/sound/creative/CTL009DA.BIN" /* CT4381? */
|
||||
#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"
|
||||
#define PNP_ROM_ESS0102 "roms/sound/ess/ESS0102.BIN"
|
||||
#define PNP_ROM_ESS0968 "roms/sound/ess/ESS0968.BIN"
|
||||
#define PNP_ROM_ESS0100 "roms/sound/ess/ESS0100.BIN"
|
||||
#define PNP_ROM_ESS0102 "roms/sound/ess/ESS0102.BIN"
|
||||
#define PNP_ROM_ESS0968 "roms/sound/ess/ESS0968.BIN"
|
||||
|
||||
/* 0 to 7 -> -14dB to 0dB i 2dB steps. 8 to 15 -> 0 to +14dB in 2dB steps.
|
||||
Note that for positive dB values, this is not amplitude, it is amplitude - 1. */
|
||||
|
@ -3284,9 +3290,15 @@ sb_16_reply_mca_init(UNUSED(const device_t *info))
|
|||
}
|
||||
|
||||
static int
|
||||
sb_16_pnp_available(void)
|
||||
sb_16_pnp_noide_available(void)
|
||||
{
|
||||
return rom_present(PNP_ROM_SB_16_PNP);
|
||||
return rom_present(PNP_ROM_SB_16_PNP_NOIDE);
|
||||
}
|
||||
|
||||
static int
|
||||
sb_16_pnp_ide_available(void)
|
||||
{
|
||||
return rom_present(PNP_ROM_SB_16_PNP_IDE);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -3322,16 +3334,35 @@ sb_16_pnp_init(UNUSED(const device_t *info))
|
|||
|
||||
sb->gameport = gameport_add(&gameport_pnp_device);
|
||||
|
||||
device_add(&ide_qua_pnp_device);
|
||||
other_ide_present++;
|
||||
// Does it have IDE?
|
||||
if (info->local != SB_16_PNP_NOIDE) {
|
||||
device_add(&ide_qua_pnp_device);
|
||||
other_ide_present++;
|
||||
}
|
||||
|
||||
uint8_t *pnp_rom = NULL;
|
||||
FILE *fp = rom_fopen(PNP_ROM_SB_16_PNP, "rb");
|
||||
uint16_t pnp_rom_len = 512;
|
||||
if (fp) {
|
||||
if (fread(sb->pnp_rom, 1, pnp_rom_len, fp) == pnp_rom_len)
|
||||
pnp_rom = sb->pnp_rom;
|
||||
fclose(fp);
|
||||
const char *pnp_rom_file = NULL;
|
||||
uint16_t pnp_rom_len = 512;
|
||||
switch (info->local) {
|
||||
case SB_16_PNP_NOIDE:
|
||||
pnp_rom_file = PNP_ROM_SB_16_PNP_NOIDE;
|
||||
break;
|
||||
|
||||
case SB_16_PNP_IDE:
|
||||
pnp_rom_file = PNP_ROM_SB_16_PNP_IDE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t *pnp_rom = NULL;
|
||||
if (pnp_rom_file) {
|
||||
FILE *fp = rom_fopen(pnp_rom_file, "rb");
|
||||
if (fp) {
|
||||
if (fread(sb->pnp_rom, 1, pnp_rom_len, fp) == pnp_rom_len)
|
||||
pnp_rom = sb->pnp_rom;
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_16_pnp_config_changed,
|
||||
|
@ -3344,7 +3375,9 @@ sb_16_pnp_init(UNUSED(const device_t *info))
|
|||
sb_dsp_setdma16(&sb->dsp, ISAPNP_DMA_DISABLED);
|
||||
|
||||
mpu401_change_addr(sb->mpu, 0);
|
||||
ide_remove_handlers(3);
|
||||
|
||||
if (info->local != SB_16_PNP_NOIDE)
|
||||
ide_remove_handlers(3);
|
||||
|
||||
sb->gameport_addr = 0;
|
||||
gameport_remap(sb->gameport, 0);
|
||||
|
@ -3714,6 +3747,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 != SB_AWE64_VALUE) && (info->local != SB_AWE64_NOIDE) && (info->local != SB_AWE64_GOLD))
|
||||
ide_remove_handlers(3);
|
||||
|
||||
|
@ -5756,11 +5790,25 @@ const device_t sb_16_pnp_device = {
|
|||
.name = "Sound Blaster 16 PnP",
|
||||
.internal_name = "sb16_pnp",
|
||||
.flags = DEVICE_ISA | DEVICE_AT,
|
||||
.local = 0,
|
||||
.local = SB_16_PNP_NOIDE,
|
||||
.init = sb_16_pnp_init,
|
||||
.close = sb_close,
|
||||
.reset = NULL,
|
||||
.available = sb_16_pnp_available,
|
||||
{ .available = sb_16_pnp_noide_available },
|
||||
.speed_changed = sb_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = sb_16_pnp_config
|
||||
};
|
||||
|
||||
const device_t sb_16_pnp_ide_device = {
|
||||
.name = "Sound Blaster 16 PnP (IDE)",
|
||||
.internal_name = "sb16_pnp_ide",
|
||||
.flags = DEVICE_ISA | DEVICE_AT,
|
||||
.local = SB_16_PNP_IDE,
|
||||
.init = sb_16_pnp_init,
|
||||
.close = sb_close,
|
||||
.reset = NULL,
|
||||
.available = sb_16_pnp_ide_available,
|
||||
.speed_changed = sb_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = sb_16_pnp_config
|
||||
|
|
|
@ -122,6 +122,7 @@ static const SOUND_CARD sound_cards[] = {
|
|||
{ &sb_pro_v2_device },
|
||||
{ &sb_16_device },
|
||||
{ &sb_16_pnp_device },
|
||||
{ &sb_16_pnp_ide_device },
|
||||
{ &sb_32_pnp_device },
|
||||
{ &sb_awe32_device },
|
||||
{ &sb_awe32_pnp_device },
|
||||
|
|
Loading…
Reference in a new issue