From 855af3727dcf1326f34472e870dd9ce87e7acdf6 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 12 Feb 2022 23:20:59 -0500 Subject: [PATCH] Add TNDY --- src/include/86box/sound.h | 1 + src/sound/snd_sn76489.c | 49 +++++++++++++++++++++++++++++++++++++++ src/sound/sound.c | 1 + 3 files changed, 51 insertions(+) diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index 089aaa667..cbf380901 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -103,6 +103,7 @@ extern const device_t pas16_device; extern const device_t ps1snd_device; /* Tandy PSSJ */ +extern const device_t tndy_device; extern const device_t pssj_device; extern const device_t pssj_isa_device; diff --git a/src/sound/snd_sn76489.c b/src/sound/snd_sn76489.c index 6f60a077e..8f0175af8 100644 --- a/src/sound/snd_sn76489.c +++ b/src/sound/snd_sn76489.c @@ -224,6 +224,18 @@ void *ncr8496_device_init(const device_t *info) return sn76489; } +void *tndy_device_init(const device_t *info) +{ + sn76489_t *sn76489 = malloc(sizeof(sn76489_t)); + memset(sn76489, 0, sizeof(sn76489_t)); + + uint16_t addr = device_get_config_hex16("base"); + + sn76489_init(sn76489, addr, 0x0008, SN76496, 3579545); + + return sn76489; +} + void sn76489_device_close(void *p) { sn76489_t *sn76489 = (sn76489_t *)p; @@ -231,6 +243,30 @@ void sn76489_device_close(void *p) free(sn76489); } +static const device_config_t tndy_config[] = +{ + { + "base", "Address", CONFIG_HEX16, "", 0x0C0, "", { 0 }, + { + { + "0x0C0", 0x0C0 + }, + { + "0x1E0", 0x1E0 + }, + { + "0x2C0", 0x2C0 + }, + { + "" + } + } + }, + { + "", "", -1 + } +}; + const device_t sn76489_device = { "TI SN74689 PSG", @@ -242,6 +278,7 @@ const device_t sn76489_device = NULL, { NULL }, NULL, NULL }; + const device_t ncr8496_device = { "NCR8496 PSG", @@ -253,3 +290,15 @@ const device_t ncr8496_device = NULL, { NULL }, NULL, NULL }; + +const device_t tndy_device = +{ + "TNDY", + "tndy" + DEVICE_ISA, + 0, + tndy_device_init, + sn76489_device_close, + NULL, { NULL }, NULL, + tndy_config +}; diff --git a/src/sound/sound.c b/src/sound/sound.c index f203a6f76..b2b9c4fca 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -123,6 +123,7 @@ static const SOUND_CARD sound_cards[] = #if defined(DEV_BRANCH) && defined(USE_PAS16) { &pas16_device }, #endif + { &tndy_device }, { &pssj_isa_device }, { &wss_device }, { &adlib_mca_device },