Add "The Entertainer" sound device

This commit is contained in:
Jasmine Iwanek
2024-11-27 03:58:47 -05:00
parent 461e59f4a5
commit 04d777506c
3 changed files with 69 additions and 0 deletions

View File

@@ -192,6 +192,7 @@ extern const device_t ps1snd_device;
/* Innovation SSI-2001 */
extern const device_t ssi2001_device;
extern const device_t entertainer_device;
/* Pro Audio Spectrum Plus, 16, and 16D */
extern const device_t pasplus_device;

View File

@@ -21,6 +21,10 @@ typedef struct ssi2001_t {
int gameport_enabled;
} ssi2001_t;
typedef struct entertainer_t {
uint8_t regs;
} entertainer_t;
static void
ssi2001_update(ssi2001_t *ssi2001)
{
@@ -90,6 +94,48 @@ ssi2001_close(void *priv)
free(ssi2001);
}
static uint8_t
entertainer_read(uint16_t addr, void *priv)
{
return 0xa5;
}
static void
entertainer_write(uint16_t addr, uint8_t val, void *priv)
{
entertainer_t *entertainer = (entertainer_t *) priv;
entertainer->regs = val;
}
void *
entertainer_init(UNUSED(const device_t *info))
{
ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t));
entertainer_t *entertainer = malloc(sizeof(entertainer_t));
memset(ssi2001, 0, sizeof(ssi2001_t));
memset(entertainer, 0, sizeof(entertainer_t));
ssi2001->psid = sid_init(0);
sid_reset(ssi2001->psid);
ssi2001->gameport_enabled = device_get_config_int("gameport");
io_sethandler(0x200, 0x0001, entertainer_read, NULL, NULL, entertainer_write, NULL, NULL, entertainer);
io_sethandler(0x280, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001);
if (ssi2001->gameport_enabled)
gameport_remap(gameport_add(&gameport_201_device), 0x201);
sound_add_handler(ssi2001_get_buffer, ssi2001);
return ssi2001;
}
void
entertainer_close(void *priv)
{
ssi2001_t *ssi2001 = (ssi2001_t *) priv;
sid_close(ssi2001->psid);
free(ssi2001);
}
static const device_config_t ssi2001_config[] = {
// clang-format off
{
@@ -125,6 +171,13 @@ static const device_config_t ssi2001_config[] = {
// clang-format off
};
static const device_config_t entertainer_config[] = {
// clang-format off
{ "gameport", "Enable Game port", CONFIG_BINARY, "", 1 },
{ "", "", -1 }
// clang-format off
};
const device_t ssi2001_device = {
.name = "Innovation SSI-2001",
.internal_name = "ssi2001",
@@ -138,3 +191,17 @@ const device_t ssi2001_device = {
.force_redraw = NULL,
.config = ssi2001_config
};
const device_t entertainer_device = {
.name = "The Entertainer",
.internal_name = "Entertainer",
.flags = DEVICE_ISA,
.local = 1,
.init = entertainer_init,
.close = entertainer_close,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = entertainer_config
};

View File

@@ -132,6 +132,7 @@ static const SOUND_CARD sound_cards[] = {
{ &sb_vibra16s_device },
{ &sb_vibra16xv_device },
{ &ssi2001_device },
{ &entertainer_device },
{ &pasplus_device },
{ &pas16_device },
{ &pas16d_device },