From 7b2508f81774ea8a4e03561db12b79311cefd15c Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 19 Dec 2024 04:31:56 -0500 Subject: [PATCH] Add OPQ, OPX(Partial), and OPZ chips --- src/include/86box/snd_opl.h | 22 +++++++++++-- src/sound/snd_opl.c | 17 ++++++++++ src/sound/snd_opl_ymfm.cpp | 64 +++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/include/86box/snd_opl.h b/src/include/86box/snd_opl.h index 5bd1166a2..62c62e965 100644 --- a/src/include/86box/snd_opl.h +++ b/src/include/86box/snd_opl.h @@ -39,9 +39,14 @@ enum fm_type { FM_YM3438 = 18, /* OPN2C */ FM_YMF276 = 19, /* OPN2L */ FM_YM2164 = 20, /* OPP */ - FM_ESFM = 21, /* ESFM */ - FM_OPL2BOARD = 22, /* OPL2Board (External Device) */ - FM_MAX = 23 + FM_YM3806 = 21, /* OPQ */ +#if 0 + FM_YMF271 = 22, /* OPX */ +#endif + FM_YM2414 = 23, /* OPZ */ + FM_ESFM = 24, /* ESFM */ + FM_OPL2BOARD = 25, /* OPL2Board (External Device) */ + FM_MAX = 26 }; enum fm_driver { @@ -101,6 +106,17 @@ extern const device_t ymf276_ymfm_device; /* OPP Series */ extern const device_t ym2164_ymfm_device; +/* OPQ Series */ +extern const device_t ym3806_ymfm_device; + +/* OPX Series */ +#if 0 +extern const device_t ymf271_ymfm_device; +#endif + +/* OPZ Series */ +extern const device_t ym2414_ymfm_device; + extern const device_t esfm_esfmu_device; #ifdef USE_LIBSERIALPORT diff --git a/src/sound/snd_opl.c b/src/sound/snd_opl.c index 1cf3bab29..1ee687f1e 100644 --- a/src/sound/snd_opl.c +++ b/src/sound/snd_opl.c @@ -153,6 +153,23 @@ fm_driver_get(int chip_id, fm_drv_t *drv) *drv = ymfm_drv; drv->priv = device_add_inst(&ym2164_ymfm_device, fm_dev_inst[fm_driver][chip_id]++); break; + + case FM_YM3806: /* OPQ */ + *drv = ymfm_drv; + drv->priv = device_add_inst(&ym3806_ymfm_device, fm_dev_inst[fm_driver][chip_id]++); + break; + +#if 0 + case FM_YMF271: /* OPX */ + *drv = ymfm_drv; + drv->priv = device_add_inst(&ymf271_ymfm_device, fm_dev_inst[fm_driver][chip_id]++); + break; +#endif + + case FM_YM2414: /* OPZ */ + *drv = ymfm_drv; + drv->priv = device_add_inst(&ym2414_ymfm_device, fm_dev_inst[fm_driver][chip_id]++); + break; case FM_ESFM: *drv = esfmu_opl_drv; diff --git a/src/sound/snd_opl_ymfm.cpp b/src/sound/snd_opl_ymfm.cpp index 007722e82..fb00401d5 100644 --- a/src/sound/snd_opl_ymfm.cpp +++ b/src/sound/snd_opl_ymfm.cpp @@ -24,7 +24,9 @@ #include "ymfm/ymfm_opm.h" #include "ymfm/ymfm_opn.h" #include "ymfm/ymfm_opq.h" +#if 0 #include "ymfm/ymfm_opx.h" +#endif #include "ymfm/ymfm_opz.h" extern "C" { @@ -429,6 +431,23 @@ ymfm_drv_init(const device_t *info) // TODO: Check rates and frequency fm = (YMFMChipBase *) new YMFMChip(14318181, FM_YM2164, FREQ_49716); break; + + case FM_YM3806: /* OPQ */ + // TODO: Check rates and frequency + fm = (YMFMChipBase *) new YMFMChip(14318181, FM_YM3806, FREQ_49716); + break; + +#if 0 + case FM_YMF271: /* OPX */ + // TODO: Check rates and frequency + fm = (YMFMChipBase *) new YMFMChip(14318181, FM_YMF271, FREQ_49716); + break; +#endif + + case FM_YM2414: /* OPZ */ + // TODO: Check rates and frequency + fm = (YMFMChipBase *) new YMFMChip(14318181, FM_YM2414, FREQ_49716); + break; } fm->set_do_cycles(1); @@ -803,6 +822,51 @@ const device_t ym2164_ymfm_device = { .config = NULL }; +const device_t ym3806_ymfm_device = { + .name = "Yamaha YM3806 OPQ (YMFM)", + .internal_name = "ym3806_ymfm", + .flags = 0, + .local = FM_YM3806, + .init = ymfm_drv_init, + .close = ymfm_drv_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + +#if 0 +const device_t ymf271_ymfm_device = { + .name = "Yamaha YMF271 OPX (YMFM)", + .internal_name = "ym271_ymfm", + .flags = 0, + .local = FM_YMF271, + .init = ymfm_drv_init, + .close = ymfm_drv_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; +#endif + +const device_t ym2414_ymfm_device = { + .name = "Yamaha YM2414 OPZ (YMFM)", + .internal_name = "ym2414_ymfm", + .flags = 0, + .local = FM_YM2414, + .init = ymfm_drv_init, + .close = ymfm_drv_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + + const fm_drv_t ymfm_drv { .read = &ymfm_drv_read, .write = &ymfm_drv_write,