diff options
author | 2021-05-14 18:33:49 -0700 | |
---|---|---|
committer | 2021-05-14 18:33:49 -0700 | |
commit | 3cfc5224583f219ce5539708f78816d63f21c965 (patch) | |
tree | 5e404d9014e39cbba18475d42142bae08d8d8294 /src/devices/sound/ymopl.h | |
parent | b16708ff756062e0f450a77baa9f38c77a4263aa (diff) |
ymfm: Refactor new FM engine into a 3rdparty library (#8046)
ymfm: refactor the code into a separate 3rdparty library
* Moved ymfm core implementation to 3rdparty/ymfm
* Split out each family (OPM/OPN/OPL/etc) into its own source file
* Added preliminary OPQ and OPZ support, still WIP
* Put all 3rdparty code into its own namespace ymfm
* Fixed various bugs reported in #8042
* Created interface class for communication between the 3rdparty engine and the emulator
* Standardized MAME implementation of all Yamaha devices based on a template class
* Created standard base class ym_generic that can be used when multiple YM chips are swapped in
* Changed YM2203/2608/2610 to embed a YM2149 as a subdevice instead of deriving from ay8910_device
* Also provided compile-time option to use a simplified built-in SSG rather than using MAME's at all (currently off)
* Consolidated MAME header files from one-per-chip (ym2151.h, ym2203.h, etc) to one-per-family (ymopm.h, ymopn.h, etc)
Diffstat (limited to 'src/devices/sound/ymopl.h')
-rw-r--r-- | src/devices/sound/ymopl.h | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/src/devices/sound/ymopl.h b/src/devices/sound/ymopl.h new file mode 100644 index 00000000000..4d221529b4b --- /dev/null +++ b/src/devices/sound/ymopl.h @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles + +#ifndef MAME_SOUND_YM3526_H +#define MAME_SOUND_YM3526_H + +#pragma once + +#include "ymfm_mame.h" +#include "ymfm/src/ymfm_opl.h" +#include "dirom.h" + + +// ======================> ym3526_device + +DECLARE_DEVICE_TYPE(YM3526, ym3526_device); + +class ym3526_device : public ymfm_device_base<ymfm::ym3526> +{ +public: + // constructor + ym3526_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// ======================> y8950_device + +DECLARE_DEVICE_TYPE(Y8950, y8950_device); + +class y8950_device : public ymfm_device_base<ymfm::y8950>, public device_rom_interface<21> +{ +public: + // constructor + y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // configuration helpers + auto io_read() { return io_read_handler(0); } + auto io_write() { return io_write_handler(0); } + auto keyboard_read() { return io_read_handler(1); } + auto keyboard_write() { return io_write_handler(1); } + + // additional register reads + u8 data_r() { return update_streams().read_data(); } + +protected: + // ROM device overrides + virtual void rom_bank_updated() override; + +private: + // ADPCM read/write callbacks + uint8_t ymfm_adpcm_b_read(offs_t address) override; + void ymfm_adpcm_b_write(offs_t address, uint8_t data) override; +}; + + +// ======================> ym3812_device + +DECLARE_DEVICE_TYPE(YM3812, ym3812_device); + +class ym3812_device : public ymfm_device_base<ymfm::ym3812> +{ +public: + // constructor + ym3812_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// ======================> ymf262_device + +DECLARE_DEVICE_TYPE(YMF262, ymf262_device); + +class ymf262_device : public ymfm_device_base<ymfm::ymf262> +{ +public: + // constructor + ymf262_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // additional register writes + void address_hi_w(u8 data) { update_streams().write_address_hi(data); } + void data_hi_w(u8 data) { update_streams().write_data(data); } +}; + + +// ======================> ym2413_device + +DECLARE_DEVICE_TYPE(YM2413, ym2413_device); + +class ym2413_device : public ymfm_device_base<ymfm::ym2413> +{ + using parent = ymfm_device_base<ymfm::ym2413>; + +public: + // constructor + ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // internal state + required_region_ptr<u8> m_internal; // internal memory region +}; + + +// ======================> ym2423_device + +DECLARE_DEVICE_TYPE(YM2423, ym2423_device); + +class ym2423_device : public ymfm_device_base<ymfm::ym2423> +{ + using parent = ymfm_device_base<ymfm::ym2423>; + +public: + // constructor + ym2423_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // internal state + required_region_ptr<u8> m_internal; // internal memory region +}; + + +// ======================> ymf281_device + +DECLARE_DEVICE_TYPE(YMF281, ymf281_device); + +class ymf281_device : public ymfm_device_base<ymfm::ymf281> +{ + using parent = ymfm_device_base<ymfm::ymf281>; + +public: + // constructor + ymf281_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // internal state + required_region_ptr<u8> m_internal; // internal memory region +}; + + +// ======================> ds1001_device + +DECLARE_DEVICE_TYPE(DS1001, ds1001_device); + +class ds1001_device : public ymfm_device_base<ymfm::ds1001> +{ + using parent = ymfm_device_base<ymfm::ds1001>; + +public: + // constructor + ds1001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // internal state + required_region_ptr<u8> m_internal; // internal memory region +}; + +#endif // MAME_SOUND_YM3526_H |