diff options
Diffstat (limited to 'src')
148 files changed, 1056 insertions, 1729 deletions
diff --git a/src/devices/bus/a7800/xboard.h b/src/devices/bus/a7800/xboard.h index 772a6c0e3e6..b9cf77d6adb 100644 --- a/src/devices/bus/a7800/xboard.h +++ b/src/devices/bus/a7800/xboard.h @@ -6,7 +6,7 @@ #include "a78_slot.h" #include "rom.h" #include "sound/pokey.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" // ======================> a78_xboard_device diff --git a/src/devices/bus/isa/ibm_mfc.h b/src/devices/bus/isa/ibm_mfc.h index 4a86972d838..3c90a0917a7 100644 --- a/src/devices/bus/isa/ibm_mfc.h +++ b/src/devices/bus/isa/ibm_mfc.h @@ -17,7 +17,7 @@ #include "machine/i8255.h" #include "machine/i8251.h" #include "machine/pit8253.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" //************************************************************************** // TYPE DEFINITIONS diff --git a/src/devices/bus/msx_cart/yamaha.h b/src/devices/bus/msx_cart/yamaha.h index 30f7fea8e55..431b55da5b5 100644 --- a/src/devices/bus/msx_cart/yamaha.h +++ b/src/devices/bus/msx_cart/yamaha.h @@ -4,7 +4,7 @@ #define __MSX_CART_YAMAHA_H #include "bus/msx_cart/cartridge.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "bus/msx_cart/msx_audio_kb.h" #include "machine/ym2148.h" diff --git a/src/devices/sound/2151intf.cpp b/src/devices/sound/2151intf.cpp deleted file mode 100644 index e46eea7b4f6..00000000000 --- a/src/devices/sound/2151intf.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/*************************************************************************** - - 2151intf.c - - Support interface YM2151(OPM) - -***************************************************************************/ - -#include "emu.h" -#include "2151intf.h" -#include "ym2151.h" - - - -const device_type YM2151 = &device_creator<ym2151_device>; - - -//------------------------------------------------- -// ym2151_device - constructor -//------------------------------------------------- - -ym2151_device::ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, YM2151, "YM2151", tag, owner, clock, "ym2151", __FILE__), - device_sound_interface(mconfig, *this), - m_stream(nullptr), - m_chip(nullptr), - m_lastreg(0), - m_irqhandler(*this), - m_portwritehandler(*this) -{ -} - - -//------------------------------------------------- -// read - read from the device -//------------------------------------------------- - -READ8_MEMBER( ym2151_device::read ) -{ - if (offset & 1) - { - m_stream->update(); - return ym2151_read_status(m_chip); - } - else - return 0xff; /* confirmed on a real YM2151 */ -} - - -//------------------------------------------------- -// write - write from the device -//------------------------------------------------- - -WRITE8_MEMBER( ym2151_device::write ) -{ - if (offset & 1) - { - m_stream->update(); - ym2151_write_reg(m_chip, m_lastreg, data); - } - else - m_lastreg = data; -} - - -READ8_MEMBER( ym2151_device::status_r ) { return read(space, 1); } - -WRITE8_MEMBER( ym2151_device::register_w ) { write(space, 0, data); } -WRITE8_MEMBER( ym2151_device::data_w ) { write(space, 1, data); } - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void ym2151_device::device_start() -{ - m_irqhandler.resolve_safe(); - m_portwritehandler.resolve_safe(); - - // stream setup - int rate = clock() / 64; - m_stream = stream_alloc(0, 2, rate); - - m_chip = ym2151_init(this, clock(), rate); - assert_always(m_chip != nullptr, "Error creating YM2151 chip"); - - ym2151_set_irq_handler(m_chip, irq_frontend); - ym2151_set_port_write_handler(m_chip, port_write_frontend); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void ym2151_device::device_reset() -{ - ym2151_reset_chip(m_chip); -} - - -//------------------------------------------------- -// device_stop - device-specific stop -//------------------------------------------------- - -void ym2151_device::device_stop() -{ - ym2151_shutdown(m_chip); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void ym2151_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - ym2151_update_one(m_chip, outputs, samples); -} - - -void ym2151_device::irq_frontend(device_t *device, int irq) -{ - downcast<ym2151_device *>(device)->m_irqhandler(irq); -} - -void ym2151_device::port_write_frontend(device_t *device, offs_t offset, UINT8 data) -{ - downcast<ym2151_device *>(device)->m_portwritehandler(offset, data); -} diff --git a/src/devices/sound/2151intf.h b/src/devices/sound/2151intf.h deleted file mode 100644 index e14892e9867..00000000000 --- a/src/devices/sound/2151intf.h +++ /dev/null @@ -1,84 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/*************************************************************************** - - 2151intf.h - - MAME interface to YM2151 emulator. - -***************************************************************************/ - -#pragma once - -#ifndef __2151INTF_H__ -#define __2151INTF_H__ - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_YM2151_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, YM2151, _clock) - -#define MCFG_YM2151_IRQ_HANDLER(_devcb) \ - devcb = &ym2151_device::set_irq_handler(*device, DEVCB_##_devcb); -#define MCFG_YM2151_PORT_WRITE_HANDLER(_devcb) \ - devcb = &ym2151_device::set_port_write_handler(*device, DEVCB_##_devcb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - - -// ======================> ym2151_device - -class ym2151_device : public device_t, - public device_sound_interface -{ -public: - // construction/destruction - ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<ym2151_device &>(device).m_irqhandler.set_callback(object); } - template<class _Object> static devcb_base &set_port_write_handler(device_t &device, _Object object) { return downcast<ym2151_device &>(device).m_portwritehandler.set_callback(object); } - - // read/write - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( register_w ); - DECLARE_WRITE8_MEMBER( data_w ); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_stop() override; - virtual void device_reset() override; - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; - -private: - // internal helpers - static void irq_frontend(device_t *device, int irq); - static void port_write_frontend(device_t *device, offs_t offset, UINT8 data); - - // internal state - sound_stream * m_stream; - //emu_timer * m_timer[2]; - void * m_chip; - UINT8 m_lastreg; - devcb_write_line m_irqhandler; - devcb_write8 m_portwritehandler; -}; - - -// device type definition -extern const device_type YM2151; - - -#endif /* __2151INTF_H__ */ diff --git a/src/devices/sound/ym2151.cpp b/src/devices/sound/ym2151.cpp index f41077b96aa..3f149267900 100644 --- a/src/devices/sound/ym2151.cpp +++ b/src/devices/sound/ym2151.cpp @@ -1,176 +1,10 @@ // license:GPL-2.0+ -// copyright-holders:Jarek Burczynski -/***************************************************************************** -* -* Yamaha YM2151 driver (version 2.150 final beta) -* -******************************************************************************/ +// copyright-holders:Jarek Burczynski,Ernesto Corvi #include "emu.h" #include "ym2151.h" - -/* undef this to not use MAME timer system */ -#define USE_MAME_TIMERS - -/*#define FM_EMU*/ -#ifdef FM_EMU - #ifdef USE_MAME_TIMERS - #undef USE_MAME_TIMERS - #endif -#endif - -#define LOG_CYM_FILE 0 -static FILE * cymfile = nullptr; - - -/* struct describing a single operator */ -struct YM2151Operator -{ - UINT32 phase; /* accumulated operator phase */ - UINT32 freq; /* operator frequency count */ - INT32 dt1; /* current DT1 (detune 1 phase inc/decrement) value */ - UINT32 mul; /* frequency count multiply */ - UINT32 dt1_i; /* DT1 index * 32 */ - UINT32 dt2; /* current DT2 (detune 2) value */ - - signed int *connect; /* operator output 'direction' */ - - /* only M1 (operator 0) is filled with this data: */ - signed int *mem_connect; /* where to put the delayed sample (MEM) */ - INT32 mem_value; /* delayed sample (MEM) value */ - - /* channel specific data; note: each operator number 0 contains channel specific data */ - UINT32 fb_shift; /* feedback shift value for operators 0 in each channel */ - INT32 fb_out_curr; /* operator feedback value (used only by operators 0) */ - INT32 fb_out_prev; /* previous feedback value (used only by operators 0) */ - UINT32 kc; /* channel KC (copied to all operators) */ - UINT32 kc_i; /* just for speedup */ - UINT32 pms; /* channel PMS */ - UINT32 ams; /* channel AMS */ - /* end of channel specific data */ - - UINT32 AMmask; /* LFO Amplitude Modulation enable mask */ - UINT32 state; /* Envelope state: 4-attack(AR) 3-decay(D1R) 2-sustain(D2R) 1-release(RR) 0-off */ - UINT8 eg_sh_ar; /* (attack state) */ - UINT8 eg_sel_ar; /* (attack state) */ - UINT32 tl; /* Total attenuation Level */ - INT32 volume; /* current envelope attenuation level */ - UINT8 eg_sh_d1r; /* (decay state) */ - UINT8 eg_sel_d1r; /* (decay state) */ - UINT32 d1l; /* envelope switches to sustain state after reaching this level */ - UINT8 eg_sh_d2r; /* (sustain state) */ - UINT8 eg_sel_d2r; /* (sustain state) */ - UINT8 eg_sh_rr; /* (release state) */ - UINT8 eg_sel_rr; /* (release state) */ - - UINT32 key; /* 0=last key was KEY OFF, 1=last key was KEY ON */ - - UINT32 ks; /* key scale */ - UINT32 ar; /* attack rate */ - UINT32 d1r; /* decay rate */ - UINT32 d2r; /* sustain rate */ - UINT32 rr; /* release rate */ - - UINT32 reserved0; /**/ - UINT32 reserved1; /**/ - -}; - - -struct YM2151 -{ - signed int chanout[8]; - signed int m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */ - signed int mem; /* one sample delay memory */ - - YM2151Operator oper[32]; /* the 32 operators */ - - UINT32 pan[16]; /* channels output masks (0xffffffff = enable) */ - - UINT32 eg_cnt; /* global envelope generator counter */ - UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/64/3 */ - UINT32 eg_timer_add; /* step of eg_timer */ - UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 3 samples (on real chip) */ - - UINT32 lfo_phase; /* accumulated LFO phase (0 to 255) */ - UINT32 lfo_timer; /* LFO timer */ - UINT32 lfo_timer_add; /* step of lfo_timer */ - UINT32 lfo_overflow; /* LFO generates new output when lfo_timer reaches this value */ - UINT32 lfo_counter; /* LFO phase increment counter */ - UINT32 lfo_counter_add; /* step of lfo_counter */ - UINT8 lfo_wsel; /* LFO waveform (0-saw, 1-square, 2-triangle, 3-random noise) */ - UINT8 amd; /* LFO Amplitude Modulation Depth */ - INT8 pmd; /* LFO Phase Modulation Depth */ - UINT32 lfa; /* LFO current AM output */ - INT32 lfp; /* LFO current PM output */ - - UINT8 test; /* TEST register */ - UINT8 ct; /* output control pins (bit1-CT2, bit0-CT1) */ - - UINT32 noise; /* noise enable/period register (bit 7 - noise enable, bits 4-0 - noise period */ - UINT32 noise_rng; /* 17 bit noise shift register */ - UINT32 noise_p; /* current noise 'phase'*/ - UINT32 noise_f; /* current noise period */ - - UINT32 csm_req; /* CSM KEY ON / KEY OFF sequence request */ - - UINT32 irq_enable; /* IRQ enable for timer B (bit 3) and timer A (bit 2); bit 7 - CSM mode (keyon to all slots, everytime timer A overflows) */ - UINT32 status; /* chip status (BUSY, IRQ Flags) */ - UINT8 connect[8]; /* channels connections */ - -#ifdef USE_MAME_TIMERS -/* ASG 980324 -- added for tracking timers */ - emu_timer *timer_A; - emu_timer *timer_B; - attotime timer_A_time[1024]; /* timer A times for MAME */ - attotime timer_B_time[256]; /* timer B times for MAME */ - int irqlinestate; -#else - UINT8 tim_A; /* timer A enable (0-disabled) */ - UINT8 tim_B; /* timer B enable (0-disabled) */ - INT32 tim_A_val; /* current value of timer A */ - INT32 tim_B_val; /* current value of timer B */ - UINT32 tim_A_tab[1024]; /* timer A deltas */ - UINT32 tim_B_tab[256]; /* timer B deltas */ -#endif - UINT32 timer_A_index; /* timer A index */ - UINT32 timer_B_index; /* timer B index */ - UINT32 timer_A_index_old; /* timer A previous index */ - UINT32 timer_B_index_old; /* timer B previous index */ - - /* Frequency-deltas to get the closest frequency possible. - * There are 11 octaves because of DT2 (max 950 cents over base frequency) - * and LFO phase modulation (max 800 cents below AND over base frequency) - * Summary: octave explanation - * 0 note code - LFO PM - * 1 note code - * 2 note code - * 3 note code - * 4 note code - * 5 note code - * 6 note code - * 7 note code - * 8 note code - * 9 note code + DT2 + LFO PM - * 10 note code + DT2 + LFO PM - */ - UINT32 freq[11*768]; /* 11 octaves, 768 'cents' per octave */ - - /* Frequency deltas for DT1. These deltas alter operator frequency - * after it has been taken from frequency-deltas table. - */ - INT32 dt1_freq[8*32]; /* 8 DT1 levels, 32 KC values */ - - UINT32 noise_tab[32]; /* 17bit Noise Generator periods */ - - void (*irqhandler)(device_t *device, int irq); /* IRQ function handler */ - void (*porthandler)(device_t *, offs_t, UINT8); /* port write function handler */ - - device_t *device; - unsigned int clock; /* chip clock in Hz (passed from 2151intf.c) */ - unsigned int sampfreq; /* sampling frequency in Hz (passed from 2151intf.c) */ -}; +const device_type YM2151 = &device_creator<ym2151_device>; #define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */ @@ -193,114 +27,80 @@ struct YM2151 #define EG_REL 1 #define EG_OFF 0 -#define SIN_BITS 10 -#define SIN_LEN (1<<SIN_BITS) -#define SIN_MASK (SIN_LEN-1) - -#define TL_RES_LEN (256) /* 8 bits addressing (real chip) */ - - -#if (SAMPLE_BITS==16) - #define FINAL_SH (0) - #define MAXOUT (+32767) - #define MINOUT (-32768) -#else - #define FINAL_SH (8) - #define MAXOUT (+127) - #define MINOUT (-128) -#endif - - -/* TL_TAB_LEN is calculated as: -* 13 - sinus amplitude bits (Y axis) -* 2 - sinus sign bit (Y axis) -* TL_RES_LEN - sinus resolution (X axis) -*/ -#define TL_TAB_LEN (13*2*TL_RES_LEN) -static signed int tl_tab[TL_TAB_LEN]; #define ENV_QUIET (TL_TAB_LEN>>3) -/* sin waveform table in 'decibel' scale */ -static unsigned int sin_tab[SIN_LEN]; +const UINT8 ym2151_device::eg_inc[19*RATE_STEPS] = { + /*cycle:0 1 2 3 4 5 6 7*/ -/* translate from D1L to volume index (16 D1L levels) */ -static UINT32 d1l_tab[16]; + /* 0 */ 0,1, 0,1, 0,1, 0,1, /* rates 00..11 0 (increment by 0 or 1) */ + /* 1 */ 0,1, 0,1, 1,1, 0,1, /* rates 00..11 1 */ + /* 2 */ 0,1, 1,1, 0,1, 1,1, /* rates 00..11 2 */ + /* 3 */ 0,1, 1,1, 1,1, 1,1, /* rates 00..11 3 */ + /* 4 */ 1,1, 1,1, 1,1, 1,1, /* rate 12 0 (increment by 1) */ + /* 5 */ 1,1, 1,2, 1,1, 1,2, /* rate 12 1 */ + /* 6 */ 1,2, 1,2, 1,2, 1,2, /* rate 12 2 */ + /* 7 */ 1,2, 2,2, 1,2, 2,2, /* rate 12 3 */ -#define RATE_STEPS (8) -static const UINT8 eg_inc[19*RATE_STEPS]={ -/*cycle:0 1 2 3 4 5 6 7*/ + /* 8 */ 2,2, 2,2, 2,2, 2,2, /* rate 13 0 (increment by 2) */ + /* 9 */ 2,2, 2,4, 2,2, 2,4, /* rate 13 1 */ + /*10 */ 2,4, 2,4, 2,4, 2,4, /* rate 13 2 */ + /*11 */ 2,4, 4,4, 2,4, 4,4, /* rate 13 3 */ -/* 0 */ 0,1, 0,1, 0,1, 0,1, /* rates 00..11 0 (increment by 0 or 1) */ -/* 1 */ 0,1, 0,1, 1,1, 0,1, /* rates 00..11 1 */ -/* 2 */ 0,1, 1,1, 0,1, 1,1, /* rates 00..11 2 */ -/* 3 */ 0,1, 1,1, 1,1, 1,1, /* rates 00..11 3 */ + /*12 */ 4,4, 4,4, 4,4, 4,4, /* rate 14 0 (increment by 4) */ + /*13 */ 4,4, 4,8, 4,4, 4,8, /* rate 14 1 */ + /*14 */ 4,8, 4,8, 4,8, 4,8, /* rate 14 2 */ + /*15 */ 4,8, 8,8, 4,8, 8,8, /* rate 14 3 */ -/* 4 */ 1,1, 1,1, 1,1, 1,1, /* rate 12 0 (increment by 1) */ -/* 5 */ 1,1, 1,2, 1,1, 1,2, /* rate 12 1 */ -/* 6 */ 1,2, 1,2, 1,2, 1,2, /* rate 12 2 */ -/* 7 */ 1,2, 2,2, 1,2, 2,2, /* rate 12 3 */ - -/* 8 */ 2,2, 2,2, 2,2, 2,2, /* rate 13 0 (increment by 2) */ -/* 9 */ 2,2, 2,4, 2,2, 2,4, /* rate 13 1 */ -/*10 */ 2,4, 2,4, 2,4, 2,4, /* rate 13 2 */ -/*11 */ 2,4, 4,4, 2,4, 4,4, /* rate 13 3 */ - -/*12 */ 4,4, 4,4, 4,4, 4,4, /* rate 14 0 (increment by 4) */ -/*13 */ 4,4, 4,8, 4,4, 4,8, /* rate 14 1 */ -/*14 */ 4,8, 4,8, 4,8, 4,8, /* rate 14 2 */ -/*15 */ 4,8, 8,8, 4,8, 8,8, /* rate 14 3 */ - -/*16 */ 8,8, 8,8, 8,8, 8,8, /* rates 15 0, 15 1, 15 2, 15 3 (increment by 8) */ -/*17 */ 16,16,16,16,16,16,16,16, /* rates 15 2, 15 3 for attack */ -/*18 */ 0,0, 0,0, 0,0, 0,0, /* infinity rates for attack and decay(s) */ + /*16 */ 8,8, 8,8, 8,8, 8,8, /* rates 15 0, 15 1, 15 2, 15 3 (increment by 8) */ + /*17 */ 16,16,16,16,16,16,16,16, /* rates 15 2, 15 3 for attack */ + /*18 */ 0,0, 0,0, 0,0, 0,0, /* infinity rates for attack and decay(s) */ }; #define O(a) (a*RATE_STEPS) /*note that there is no O(17) in this table - it's directly in the code */ -static const UINT8 eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ -/* 32 dummy (infinite time) rates */ -O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), -O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), -O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), -O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), - -/* rates 00-11 */ -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), -O( 0),O( 1),O( 2),O( 3), - -/* rate 12 */ -O( 4),O( 5),O( 6),O( 7), - -/* rate 13 */ -O( 8),O( 9),O(10),O(11), - -/* rate 14 */ -O(12),O(13),O(14),O(15), - -/* rate 15 */ -O(16),O(16),O(16),O(16), - -/* 32 dummy rates (same as 15 3) */ -O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), -O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), -O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), -O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16) - +const UINT8 ym2151_device::eg_rate_select[32+64+32] = { /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ + /* 32 dummy (infinite time) rates */ + O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), + O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), + O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), + O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), + + /* rates 00-11 */ + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + O( 0),O( 1),O( 2),O( 3), + + /* rate 12 */ + O( 4),O( 5),O( 6),O( 7), + + /* rate 13 */ + O( 8),O( 9),O(10),O(11), + + /* rate 14 */ + O(12),O(13),O(14),O(15), + + /* rate 15 */ + O(16),O(16),O(16),O(16), + + /* 32 dummy rates (same as 15 3) */ + O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), + O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), + O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16), + O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16) }; #undef O @@ -309,46 +109,44 @@ O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16) /*mask 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0, 0, 0 */ #define O(a) (a*1) -static const UINT8 eg_rate_shift[32+64+32]={ /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ -/* 32 infinite time rates */ -O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), -O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), -O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), -O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), - - -/* rates 00-11 */ -O(11),O(11),O(11),O(11), -O(10),O(10),O(10),O(10), -O( 9),O( 9),O( 9),O( 9), -O( 8),O( 8),O( 8),O( 8), -O( 7),O( 7),O( 7),O( 7), -O( 6),O( 6),O( 6),O( 6), -O( 5),O( 5),O( 5),O( 5), -O( 4),O( 4),O( 4),O( 4), -O( 3),O( 3),O( 3),O( 3), -O( 2),O( 2),O( 2),O( 2), -O( 1),O( 1),O( 1),O( 1), -O( 0),O( 0),O( 0),O( 0), - -/* rate 12 */ -O( 0),O( 0),O( 0),O( 0), - -/* rate 13 */ -O( 0),O( 0),O( 0),O( 0), - -/* rate 14 */ -O( 0),O( 0),O( 0),O( 0), - -/* rate 15 */ -O( 0),O( 0),O( 0),O( 0), - -/* 32 dummy rates (same as 15 3) */ -O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), -O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), -O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), -O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0) - +const UINT8 ym2151_device::eg_rate_shift[32+64+32] = { /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ + /* 32 infinite time rates */ + O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), + O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), + O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), + O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), + + /* rates 00-11 */ + O(11),O(11),O(11),O(11), + O(10),O(10),O(10),O(10), + O( 9),O( 9),O( 9),O( 9), + O( 8),O( 8),O( 8),O( 8), + O( 7),O( 7),O( 7),O( 7), + O( 6),O( 6),O( 6),O( 6), + O( 5),O( 5),O( 5),O( 5), + O( 4),O( 4),O( 4),O( 4), + O( 3),O( 3),O( 3),O( 3), + O( 2),O( 2),O( 2),O( 2), + O( 1),O( 1),O( 1),O( 1), + O( 0),O( 0),O( 0),O( 0), + + /* rate 12 */ + O( 0),O( 0),O( 0),O( 0), + + /* rate 13 */ + O( 0),O( 0),O( 0),O( 0), + + /* rate 14 */ + O( 0),O( 0),O( 0),O( 0), + + /* rate 15 */ + O( 0),O( 0),O( 0),O( 0), + + /* 32 dummy rates (same as 15 3) */ + O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), + O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), + O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), + O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0) }; #undef O @@ -362,14 +160,14 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0) * DT2=0 DT2=1 DT2=2 DT2=3 * 0 600 781 950 */ -static const UINT32 dt2_tab[4] = { 0, 384, 500, 608 }; +const UINT32 ym2151_device::dt2_tab[4] = { 0, 384, 500, 608 }; /* DT1 defines offset in Hertz from base note * This table is converted while initialization... * Detune table shown in YM2151 User's Manual is wrong (verified on the real chip) */ -static const UINT8 dt1_tab[4*32] = { /* 4*32 DT1 values */ +const UINT8 ym2151_device::dt1_tab[4*32] = { /* 4*32 DT1 values */ /* DT1=0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -387,55 +185,55 @@ static const UINT8 dt1_tab[4*32] = { /* 4*32 DT1 values */ 8, 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 }; -static const UINT16 phaseinc_rom[768]={ -1299,1300,1301,1302,1303,1304,1305,1306,1308,1309,1310,1311,1313,1314,1315,1316, -1318,1319,1320,1321,1322,1323,1324,1325,1327,1328,1329,1330,1332,1333,1334,1335, -1337,1338,1339,1340,1341,1342,1343,1344,1346,1347,1348,1349,1351,1352,1353,1354, -1356,1357,1358,1359,1361,1362,1363,1364,1366,1367,1368,1369,1371,1372,1373,1374, -1376,1377,1378,1379,1381,1382,1383,1384,1386,1387,1388,1389,1391,1392,1393,1394, -1396,1397,1398,1399,1401,1402,1403,1404,1406,1407,1408,1409,1411,1412,1413,1414, -1416,1417,1418,1419,1421,1422,1423,1424,1426,1427,1429,1430,1431,1432,1434,1435, -1437,1438,1439,1440,1442,1443,1444,1445,1447,1448,1449,1450,1452,1453,1454,1455, -1458,1459,1460,1461,1463,1464,1465,1466,1468,1469,1471,1472,1473,1474,1476,1477, -1479,1480,1481,1482,1484,1485,1486,1487,1489,1490,1492,1493,1494,1495,1497,1498, -1501,1502,1503,1504,1506,1507,1509,1510,1512,1513,1514,1515,1517,1518,1520,1521, -1523,1524,1525,1526,1528,1529,1531,1532,1534,1535,1536,1537,1539,1540,1542,1543, -1545,1546,1547,1548,1550,1551,1553,1554,1556,1557,1558,1559,1561,1562,1564,1565, -1567,1568,1569,1570,1572,1573,1575,1576,1578,1579,1580,1581,1583,1584,1586,1587, -1590,1591,1592,1593,1595,1596,1598,1599,1601,1602,1604,1605,1607,1608,1609,1610, -1613,1614,1615,1616,1618,1619,1621,1622,1624,1625,1627,1628,1630,1631,1632,1633, -1637,1638,1639,1640,1642,1643,1645,1646,1648,1649,1651,1652,1654,1655,1656,1657, -1660,1661,1663,1664,1666,1667,1669,1670,1672,1673,1675,1676,1678,1679,1681,1682, -1685,1686,1688,1689,1691,1692,1694,1695,1697,1698,1700,1701,1703,1704,1706,1707, -1709,1710,1712,1713,1715,1716,1718,1719,1721,1722,1724,1725,1727,1728,1730,1731, -1734,1735,1737,1738,1740,1741,1743,1744,1746,1748,1749,1751,1752,1754,1755,1757, -1759,1760,1762,1763,1765,1766,1768,1769,1771,1773,1774,1776,1777,1779,1780,1782, -1785,1786,1788,1789,1791,1793,1794,1796,1798,1799,1801,1802,1804,1806,1807,1809, -1811,1812,1814,1815,1817,1819,1820,1822,1824,1825,1827,1828,1830,1832,1833,1835, -1837,1838,1840,1841,1843,1845,1846,1848,1850,1851,1853,1854,1856,1858,1859,1861, -1864,1865,1867,1868,1870,1872,1873,1875,1877,1879,1880,1882,1884,1885,1887,1888, -1891,1892,1894,1895,1897,1899,1900,1902,1904,1906,1907,1909,1911,1912,1914,1915, -1918,1919,1921,1923,1925,1926,1928,1930,1932,1933,1935,1937,1939,1940,1942,1944, -1946,1947,1949,1951,1953,1954,1956,1958,1960,1961,1963,1965,1967,1968,1970,1972, -1975,1976,1978,1980,1982,1983,1985,1987,1989,1990,1992,1994,1996,1997,1999,2001, -2003,2004,2006,2008,2010,2011,2013,2015,2017,2019,2021,2022,2024,2026,2028,2029, -2032,2033,2035,2037,2039,2041,2043,2044,2047,2048,2050,2052,2054,2056,2058,2059, -2062,2063,2065,2067,2069,2071,2073,2074,2077,2078,2080,2082,2084,2086,2088,2089, -2092,2093,2095,2097,2099,2101,2103,2104,2107,2108,2110,2112,2114,2116,2118,2119, -2122,2123,2125,2127,2129,2131,2133,2134,2137,2139,2141,2142,2145,2146,2148,2150, -2153,2154,2156,2158,2160,2162,2164,2165,2168,2170,2172,2173,2176,2177,2179,2181, -2185,2186,2188,2190,2192,2194,2196,2197,2200,2202,2204,2205,2208,2209,2211,2213, -2216,2218,2220,2222,2223,2226,2227,2230,2232,2234,2236,2238,2239,2242,2243,2246, -2249,2251,2253,2255,2256,2259,2260,2263,2265,2267,2269,2271,2272,2275,2276,2279, -2281,2283,2285,2287,2288,2291,2292,2295,2297,2299,2301,2303,2304,2307,2308,2311, -2315,2317,2319,2321,2322,2325,2326,2329,2331,2333,2335,2337,2338,2341,2342,2345, -2348,2350,2352,2354,2355,2358,2359,2362,2364,2366,2368,2370,2371,2374,2375,2378, -2382,2384,2386,2388,2389,2392,2393,2396,2398,2400,2402,2404,2407,2410,2411,2414, -2417,2419,2421,2423,2424,2427,2428,2431,2433,2435,2437,2439,2442,2445,2446,2449, -2452,2454,2456,2458,2459,2462,2463,2466,2468,2470,2472,2474,2477,2480,2481,2484, -2488,2490,2492,2494,2495,2498,2499,2502,2504,2506,2508,2510,2513,2516,2517,2520, -2524,2526,2528,2530,2531,2534,2535,2538,2540,2542,2544,2546,2549,2552,2553,2556, -2561,2563,2565,2567,2568,2571,2572,2575,2577,2579,2581,2583,2586,2589,2590,2593 +const UINT16 ym2151_device::phaseinc_rom[768] = { + 1299,1300,1301,1302,1303,1304,1305,1306,1308,1309,1310,1311,1313,1314,1315,1316, + 1318,1319,1320,1321,1322,1323,1324,1325,1327,1328,1329,1330,1332,1333,1334,1335, + 1337,1338,1339,1340,1341,1342,1343,1344,1346,1347,1348,1349,1351,1352,1353,1354, + 1356,1357,1358,1359,1361,1362,1363,1364,1366,1367,1368,1369,1371,1372,1373,1374, + 1376,1377,1378,1379,1381,1382,1383,1384,1386,1387,1388,1389,1391,1392,1393,1394, + 1396,1397,1398,1399,1401,1402,1403,1404,1406,1407,1408,1409,1411,1412,1413,1414, + 1416,1417,1418,1419,1421,1422,1423,1424,1426,1427,1429,1430,1431,1432,1434,1435, + 1437,1438,1439,1440,1442,1443,1444,1445,1447,1448,1449,1450,1452,1453,1454,1455, + 1458,1459,1460,1461,1463,1464,1465,1466,1468,1469,1471,1472,1473,1474,1476,1477, + 1479,1480,1481,1482,1484,1485,1486,1487,1489,1490,1492,1493,1494,1495,1497,1498, + 1501,1502,1503,1504,1506,1507,1509,1510,1512,1513,1514,1515,1517,1518,1520,1521, + 1523,1524,1525,1526,1528,1529,1531,1532,1534,1535,1536,1537,1539,1540,1542,1543, + 1545,1546,1547,1548,1550,1551,1553,1554,1556,1557,1558,1559,1561,1562,1564,1565, + 1567,1568,1569,1570,1572,1573,1575,1576,1578,1579,1580,1581,1583,1584,1586,1587, + 1590,1591,1592,1593,1595,1596,1598,1599,1601,1602,1604,1605,1607,1608,1609,1610, + 1613,1614,1615,1616,1618,1619,1621,1622,1624,1625,1627,1628,1630,1631,1632,1633, + 1637,1638,1639,1640,1642,1643,1645,1646,1648,1649,1651,1652,1654,1655,1656,1657, + 1660,1661,1663,1664,1666,1667,1669,1670,1672,1673,1675,1676,1678,1679,1681,1682, + 1685,1686,1688,1689,1691,1692,1694,1695,1697,1698,1700,1701,1703,1704,1706,1707, + 1709,1710,1712,1713,1715,1716,1718,1719,1721,1722,1724,1725,1727,1728,1730,1731, + 1734,1735,1737,1738,1740,1741,1743,1744,1746,1748,1749,1751,1752,1754,1755,1757, + 1759,1760,1762,1763,1765,1766,1768,1769,1771,1773,1774,1776,1777,1779,1780,1782, + 1785,1786,1788,1789,1791,1793,1794,1796,1798,1799,1801,1802,1804,1806,1807,1809, + 1811,1812,1814,1815,1817,1819,1820,1822,1824,1825,1827,1828,1830,1832,1833,1835, + 1837,1838,1840,1841,1843,1845,1846,1848,1850,1851,1853,1854,1856,1858,1859,1861, + 1864,1865,1867,1868,1870,1872,1873,1875,1877,1879,1880,1882,1884,1885,1887,1888, + 1891,1892,1894,1895,1897,1899,1900,1902,1904,1906,1907,1909,1911,1912,1914,1915, + 1918,1919,1921,1923,1925,1926,1928,1930,1932,1933,1935,1937,1939,1940,1942,1944, + 1946,1947,1949,1951,1953,1954,1956,1958,1960,1961,1963,1965,1967,1968,1970,1972, + 1975,1976,1978,1980,1982,1983,1985,1987,1989,1990,1992,1994,1996,1997,1999,2001, + 2003,2004,2006,2008,2010,2011,2013,2015,2017,2019,2021,2022,2024,2026,2028,2029, + 2032,2033,2035,2037,2039,2041,2043,2044,2047,2048,2050,2052,2054,2056,2058,2059, + 2062,2063,2065,2067,2069,2071,2073,2074,2077,2078,2080,2082,2084,2086,2088,2089, + 2092,2093,2095,2097,2099,2101,2103,2104,2107,2108,2110,2112,2114,2116,2118,2119, + 2122,2123,2125,2127,2129,2131,2133,2134,2137,2139,2141,2142,2145,2146,2148,2150, + 2153,2154,2156,2158,2160,2162,2164,2165,2168,2170,2172,2173,2176,2177,2179,2181, + 2185,2186,2188,2190,2192,2194,2196,2197,2200,2202,2204,2205,2208,2209,2211,2213, + 2216,2218,2220,2222,2223,2226,2227,2230,2232,2234,2236,2238,2239,2242,2243,2246, + 2249,2251,2253,2255,2256,2259,2260,2263,2265,2267,2269,2271,2272,2275,2276,2279, + 2281,2283,2285,2287,2288,2291,2292,2295,2297,2299,2301,2303,2304,2307,2308,2311, + 2315,2317,2319,2321,2322,2325,2326,2329,2331,2333,2335,2337,2338,2341,2342,2345, + 2348,2350,2352,2354,2355,2358,2359,2362,2364,2366,2368,2370,2371,2374,2375,2378, + 2382,2384,2386,2388,2389,2392,2393,2396,2398,2400,2402,2404,2407,2410,2411,2414, + 2417,2419,2421,2423,2424,2427,2428,2431,2433,2435,2437,2439,2442,2445,2446,2449, + 2452,2454,2456,2458,2459,2462,2463,2466,2468,2470,2472,2474,2477,2480,2481,2484, + 2488,2490,2492,2494,2495,2498,2499,2502,2504,2506,2508,2510,2513,2516,2517,2520, + 2524,2526,2528,2530,2531,2534,2535,2538,2540,2542,2544,2546,2549,2552,2553,2556, + 2561,2563,2565,2567,2568,2571,2572,2575,2577,2579,2581,2583,2586,2589,2590,2593 }; @@ -457,55 +255,42 @@ static const UINT16 phaseinc_rom[768]={ some 0x80 could be 0x81 as well as some 0x00 could be 0x01. */ -static const UINT8 lfo_noise_waveform[256] = { -0xFF,0xEE,0xD3,0x80,0x58,0xDA,0x7F,0x94,0x9E,0xE3,0xFA,0x00,0x4D,0xFA,0xFF,0x6A, -0x7A,0xDE,0x49,0xF6,0x00,0x33,0xBB,0x63,0x91,0x60,0x51,0xFF,0x00,0xD8,0x7F,0xDE, -0xDC,0x73,0x21,0x85,0xB2,0x9C,0x5D,0x24,0xCD,0x91,0x9E,0x76,0x7F,0x20,0xFB,0xF3, -0x00,0xA6,0x3E,0x42,0x27,0x69,0xAE,0x33,0x45,0x44,0x11,0x41,0x72,0x73,0xDF,0xA2, - -0x32,0xBD,0x7E,0xA8,0x13,0xEB,0xD3,0x15,0xDD,0xFB,0xC9,0x9D,0x61,0x2F,0xBE,0x9D, -0x23,0x65,0x51,0x6A,0x84,0xF9,0xC9,0xD7,0x23,0xBF,0x65,0x19,0xDC,0x03,0xF3,0x24, -0x33,0xB6,0x1E,0x57,0x5C,0xAC,0x25,0x89,0x4D,0xC5,0x9C,0x99,0x15,0x07,0xCF,0xBA, -0xC5,0x9B,0x15,0x4D,0x8D,0x2A,0x1E,0x1F,0xEA,0x2B,0x2F,0x64,0xA9,0x50,0x3D,0xAB, - -0x50,0x77,0xE9,0xC0,0xAC,0x6D,0x3F,0xCA,0xCF,0x71,0x7D,0x80,0xA6,0xFD,0xFF,0xB5, -0xBD,0x6F,0x24,0x7B,0x00,0x99,0x5D,0xB1,0x48,0xB0,0x28,0x7F,0x80,0xEC,0xBF,0x6F, -0x6E,0x39,0x90,0x42,0xD9,0x4E,0x2E,0x12,0x66,0xC8,0xCF,0x3B,0x3F,0x10,0x7D,0x79, -0x00,0xD3,0x1F,0x21,0x93,0x34,0xD7,0x19,0x22,0xA2,0x08,0x20,0xB9,0xB9,0xEF,0x51, - -0x99,0xDE,0xBF,0xD4,0x09,0x75,0xE9,0x8A,0xEE,0xFD,0xE4,0x4E,0x30,0x17,0xDF,0xCE, -0x11,0xB2,0x28,0x35,0xC2,0x7C,0x64,0xEB,0x91,0x5F,0x32,0x0C,0x6E,0x00,0xF9,0x92, -0x19,0xDB,0x8F,0xAB,0xAE,0xD6,0x12,0xC4,0x26,0x62,0xCE,0xCC,0x0A,0x03,0xE7,0xDD, -0xE2,0x4D,0x8A,0xA6,0x46,0x95,0x0F,0x8F,0xF5,0x15,0x97,0x32,0xD4,0x28,0x1E,0x55 +const UINT8 ym2151_device::lfo_noise_waveform[256] = { + 0xFF,0xEE,0xD3,0x80,0x58,0xDA,0x7F,0x94,0x9E,0xE3,0xFA,0x00,0x4D,0xFA,0xFF,0x6A, + 0x7A,0xDE,0x49,0xF6,0x00,0x33,0xBB,0x63,0x91,0x60,0x51,0xFF,0x00,0xD8,0x7F,0xDE, + 0xDC,0x73,0x21,0x85,0xB2,0x9C,0x5D,0x24,0xCD,0x91,0x9E,0x76,0x7F,0x20,0xFB,0xF3, + 0x00,0xA6,0x3E,0x42,0x27,0x69,0xAE,0x33,0x45,0x44,0x11,0x41,0x72,0x73,0xDF,0xA2, + + 0x32,0xBD,0x7E,0xA8,0x13,0xEB,0xD3,0x15,0xDD,0xFB,0xC9,0x9D,0x61,0x2F,0xBE,0x9D, + 0x23,0x65,0x51,0x6A,0x84,0xF9,0xC9,0xD7,0x23,0xBF,0x65,0x19,0xDC,0x03,0xF3,0x24, + 0x33,0xB6,0x1E,0x57,0x5C,0xAC,0x25,0x89,0x4D,0xC5,0x9C,0x99,0x15,0x07,0xCF,0xBA, + 0xC5,0x9B,0x15,0x4D,0x8D,0x2A,0x1E,0x1F,0xEA,0x2B,0x2F,0x64,0xA9,0x50,0x3D,0xAB, + + 0x50,0x77,0xE9,0xC0,0xAC,0x6D,0x3F,0xCA,0xCF,0x71,0x7D,0x80,0xA6,0xFD,0xFF,0xB5, + 0xBD,0x6F,0x24,0x7B,0x00,0x99,0x5D,0xB1,0x48,0xB0,0x28,0x7F,0x80,0xEC,0xBF,0x6F, + 0x6E,0x39,0x90,0x42,0xD9,0x4E,0x2E,0x12,0x66,0xC8,0xCF,0x3B,0x3F,0x10,0x7D,0x79, + 0x00,0xD3,0x1F,0x21,0x93,0x34,0xD7,0x19,0x22,0xA2,0x08,0x20,0xB9,0xB9,0xEF,0x51, + + 0x99,0xDE,0xBF,0xD4,0x09,0x75,0xE9,0x8A,0xEE,0xFD,0xE4,0x4E,0x30,0x17,0xDF,0xCE, + 0x11,0xB2,0x28,0x35,0xC2,0x7C,0x64,0xEB,0x91,0x5F,0x32,0x0C,0x6E,0x00,0xF9,0x92, + 0x19,0xDB,0x8F,0xAB,0xAE,0xD6,0x12,0xC4,0x26,0x62,0xCE,0xCC,0x0A,0x03,0xE7,0xDD, + 0xE2,0x4D,0x8A,0xA6,0x46,0x95,0x0F,0x8F,0xF5,0x15,0x97,0x32,0xD4,0x28,0x1E,0x55 }; -/* save output as raw 16-bit sample */ -/* #define SAVE_SAMPLE */ -/* #define SAVE_SEPARATE_CHANNELS */ -#if defined SAVE_SAMPLE || defined SAVE_SEPARATE_CHANNELS -static FILE *sample[9]; -#endif - - - -static void init_tables(void) +void ym2151_device::init_tables() { - signed int i,x,n; - double o,m; - - for (x=0; x<TL_RES_LEN; x++) + for (int x=0; x<TL_RES_LEN; x++) { - m = (1<<16) / pow(2, (x+1) * (ENV_STEP/4.0) / 8.0); - m = floor(m); + double m = floor(1<<16) / pow(2, (x+1) * (ENV_STEP/4.0) / 8.0); /* we never reach (1<<16) here due to the (x+1) */ /* result fits within 16 bits at maximum */ - n = (int)m; /* 16 bits here */ + int n = (int)m; /* 16 bits here */ n >>= 4; /* 12 bits here */ if (n&1) /* round to closest */ n = (n>>1)+1; @@ -516,348 +301,152 @@ static void init_tables(void) tl_tab[ x*2 + 0 ] = n; tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ]; - for (i=1; i<13; i++) + for (int i=1; i<13; i++) { tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i; tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ]; } - #if 0 - logerror("tl %04i", x*2); - for (i=0; i<13; i++) - logerror(", [%02i] %4i", i*2, tl_tab[ x*2 /*+1*/ + i*2*TL_RES_LEN ]); - logerror("\n"); - #endif } - /*logerror("TL_TAB_LEN = %i (%i bytes)\n",TL_TAB_LEN, (int)sizeof(tl_tab));*/ - /*logerror("ENV_QUIET= %i\n",ENV_QUIET );*/ - - for (i=0; i<SIN_LEN; i++) + for (int i=0; i<SIN_LEN; i++) { /* non-standard sinus */ - m = sin( ((i*2)+1) * M_PI / SIN_LEN ); /* verified on the real chip */ + double m = sin( ((i*2)+1) * M_PI / SIN_LEN ); /* verified on the real chip */ /* we never reach zero here due to ((i*2)+1) */ - if (m>0.0) - o = 8*log(1.0/m)/log(2.0); /* convert to 'decibels' */ - else - o = 8*log(-1.0/m)/log(2.0); /* convert to 'decibels' */ + /* convert to 'decibels' */ + double o = 8*log(1.0/fabs(m))/log(2.0); o = o / (ENV_STEP/4); - n = (int)(2.0*o); + int n = (int)(2.0*o); if (n&1) /* round to closest */ n = (n>>1)+1; else n = n>>1; sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 ); - /*logerror("sin [0x%4x]= %4i (tl_tab value=%8x)\n", i, sin_tab[i],tl_tab[sin_tab[i]]);*/ } - /* calculate d1l_tab table */ - for (i=0; i<16; i++) + for (int i=0; i<16; i++) { - m = (i!=15 ? i : i+16) * (4.0/ENV_STEP); /* every 3 'dB' except for all bits = 1 = 45+48 'dB' */ - d1l_tab[i] = m; - /*logerror("d1l_tab[%02x]=%08x\n",i,d1l_tab[i] );*/ + d1l_tab[i] = (i!=15 ? i : i+16) * (4.0/ENV_STEP); /* every 3 'dB' except for all bits = 1 = 45+48 'dB' */ } -#ifdef SAVE_SAMPLE - sample[8]=fopen("sampsum.pcm","wb"); -#endif -#ifdef SAVE_SEPARATE_CHANNELS - sample[0]=fopen("samp0.pcm","wb"); - sample[1]=fopen("samp1.pcm","wb"); - sample[2]=fopen("samp2.pcm","wb"); - sample[3]=fopen("samp3.pcm","wb"); - sample[4]=fopen("samp4.pcm","wb"); - sample[5]=fopen("samp5.pcm","wb"); - sample[6]=fopen("samp6.pcm","wb"); - sample[7]=fopen("samp7.pcm","wb"); -#endif -} - - -static void init_chip_tables(YM2151 *chip) -{ - int i,j; - double mult,phaseinc,Hz; - double scaler; - attotime pom; - - scaler = ( (double)chip->clock / 64.0 ) / ( (double)chip->sampfreq ); - /*logerror("scaler = %20.15f\n", scaler);*/ - - /* this loop calculates Hertz values for notes from c-0 to b-7 */ /* including 64 'cents' (100/64 that is 1.5625 of real cent) per note */ /* i*100/64/1200 is equal to i/768 */ /* real chip works with 10 bits fixed point values (10.10) */ - mult = (1<<(FREQ_SH-10)); /* -10 because phaseinc_rom table values are already in 10.10 format */ - for (i=0; i<768; i++) + for (int i=0; i<768; i++) { -#if 0 - /* 3.4375 Hz is note A; C# is 4 semitones higher */ - Hz = 1000; - /* Hz is close, but not perfect */ - //Hz = scaler * 3.4375 * pow (2, (i + 4 * 64 ) / 768.0 ); - /* calculate phase increment */ - phaseinc = (Hz*SIN_LEN) / (double)chip->sampfreq; -#endif - - phaseinc = phaseinc_rom[i]; /* real chip phase increment */ - phaseinc *= scaler; /* adjust */ - - /* octave 2 - reference octave */ - chip->freq[ 768+2*768+i ] = ((int)(phaseinc*mult)) & 0xffffffc0; /* adjust to X.10 fixed point */ + freq[ 768+2*768+i ] = (phaseinc_rom[i] << (FREQ_SH - 10)) & 0xffffffc0; /* adjust to X.10 fixed point */ /* octave 0 and octave 1 */ - for (j=0; j<2; j++) + for (int j=0; j<2; j++) { - chip->freq[768 + j*768 + i] = (chip->freq[ 768+2*768+i ] >> (2-j) ) & 0xffffffc0; /* adjust to X.10 fixed point */ + freq[768 + j*768 + i] = (freq[ 768+2*768+i ] >> (2-j) ) & 0xffffffc0; /* adjust to X.10 fixed point */ } /* octave 3 to 7 */ - for (j=3; j<8; j++) + for (int j=3; j<8; j++) { - chip->freq[768 + j*768 + i] = chip->freq[ 768+2*768+i ] << (j-2); + freq[768 + j*768 + i] = freq[ 768+2*768+i ] << (j-2); } - - #if 0 - pom = (double)chip->freq[ 768+2*768+i ] / ((double)(1<<FREQ_SH)); - pom = pom * (double)chip->sampfreq / (double)SIN_LEN; - logerror("1freq[%4i][%08x]= real %20.15f Hz emul %20.15f Hz\n", i, chip->freq[ 768+2*768+i ], Hz, pom); - #endif } /* octave -1 (all equal to: oct 0, _KC_00_, _KF_00_) */ - for (i=0; i<768; i++) + for (int i=0; i<768; i++) { - chip->freq[ 0*768 + i ] = chip->freq[1*768+0]; + freq[ 0*768 + i ] = freq[1*768+0]; } /* octave 8 and 9 (all equal to: oct 7, _KC_14_, _KF_63_) */ - for (j=8; j<10; j++) + for (int j=8; j<10; j++) { - for (i=0; i<768; i++) + for (int i=0; i<768; i++) { - chip->freq[768+ j*768 + i ] = chip->freq[768 + 8*768 -1]; + freq[768+ j*768 + i ] = freq[768 + 8*768 -1]; } } -#if 0 - for (i=0; i<11*768; i++) - { - pom = (double)chip->freq[i] / ((double)(1<<FREQ_SH)); - pom = pom * (double)chip->sampfreq / (double)SIN_LEN; - logerror("freq[%4i][%08x]= emul %20.15f Hz\n", i, chip->freq[i], pom); - } -#endif - - mult = (1<<FREQ_SH); - for (j=0; j<4; j++) + for (int j=0; j<4; j++) { - for (i=0; i<32; i++) + for (int i=0; i<32; i++) { - Hz = ( (double)dt1_tab[j*32+i] * ((double)chip->clock/64.0) ) / (double)(1<<20); - - /*calculate phase increment*/ - phaseinc = (Hz*SIN_LEN) / (double)chip->sampfreq; - - /*positive and negative values*/ - chip->dt1_freq[ (j+0)*32 + i ] = phaseinc * mult; - chip->dt1_freq[ (j+4)*32 + i ] = -chip->dt1_freq[ (j+0)*32 + i ]; - -#if 0 - { - int x = j*32 + i; - pom = (double)chip->dt1_freq[x] / mult; - pom = pom * (double)chip->sampfreq / (double)SIN_LEN; - logerror("DT1(%03i)[%02i %02i][%08x]= real %19.15f Hz emul %19.15f Hz\n", - x, j, i, chip->dt1_freq[x], Hz, pom); - } -#endif + /*calculate phase increment, positive and negative values*/ + dt1_freq[ (j+0)*32 + i ] = ( dt1_tab[j*32+i] * SIN_LEN) >> (20 - FREQ_SH); + dt1_freq[ (j+4)*32 + i ] = -dt1_freq[ (j+0)*32 + i ]; } } - /* calculate timers' deltas */ - /* User's Manual pages 15,16 */ - #ifndef USE_MAME_TIMERS - mult = (1<<TIMER_SH); - #endif - for (i=0; i<1024; i++) + for (int i=0; i<1024; i++) { /* ASG 980324: changed to compute both tim_A_tab and timer_A_time */ - pom= attotime::from_hz(chip->clock) * (64 * (1024 - i)); - #ifdef USE_MAME_TIMERS - chip->timer_A_time[i] = pom; - #else - chip->tim_A_tab[i] = pom.as_double() * (double)chip->sampfreq * mult; /* number of samples that timer period takes (fixed point) */ - #endif + timer_A_time[i] = attotime::from_hz(clock()) * (64 * (1024 - i)); } - for (i=0; i<256; i++) + for (int i=0; i<256; i++) { /* ASG 980324: changed to compute both tim_B_tab and timer_B_time */ - pom= attotime::from_hz(chip->clock) * (1024 * (256 - i)); - #ifdef USE_MAME_TIMERS - chip->timer_B_time[i] = pom; - #else - chip->tim_B_tab[i] = pom.as_double() * (double)chip->sampfreq * mult; /* number of samples that timer period takes (fixed point) */ - #endif + timer_B_time[i] = attotime::from_hz(clock()) * (1024 * (256 - i)); } /* calculate noise periods table */ - scaler = ( (double)chip->clock / 64.0 ) / ( (double)chip->sampfreq ); - for (i=0; i<32; i++) + for (int i=0; i<32; i++) { - j = (i!=31 ? i : 30); /* rate 30 and 31 are the same */ + int j = (i!=31 ? i : 30); /* rate 30 and 31 are the same */ j = 32-j; j = (65536.0 / (double)(j*32.0)); /* number of samples per one shift of the shift register */ - /*chip->noise_tab[i] = j * 64;*/ /* number of chip clock cycles per one shift */ - chip->noise_tab[i] = j * 64 * scaler; - /*logerror("noise_tab[%02x]=%08x\n", i, chip->noise_tab[i]);*/ + noise_tab[i] = j * 64; /* number of chip clock cycles per one shift */ } } -#define KEY_ON(op, key_set){ \ - if (!(op)->key) \ - { \ - (op)->phase = 0; /* clear phase */ \ - (op)->state = EG_ATT; /* KEY ON = attack */ \ - (op)->volume += (~(op)->volume * \ - (eg_inc[(op)->eg_sel_ar + ((PSG->eg_cnt>>(op)->eg_sh_ar)&7)]) \ - ) >>4; \ - if ((op)->volume <= MIN_ATT_INDEX) \ - { \ - (op)->volume = MIN_ATT_INDEX; \ - (op)->state = EG_DEC; \ - } \ - } \ - (op)->key |= key_set; \ -} - -#define KEY_OFF(op, key_clr){ \ - if ((op)->key) \ - { \ - (op)->key &= key_clr; \ - if (!(op)->key) \ - { \ - if ((op)->state>EG_REL) \ - (op)->state = EG_REL;/* KEY OFF = release */\ - } \ - } \ -} - -static inline void envelope_KONKOFF(YM2151 *PSG, YM2151Operator * op, int v) +void ym2151_device::YM2151Operator::key_on(UINT32 key_set, UINT32 eg_cnt) { - if (v&0x08) /* M1 */ - KEY_ON (op+0, 1) - else - KEY_OFF(op+0,~1) - - if (v&0x20) /* M2 */ - KEY_ON (op+1, 1) - else - KEY_OFF(op+1,~1) - - if (v&0x10) /* C1 */ - KEY_ON (op+2, 1) - else - KEY_OFF(op+2,~1) - - if (v&0x40) /* C2 */ - KEY_ON (op+3, 1) - else - KEY_OFF(op+3,~1) -} - - -#ifdef USE_MAME_TIMERS - -static TIMER_CALLBACK( irqAon_callback ) -{ - YM2151 *chip = (YM2151 *)ptr; - int oldstate = chip->irqlinestate; - - chip->irqlinestate |= 1; - - if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(chip->device, 1); -} - -static TIMER_CALLBACK( irqBon_callback ) -{ - YM2151 *chip = (YM2151 *)ptr; - int oldstate = chip->irqlinestate; - - chip->irqlinestate |= 2; - - if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(chip->device, 1); -} - -static TIMER_CALLBACK( irqAoff_callback ) -{ - YM2151 *chip = (YM2151 *)ptr; - int oldstate = chip->irqlinestate; - - chip->irqlinestate &= ~1; - - if (oldstate == 1 && chip->irqhandler) (*chip->irqhandler)(chip->device, 0); -} - -static TIMER_CALLBACK( irqBoff_callback ) -{ - YM2151 *chip = (YM2151 *)ptr; - int oldstate = chip->irqlinestate; - - chip->irqlinestate &= ~2; - - if (oldstate == 2 && chip->irqhandler) (*chip->irqhandler)(chip->device, 0); -} - -static TIMER_CALLBACK( timer_callback_a ) -{ - YM2151 *chip = (YM2151 *)ptr; - chip->timer_A->adjust(chip->timer_A_time[ chip->timer_A_index ]); - chip->timer_A_index_old = chip->timer_A_index; - if (chip->irq_enable & 0x04) + if (!key) { - chip->status |= 1; - machine.scheduler().timer_set(attotime::zero, FUNC(irqAon_callback), 0, chip); + phase = 0; /* clear phase */ + state = EG_ATT; /* KEY ON = attack */ + volume += (~volume * (eg_inc[eg_sel_ar + ((eg_cnt >> eg_sh_ar)&7)])) >> 4; + if (volume <= MIN_ATT_INDEX) + { + volume = MIN_ATT_INDEX; + state = EG_DEC; + } } - if (chip->irq_enable & 0x80) - chip->csm_req = 2; /* request KEY ON / KEY OFF sequence */ + key |= key_set; } -static TIMER_CALLBACK( timer_callback_b ) + + +void ym2151_device::YM2151Operator::key_off(UINT32 key_set) { - YM2151 *chip = (YM2151 *)ptr; - chip->timer_B->adjust(chip->timer_B_time[ chip->timer_B_index ]); - chip->timer_B_index_old = chip->timer_B_index; - if (chip->irq_enable & 0x08) + if (key) { - chip->status |= 2; - machine.scheduler().timer_set(attotime::zero, FUNC(irqBon_callback), 0, chip); + key &= ~key_set; + if (!key) + { + if (state > EG_REL) + state = EG_REL; /* KEY OFF = release */ + } } } -#if 0 -static TIMER_CALLBACK( timer_callback_chip_busy ) + +void ym2151_device::envelope_KONKOFF(YM2151Operator * op, int v) { - YM2151 *chip = (YM2151 *)ptr; - chip->status &= 0x7f; /* reset busy flag */ + // m1, m2, c1, c2 + static UINT8 masks[4] = { 0x08, 0x20, 0x10, 0x40 }; + for(int i=0; i != 4; i++) + if (v & masks[i]) /* M1 */ + op[i].key_on(1, eg_cnt); + else + op[i].key_off(1); } -#endif -#endif - - - - -static inline void set_connect(YM2151 *PSG, YM2151Operator *om1, int cha, int v) +void ym2151_device::set_connect(YM2151Operator *om1, int cha, int v) { YM2151Operator *om2 = om1+1; YM2151Operator *oc1 = om1+2; @@ -870,47 +459,47 @@ static inline void set_connect(YM2151 *PSG, YM2151Operator *om1, int cha, int v) { case 0: /* M1---C1---MEM---M2---C2---OUT */ - om1->connect = &PSG->c1; - oc1->connect = &PSG->mem; - om2->connect = &PSG->c2; - om1->mem_connect = &PSG->m2; + om1->connect = &c1; + oc1->connect = &mem; + om2->connect = &c2; + om1->mem_connect = &m2; break; case 1: /* M1------+-MEM---M2---C2---OUT */ /* C1-+ */ - om1->connect = &PSG->mem; - oc1->connect = &PSG->mem; - om2->connect = &PSG->c2; - om1->mem_connect = &PSG->m2; + om1->connect = &mem; + oc1->connect = &mem; + om2->connect = &c2; + om1->mem_connect = &m2; break; case 2: /* M1-----------------+-C2---OUT */ /* C1---MEM---M2-+ */ - om1->connect = &PSG->c2; - oc1->connect = &PSG->mem; - om2->connect = &PSG->c2; - om1->mem_connect = &PSG->m2; + om1->connect = &c2; + oc1->connect = &mem; + om2->connect = &c2; + om1->mem_connect = &m2; break; case 3: /* M1---C1---MEM------+-C2---OUT */ /* M2-+ */ - om1->connect = &PSG->c1; - oc1->connect = &PSG->mem; - om2->connect = &PSG->c2; - om1->mem_connect = &PSG->c2; + om1->connect = &c1; + oc1->connect = &mem; + om2->connect = &c2; + om1->mem_connect = &c2; break; case 4: /* M1---C1-+-OUT */ /* M2---C2-+ */ /* MEM: not used */ - om1->connect = &PSG->c1; - oc1->connect = &PSG->chanout[cha]; - om2->connect = &PSG->c2; - om1->mem_connect = &PSG->mem; /* store it anywhere where it will not be used */ + om1->connect = &c1; + oc1->connect = &chanout[cha]; + om2->connect = &c2; + om1->mem_connect = &mem; /* store it anywhere where it will not be used */ break; case 5: @@ -918,9 +507,9 @@ static inline void set_connect(YM2151 *PSG, YM2151Operator *om1, int cha, int v) /* M1-+-MEM---M2-+-OUT */ /* +----C2----+ */ om1->connect = nullptr; /* special mark */ - oc1->connect = &PSG->chanout[cha]; - om2->connect = &PSG->chanout[cha]; - om1->mem_connect = &PSG->m2; + oc1->connect = &chanout[cha]; + om2->connect = &chanout[cha]; + om1->mem_connect = &m2; break; case 6: @@ -928,10 +517,10 @@ static inline void set_connect(YM2151 *PSG, YM2151Operator *om1, int cha, int v) /* M2-+-OUT */ /* C2-+ */ /* MEM: not used */ - om1->connect = &PSG->c1; - oc1->connect = &PSG->chanout[cha]; - om2->connect = &PSG->chanout[cha]; - om1->mem_connect = &PSG->mem; /* store it anywhere where it will not be used */ + om1->connect = &c1; + oc1->connect = &chanout[cha]; + om2->connect = &chanout[cha]; + om1->mem_connect = &mem; /* store it anywhere where it will not be used */ break; case 7: @@ -940,16 +529,16 @@ static inline void set_connect(YM2151 *PSG, YM2151Operator *om1, int cha, int v) /* M2-+ */ /* C2-+ */ /* MEM: not used*/ - om1->connect = &PSG->chanout[cha]; - oc1->connect = &PSG->chanout[cha]; - om2->connect = &PSG->chanout[cha]; - om1->mem_connect = &PSG->mem; /* store it anywhere where it will not be used */ + om1->connect = &chanout[cha]; + oc1->connect = &chanout[cha]; + om2->connect = &chanout[cha]; + om1->mem_connect = &mem; /* store it anywhere where it will not be used */ break; } } -static inline void refresh_EG(YM2151Operator * op) +void ym2151_device::refresh_EG(YM2151Operator * op) { UINT32 kc; UINT32 v; @@ -1040,10 +629,9 @@ static inline void refresh_EG(YM2151Operator * op) /* write a register on YM2151 chip number 'n' */ -void ym2151_write_reg(void *_chip, int r, int v) +void ym2151_device::write_reg(int r, int v) { - YM2151 *chip = (YM2151 *)_chip; - YM2151Operator *op = &chip->oper[ (r&0x07)*4+((r&0x18)>>3) ]; + YM2151Operator *op = &oper[ (r&0x07)*4+((r&0x18)>>3) ]; /* adjust bus to 8 bits */ r &= 0xff; @@ -1051,169 +639,125 @@ void ym2151_write_reg(void *_chip, int r, int v) #if 0 /* There is no info on what YM2151 really does when busy flag is set */ - if ( chip->status & 0x80 ) return; - timer_set ( attotime::from_hz(chip->clock) * 64, chip, 0, timer_callback_chip_busy); - chip->status |= 0x80; /* set busy flag for 64 chip clock cycles */ + if ( status & 0x80 ) return; + timer_set ( attotime::from_hz(clock()) * 64, chip, 0, timer_callback_chip_busy); + status |= 0x80; /* set busy flag for 64 chip clock cycles */ #endif - if (LOG_CYM_FILE && (cymfile) && (r!=0) ) - { - fputc( (unsigned char)r, cymfile ); - fputc( (unsigned char)v, cymfile ); - } - - switch(r & 0xe0) { case 0x00: switch(r){ case 0x01: /* LFO reset(bit 1), Test Register (other bits) */ - chip->test = v; - if (v&2) chip->lfo_phase = 0; + test = v; + if (v&2) lfo_phase = 0; break; case 0x08: - envelope_KONKOFF(chip, &chip->oper[ (v&7)*4 ], v ); + envelope_KONKOFF(&oper[ (v&7)*4 ], v ); break; case 0x0f: /* noise mode enable, noise period */ - chip->noise = v; - chip->noise_f = chip->noise_tab[ v & 0x1f ]; + noise = v; + noise_f = noise_tab[ v & 0x1f ]; break; case 0x10: /* timer A hi */ - chip->timer_A_index = (chip->timer_A_index & 0x003) | (v<<2); + timer_A_index = (timer_A_index & 0x003) | (v<<2); break; case 0x11: /* timer A low */ - chip->timer_A_index = (chip->timer_A_index & 0x3fc) | (v & 3); + timer_A_index = (timer_A_index & 0x3fc) | (v & 3); break; case 0x12: /* timer B */ - chip->timer_B_index = v; + timer_B_index = v; break; case 0x14: /* CSM, irq flag reset, irq enable, timer start/stop */ - chip->irq_enable = v; /* bit 3-timer B, bit 2-timer A, bit 7 - CSM */ + irq_enable = v; /* bit 3-timer B, bit 2-timer A, bit 7 - CSM */ if (v&0x10) /* reset timer A irq flag */ { -#ifdef USE_MAME_TIMERS - chip->status &= ~1; - chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(irqAoff_callback), 0, chip); -#else - int oldstate = chip->status & 3; - chip->status &= ~1; - if ((oldstate==1) && (chip->irqhandler)) (*chip->irqhandler)(chip->device, 0); -#endif + status &= ~1; + timer_A_irq_off->adjust(attotime::zero); } if (v&0x20) /* reset timer B irq flag */ { -#ifdef USE_MAME_TIMERS - chip->status &= ~2; - chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(irqBoff_callback), 0, chip); -#else - int oldstate = chip->status & 3; - chip->status &= ~2; - if ((oldstate==2) && (chip->irqhandler)) (*chip->irqhandler)(chip->device, 0); -#endif + status &= ~2; + timer_B_irq_off->adjust(attotime::zero); } if (v&0x02) { /* load and start timer B */ - #ifdef USE_MAME_TIMERS /* ASG 980324: added a real timer */ /* start timer _only_ if it wasn't already started (it will reload time value next round) */ - if (!chip->timer_B->enable(true)) - { - chip->timer_B->adjust(chip->timer_B_time[ chip->timer_B_index ]); - chip->timer_B_index_old = chip->timer_B_index; - } - #else - if (!chip->tim_B) - { - chip->tim_B = 1; - chip->tim_B_val = chip->tim_B_tab[ chip->timer_B_index ]; - } - #endif + if (!timer_B->enable(true)) + { + timer_B->adjust(timer_B_time[ timer_B_index ]); + timer_B_index_old = timer_B_index; + } } else { /* stop timer B */ - #ifdef USE_MAME_TIMERS - /* ASG 980324: added a real timer */ - chip->timer_B->enable(false); - #else - chip->tim_B = 0; - #endif + timer_B->enable(false); } if (v&0x01) { /* load and start timer A */ - #ifdef USE_MAME_TIMERS /* ASG 980324: added a real timer */ /* start timer _only_ if it wasn't already started (it will reload time value next round) */ - if (!chip->timer_A->enable(true)) - { - chip->timer_A->adjust(chip->timer_A_time[ chip->timer_A_index ]); - chip->timer_A_index_old = chip->timer_A_index; - } - #else - if (!chip->tim_A) - { - chip->tim_A = 1; - chip->tim_A_val = chip->tim_A_tab[ chip->timer_A_index ]; - } - #endif + if (!timer_A->enable(true)) + { + timer_A->adjust(timer_A_time[ timer_A_index ]); + timer_A_index_old = timer_A_index; + } } else { /* stop timer A */ - #ifdef USE_MAME_TIMERS /* ASG 980324: added a real timer */ - chip->timer_A->enable(false); - #else - chip->tim_A = 0; - #endif + timer_A->enable(false); } break; case 0x18: /* LFO frequency */ { - chip->lfo_overflow = ( 1 << ((15-(v>>4))+3) ) * (1<<LFO_SH); - chip->lfo_counter_add = 0x10 + (v & 0x0f); + lfo_overflow = ( 1 << ((15-(v>>4))+3) ) * (1<<LFO_SH); + lfo_counter_add = 0x10 + (v & 0x0f); } break; case 0x19: /* PMD (bit 7==1) or AMD (bit 7==0) */ if (v&0x80) - chip->pmd = v & 0x7f; + pmd = v & 0x7f; else - chip->amd = v & 0x7f; + amd = v & 0x7f; break; case 0x1b: /* CT2, CT1, LFO waveform */ - chip->ct = v >> 6; - chip->lfo_wsel = v & 3; - if (chip->porthandler) (*chip->porthandler)(chip->device, 0 , chip->ct ); + ct = v >> 6; + lfo_wsel = v & 3; + m_portwritehandler(0, ct, 0xff); break; default: - chip->device->logerror("YM2151 Write %02x to undocumented register #%02x\n",v,r); + logerror("YM2151 Write %02x to undocumented register #%02x\n",v,r); break; } break; case 0x20: - op = &chip->oper[ (r&7) * 4 ]; + op = &oper[ (r&7) * 4 ]; switch(r & 0x18) { case 0x00: /* RL enable, Feedback, Connection */ op->fb_shift = ((v>>3)&7) ? ((v>>3)&7)+6:0; - chip->pan[ (r&7)*2 ] = (v & 0x40) ? ~0 : 0; - chip->pan[ (r&7)*2 +1 ] = (v & 0x80) ? ~0 : 0; - chip->connect[r&7] = v&7; - set_connect(chip, op, r&7, v&7); + pan[ (r&7)*2 ] = (v & 0x40) ? ~0 : 0; + pan[ (r&7)*2 +1 ] = (v & 0x80) ? ~0 : 0; + connect[r&7] = v&7; + set_connect(op, r&7, v&7); break; case 0x08: /* Key Code */ @@ -1237,17 +781,17 @@ void ym2151_write_reg(void *_chip, int r, int v) kc = v>>2; - (op+0)->dt1 = chip->dt1_freq[ (op+0)->dt1_i + kc ]; - (op+0)->freq = ( (chip->freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; + (op+0)->dt1 = dt1_freq[ (op+0)->dt1_i + kc ]; + (op+0)->freq = ( (freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; - (op+1)->dt1 = chip->dt1_freq[ (op+1)->dt1_i + kc ]; - (op+1)->freq = ( (chip->freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; + (op+1)->dt1 = dt1_freq[ (op+1)->dt1_i + kc ]; + (op+1)->freq = ( (freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; - (op+2)->dt1 = chip->dt1_freq[ (op+2)->dt1_i + kc ]; - (op+2)->freq = ( (chip->freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; + (op+2)->dt1 = dt1_freq[ (op+2)->dt1_i + kc ]; + (op+2)->freq = ( (freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; - (op+3)->dt1 = chip->dt1_freq[ (op+3)->dt1_i + kc ]; - (op+3)->freq = ( (chip->freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; + (op+3)->dt1 = dt1_freq[ (op+3)->dt1_i + kc ]; + (op+3)->freq = ( (freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; refresh_EG( op ); } @@ -1267,10 +811,10 @@ void ym2151_write_reg(void *_chip, int r, int v) (op+2)->kc_i = kc_channel; (op+3)->kc_i = kc_channel; - (op+0)->freq = ( (chip->freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; - (op+1)->freq = ( (chip->freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; - (op+2)->freq = ( (chip->freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; - (op+3)->freq = ( (chip->freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; + (op+0)->freq = ( (freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; + (op+1)->freq = ( (freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; + (op+2)->freq = ( (freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; + (op+3)->freq = ( (freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; } break; @@ -1290,10 +834,10 @@ void ym2151_write_reg(void *_chip, int r, int v) op->mul = (v&0x0f) ? (v&0x0f)<<1: 1; if (olddt1_i != op->dt1_i) - op->dt1 = chip->dt1_freq[ op->dt1_i + (op->kc>>2) ]; + op->dt1 = dt1_freq[ op->dt1_i + (op->kc>>2) ]; if ( (olddt1_i != op->dt1_i) || (oldmul != op->mul) ) - op->freq = ( (chip->freq[ op->kc_i + op->dt2 ] + op->dt1) * op->mul ) >> 1; + op->freq = ( (freq[ op->kc_i + op->dt2 ] + op->dt1) * op->mul ) >> 1; } break; @@ -1347,7 +891,7 @@ void ym2151_write_reg(void *_chip, int r, int v) UINT32 olddt2 = op->dt2; op->dt2 = dt2_tab[ v>>6 ]; if (op->dt2 != olddt2) - op->freq = ( (chip->freq[ op->kc_i + op->dt2 ] + op->dt1) * op->mul ) >> 1; + op->freq = ( (freq[ op->kc_i + op->dt2 ] + op->dt1) * op->mul ) >> 1; } op->d2r = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; op->eg_sh_d2r = eg_rate_shift [op->d2r + (op->kc>>op->ks) ]; @@ -1363,294 +907,121 @@ void ym2151_write_reg(void *_chip, int r, int v) } } - -static TIMER_CALLBACK( cymfile_callback ) -{ - if (cymfile) - fputc( (unsigned char)0, cymfile ); -} - - -int ym2151_read_status( void *_chip ) -{ - YM2151 *chip = (YM2151 *)_chip; - return chip->status; -} - - - -//#ifdef USE_MAME_TIMERS -#if 1 // disabled for now due to crashing with winalloc.c (ERROR_NOT_ENOUGH_MEMORY) -/* -* state save support for MAME -*/ -void ym2151_postload(YM2151 *YM2151_chip) -{ - int j; - - for (j=0; j<8; j++) - set_connect(YM2151_chip, &YM2151_chip->oper[j*4], j, YM2151_chip->connect[j]); -} - -static void ym2151_state_save_register( YM2151 *chip, device_t *device ) -{ - int j; - - /* save all 32 operators of chip #i */ - for (j=0; j<32; j++) - { - YM2151Operator *op; - - op = &chip->oper[(j&7)*4+(j>>3)]; - - device->save_item(NAME(op->phase), j); - device->save_item(NAME(op->freq), j); - device->save_item(NAME(op->dt1), j); - device->save_item(NAME(op->mul), j); - device->save_item(NAME(op->dt1_i), j); - device->save_item(NAME(op->dt2), j); - /* operators connection is saved in chip data block */ - device->save_item(NAME(op->mem_value), j); - - device->save_item(NAME(op->fb_shift), j); - device->save_item(NAME(op->fb_out_curr), j); - device->save_item(NAME(op->fb_out_prev), j); - device->save_item(NAME(op->kc), j); - device->save_item(NAME(op->kc_i), j); - device->save_item(NAME(op->pms), j); - device->save_item(NAME(op->ams), j); - device->save_item(NAME(op->AMmask), j); - - device->save_item(NAME(op->state), j); - device->save_item(NAME(op->eg_sh_ar), j); - device->save_item(NAME(op->eg_sel_ar), j); - device->save_item(NAME(op->tl), j); - device->save_item(NAME(op->volume), j); - device->save_item(NAME(op->eg_sh_d1r), j); - device->save_item(NAME(op->eg_sel_d1r), j); - device->save_item(NAME(op->d1l), j); - device->save_item(NAME(op->eg_sh_d2r), j); - device->save_item(NAME(op->eg_sel_d2r), j); - device->save_item(NAME(op->eg_sh_rr), j); - device->save_item(NAME(op->eg_sel_rr), j); - - device->save_item(NAME(op->key), j); - device->save_item(NAME(op->ks), j); - device->save_item(NAME(op->ar), j); - device->save_item(NAME(op->d1r), j); - device->save_item(NAME(op->d2r), j); - device->save_item(NAME(op->rr), j); - - device->save_item(NAME(op->reserved0), j); - device->save_item(NAME(op->reserved1), j); - } - - device->save_item(NAME(chip->pan)); - - device->save_item(NAME(chip->eg_cnt)); - device->save_item(NAME(chip->eg_timer)); - device->save_item(NAME(chip->eg_timer_add)); - device->save_item(NAME(chip->eg_timer_overflow)); - - device->save_item(NAME(chip->lfo_phase)); - device->save_item(NAME(chip->lfo_timer)); - device->save_item(NAME(chip->lfo_timer_add)); - device->save_item(NAME(chip->lfo_overflow)); - device->save_item(NAME(chip->lfo_counter)); - device->save_item(NAME(chip->lfo_counter_add)); - device->save_item(NAME(chip->lfo_wsel)); - device->save_item(NAME(chip->amd)); - device->save_item(NAME(chip->pmd)); - device->save_item(NAME(chip->lfa)); - device->save_item(NAME(chip->lfp)); - - device->save_item(NAME(chip->test)); - device->save_item(NAME(chip->ct)); - - device->save_item(NAME(chip->noise)); - device->save_item(NAME(chip->noise_rng)); - device->save_item(NAME(chip->noise_p)); - device->save_item(NAME(chip->noise_f)); - - device->save_item(NAME(chip->csm_req)); - device->save_item(NAME(chip->irq_enable)); - device->save_item(NAME(chip->status)); - - device->save_item(NAME(chip->timer_A_index)); - device->save_item(NAME(chip->timer_B_index)); - device->save_item(NAME(chip->timer_A_index_old)); - device->save_item(NAME(chip->timer_B_index_old)); - -#ifdef USE_MAME_TIMERS - device->save_item(NAME(chip->irqlinestate)); -#endif - - device->save_item(NAME(chip->connect)); - - device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2151_postload), chip)); -} -#else -void ym2151_postload(YM2151 *chip) -{ -} - -static void ym2151_state_save_register( YM2151 *chip, device_t *device ) +void ym2151_device::device_post_load() { + for (int j=0; j<8; j++) + set_connect(&oper[j*4], j, connect[j]); } -#endif - -/* -* Initialize YM2151 emulator(s). -* -* 'num' is the number of virtual YM2151's to allocate -* 'clock' is the chip clock in Hz -* 'rate' is sampling rate -*/ -void * ym2151_init(device_t *device, int clock, int rate) +void ym2151_device::device_start() { - YM2151 *PSG; - - PSG = auto_alloc(device->machine(), YM2151); - - memset(PSG, 0, sizeof(YM2151)); - - ym2151_state_save_register( PSG, device ); - init_tables(); - PSG->device = device; - PSG->clock = clock; - /*rate = clock/64;*/ - PSG->sampfreq = rate ? rate : 44100; /* avoid division by 0 in init_chip_tables() */ - PSG->irqhandler = nullptr; /* interrupt handler */ - PSG->porthandler = nullptr; /* port write handler */ - init_chip_tables( PSG ); - - PSG->lfo_timer_add = (1<<LFO_SH) * (clock/64.0) / PSG->sampfreq; - - PSG->eg_timer_add = (1<<EG_SH) * (clock/64.0) / PSG->sampfreq; - PSG->eg_timer_overflow = ( 3 ) * (1<<EG_SH); - /*logerror("YM2151[init] eg_timer_add=%8x eg_timer_overflow=%8x\n", PSG->eg_timer_add, PSG->eg_timer_overflow);*/ - -#ifdef USE_MAME_TIMERS -/* this must be done _before_ a call to ym2151_reset_chip() */ - PSG->timer_A = device->machine().scheduler().timer_alloc(FUNC(timer_callback_a), PSG); - PSG->timer_B = device->machine().scheduler().timer_alloc(FUNC(timer_callback_b), PSG); -#else - PSG->tim_A = 0; - PSG->tim_B = 0; -#endif - ym2151_reset_chip(PSG); - /*logerror("YM2151[init] clock=%i sampfreq=%i\n", PSG->clock, PSG->sampfreq);*/ + m_irqhandler.resolve_safe(); + m_portwritehandler.resolve_safe(); - if (LOG_CYM_FILE) - { - cymfile = fopen("2151_.cym","wb"); - if (cymfile) - device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ - else - device->logerror("Could not create file 2151_.cym\n"); - } - - return PSG; -} + m_stream = stream_alloc(0, 2, clock() / 64); + timer_A_irq_off = timer_alloc(TIMER_IRQ_A_OFF); + timer_B_irq_off = timer_alloc(TIMER_IRQ_B_OFF); + timer_A = timer_alloc(TIMER_A); + timer_B = timer_alloc(TIMER_B); + lfo_timer_add = 1 << LFO_SH; -void ym2151_shutdown(void *_chip) -{ - YM2151 *chip = (YM2151 *)_chip; + eg_timer_add = 1 << EG_SH; + eg_timer_overflow = 3 * eg_timer_add; - auto_free (chip->device->machine(), chip); - - if (cymfile) - fclose (cymfile); - cymfile = nullptr; - -#ifdef SAVE_SAMPLE - fclose(sample[8]); -#endif -#ifdef SAVE_SEPARATE_CHANNELS - fclose(sample[0]); - fclose(sample[1]); - fclose(sample[2]); - fclose(sample[3]); - fclose(sample[4]); - fclose(sample[5]); - fclose(sample[6]); - fclose(sample[7]); -#endif -} - - - -/* -* Reset chip number 'n'. -*/ -void ym2151_reset_chip(void *_chip) -{ - int i; - YM2151 *chip = (YM2151 *)_chip; - - - /* initialize hardware registers */ - for (i=0; i<32; i++) + /* save all 32 operators */ + for (int j=0; j<32; j++) { - memset(&chip->oper[i],'\0',sizeof(YM2151Operator)); - chip->oper[i].volume = MAX_ATT_INDEX; - chip->oper[i].kc_i = 768; /* min kc_i value */ + YM2151Operator &op = oper[(j&7)*4+(j>>3)]; + + save_item(NAME(op.phase), j); + save_item(NAME(op.freq), j); + save_item(NAME(op.dt1), j); + save_item(NAME(op.mul), j); + save_item(NAME(op.dt1_i), j); + save_item(NAME(op.dt2), j); + /* operators connection is saved in chip data block */ + save_item(NAME(op.mem_value), j); + + save_item(NAME(op.fb_shift), j); + save_item(NAME(op.fb_out_curr), j); + save_item(NAME(op.fb_out_prev), j); + save_item(NAME(op.kc), j); + save_item(NAME(op.kc_i), j); + save_item(NAME(op.pms), j); + save_item(NAME(op.ams), j); + save_item(NAME(op.AMmask), j); + + save_item(NAME(op.state), j); + save_item(NAME(op.eg_sh_ar), j); + save_item(NAME(op.eg_sel_ar), j); + save_item(NAME(op.tl), j); + save_item(NAME(op.volume), j); + save_item(NAME(op.eg_sh_d1r), j); + save_item(NAME(op.eg_sel_d1r), j); + save_item(NAME(op.d1l), j); + save_item(NAME(op.eg_sh_d2r), j); + save_item(NAME(op.eg_sel_d2r), j); + save_item(NAME(op.eg_sh_rr), j); + save_item(NAME(op.eg_sel_rr), j); + + save_item(NAME(op.key), j); + save_item(NAME(op.ks), j); + save_item(NAME(op.ar), j); + save_item(NAME(op.d1r), j); + save_item(NAME(op.d2r), j); + save_item(NAME(op.rr), j); + + save_item(NAME(op.reserved0), j); + save_item(NAME(op.reserved1), j); } - chip->eg_timer = 0; - chip->eg_cnt = 0; - - chip->lfo_timer = 0; - chip->lfo_counter= 0; - chip->lfo_phase = 0; - chip->lfo_wsel = 0; - chip->pmd = 0; - chip->amd = 0; - chip->lfa = 0; - chip->lfp = 0; - - chip->test= 0; - - chip->irq_enable = 0; -#ifdef USE_MAME_TIMERS - /* ASG 980324 -- reset the timers before writing to the registers */ - chip->timer_A->enable(false); - chip->timer_B->enable(false); -#else - chip->tim_A = 0; - chip->tim_B = 0; - chip->tim_A_val = 0; - chip->tim_B_val = 0; -#endif - chip->timer_A_index = 0; - chip->timer_B_index = 0; - chip->timer_A_index_old = 0; - chip->timer_B_index_old = 0; - - chip->noise = 0; - chip->noise_rng = 0; - chip->noise_p = 0; - chip->noise_f = chip->noise_tab[0]; - - chip->csm_req = 0; - chip->status = 0; - - ym2151_write_reg(chip, 0x1b, 0); /* only because of CT1, CT2 output pins */ - ym2151_write_reg(chip, 0x18, 0); /* set LFO frequency */ - for (i=0x20; i<0x100; i++) /* set the operators */ - { - ym2151_write_reg(chip, i, 0); - } + save_item(NAME(pan)); + + save_item(NAME(eg_cnt)); + save_item(NAME(eg_timer)); + save_item(NAME(eg_timer_add)); + save_item(NAME(eg_timer_overflow)); + + save_item(NAME(lfo_phase)); + save_item(NAME(lfo_timer)); + save_item(NAME(lfo_timer_add)); + save_item(NAME(lfo_overflow)); + save_item(NAME(lfo_counter)); + save_item(NAME(lfo_counter_add)); + save_item(NAME(lfo_wsel)); + save_item(NAME(amd)); + save_item(NAME(pmd)); + save_item(NAME(lfa)); + save_item(NAME(lfp)); + + save_item(NAME(test)); + save_item(NAME(ct)); + + save_item(NAME(noise)); + save_item(NAME(noise_rng)); + save_item(NAME(noise_p)); + save_item(NAME(noise_f)); + + save_item(NAME(csm_req)); + save_item(NAME(irq_enable)); + save_item(NAME(status)); + + save_item(NAME(timer_A_index)); + save_item(NAME(timer_B_index)); + save_item(NAME(timer_A_index_old)); + save_item(NAME(timer_B_index_old)); + + save_item(NAME(irqlinestate)); + + save_item(NAME(connect)); } - -static inline signed int op_calc(YM2151Operator * OP, unsigned int env, signed int pm) +int ym2151_device::op_calc(YM2151Operator * OP, unsigned int env, signed int pm) { UINT32 p; @@ -1663,7 +1034,7 @@ static inline signed int op_calc(YM2151Operator * OP, unsigned int env, signed i return tl_tab[p]; } -static inline signed int op_calc1(YM2151Operator * OP, unsigned int env, signed int pm) +int ym2151_device::op_calc1(YM2151Operator * OP, unsigned int env, signed int pm) { UINT32 p; INT32 i; @@ -1687,19 +1058,19 @@ static inline signed int op_calc1(YM2151Operator * OP, unsigned int env, signed #define volume_calc(OP) ((OP)->tl + ((UINT32)(OP)->volume) + (AM & (OP)->AMmask)) -static inline void chan_calc(YM2151 *PSG, unsigned int chan) +void ym2151_device::chan_calc(unsigned int chan) { YM2151Operator *op; unsigned int env; UINT32 AM = 0; - PSG->m2 = PSG->c1 = PSG->c2 = PSG->mem = 0; - op = &PSG->oper[chan*4]; /* M1 */ + m2 = c1 = c2 = mem = 0; + op = &oper[chan*4]; /* M1 */ *op->mem_connect = op->mem_value; /* restore delayed sample (MEM) value to m2 or c2 */ if (op->ams) - AM = PSG->lfa << (op->ams-1); + AM = lfa << (op->ams-1); env = volume_calc(op); { INT32 out = op->fb_out_prev + op->fb_out_curr; @@ -1707,7 +1078,7 @@ static inline void chan_calc(YM2151 *PSG, unsigned int chan) if (!op->connect) /* algorithm 5 */ - PSG->mem = PSG->c1 = PSG->c2 = op->fb_out_prev; + mem = c1 = c2 = op->fb_out_prev; else /* other algorithms */ *op->connect = op->fb_out_prev; @@ -1723,33 +1094,34 @@ static inline void chan_calc(YM2151 *PSG, unsigned int chan) env = volume_calc(op+1); /* M2 */ if (env < ENV_QUIET) - *(op+1)->connect += op_calc(op+1, env, PSG->m2); + *(op+1)->connect += op_calc(op+1, env, m2); env = volume_calc(op+2); /* C1 */ if (env < ENV_QUIET) - *(op+2)->connect += op_calc(op+2, env, PSG->c1); + *(op+2)->connect += op_calc(op+2, env, c1); env = volume_calc(op+3); /* C2 */ if (env < ENV_QUIET) - PSG->chanout[chan] += op_calc(op+3, env, PSG->c2); + chanout[chan] += op_calc(op+3, env, c2); + // if(chan==3) printf("%d\n", chanout[chan]); /* M1 */ - op->mem_value = PSG->mem; + op->mem_value = mem; } -static inline void chan7_calc(YM2151 *PSG) +void ym2151_device::chan7_calc() { YM2151Operator *op; unsigned int env; UINT32 AM = 0; - PSG->m2 = PSG->c1 = PSG->c2 = PSG->mem = 0; - op = &PSG->oper[7*4]; /* M1 */ + m2 = c1 = c2 = mem = 0; + op = &oper[7*4]; /* M1 */ *op->mem_connect = op->mem_value; /* restore delayed sample (MEM) value to m2 or c2 */ if (op->ams) - AM = PSG->lfa << (op->ams-1); + AM = lfa << (op->ams-1); env = volume_calc(op); { INT32 out = op->fb_out_prev + op->fb_out_curr; @@ -1757,7 +1129,7 @@ static inline void chan7_calc(YM2151 *PSG) if (!op->connect) /* algorithm 5 */ - PSG->mem = PSG->c1 = PSG->c2 = op->fb_out_prev; + mem = c1 = c2 = op->fb_out_prev; else /* other algorithms */ *op->connect = op->fb_out_prev; @@ -1773,29 +1145,29 @@ static inline void chan7_calc(YM2151 *PSG) env = volume_calc(op+1); /* M2 */ if (env < ENV_QUIET) - *(op+1)->connect += op_calc(op+1, env, PSG->m2); + *(op+1)->connect += op_calc(op+1, env, m2); env = volume_calc(op+2); /* C1 */ if (env < ENV_QUIET) - *(op+2)->connect += op_calc(op+2, env, PSG->c1); + *(op+2)->connect += op_calc(op+2, env, c1); env = volume_calc(op+3); /* C2 */ - if (PSG->noise & 0x80) + if (noise & 0x80) { UINT32 noiseout; noiseout = 0; if (env < 0x3ff) noiseout = (env ^ 0x3ff) * 2; /* range of the YM2151 noise output is -2044 to 2040 */ - PSG->chanout[7] += ((PSG->noise_rng&0x10000) ? noiseout: -noiseout); /* bit 16 -> output */ + chanout[7] += ((noise_rng&0x10000) ? noiseout: -noiseout); /* bit 16 -> output */ } else { if (env < ENV_QUIET) - PSG->chanout[7] += op_calc(op+3, env, PSG->c2); + chanout[7] += op_calc(op+3, env, c2); } /* M1 */ - op->mem_value = PSG->mem; + op->mem_value = mem; } @@ -2007,33 +1379,31 @@ rate 11 1 | -- */ -static inline void advance_eg(YM2151 *PSG) +void ym2151_device::advance_eg() { YM2151Operator *op; unsigned int i; + eg_timer += eg_timer_add; - - PSG->eg_timer += PSG->eg_timer_add; - - while (PSG->eg_timer >= PSG->eg_timer_overflow) + while (eg_timer >= eg_timer_overflow) { - PSG->eg_timer -= PSG->eg_timer_overflow; + eg_timer -= eg_timer_overflow; - PSG->eg_cnt++; + eg_cnt++; /* envelope generator */ - op = &PSG->oper[0]; /* CH 0 M1 */ + op = &oper[0]; /* CH 0 M1 */ i = 32; do { switch(op->state) { case EG_ATT: /* attack phase */ - if ( !(PSG->eg_cnt & ((1<<op->eg_sh_ar)-1) ) ) + if ( !(eg_cnt & ((1<<op->eg_sh_ar)-1) ) ) { op->volume += (~op->volume * - (eg_inc[op->eg_sel_ar + ((PSG->eg_cnt>>op->eg_sh_ar)&7)]) + (eg_inc[op->eg_sel_ar + ((eg_cnt>>op->eg_sh_ar)&7)]) ) >>4; if (op->volume <= MIN_ATT_INDEX) @@ -2046,9 +1416,9 @@ static inline void advance_eg(YM2151 *PSG) break; case EG_DEC: /* decay phase */ - if ( !(PSG->eg_cnt & ((1<<op->eg_sh_d1r)-1) ) ) + if ( !(eg_cnt & ((1<<op->eg_sh_d1r)-1) ) ) { - op->volume += eg_inc[op->eg_sel_d1r + ((PSG->eg_cnt>>op->eg_sh_d1r)&7)]; + op->volume += eg_inc[op->eg_sel_d1r + ((eg_cnt>>op->eg_sh_d1r)&7)]; if ( op->volume >= op->d1l ) op->state = EG_SUS; @@ -2057,9 +1427,9 @@ static inline void advance_eg(YM2151 *PSG) break; case EG_SUS: /* sustain phase */ - if ( !(PSG->eg_cnt & ((1<<op->eg_sh_d2r)-1) ) ) + if ( !(eg_cnt & ((1<<op->eg_sh_d2r)-1) ) ) { - op->volume += eg_inc[op->eg_sel_d2r + ((PSG->eg_cnt>>op->eg_sh_d2r)&7)]; + op->volume += eg_inc[op->eg_sel_d2r + ((eg_cnt>>op->eg_sh_d2r)&7)]; if ( op->volume >= MAX_ATT_INDEX ) { @@ -2071,9 +1441,9 @@ static inline void advance_eg(YM2151 *PSG) break; case EG_REL: /* release phase */ - if ( !(PSG->eg_cnt & ((1<<op->eg_sh_rr)-1) ) ) + if ( !(eg_cnt & ((1<<op->eg_sh_rr)-1) ) ) { - op->volume += eg_inc[op->eg_sel_rr + ((PSG->eg_cnt>>op->eg_sh_rr)&7)]; + op->volume += eg_inc[op->eg_sel_rr + ((eg_cnt>>op->eg_sh_rr)&7)]; if ( op->volume >= MAX_ATT_INDEX ) { @@ -2091,31 +1461,31 @@ static inline void advance_eg(YM2151 *PSG) } -static inline void advance(YM2151 *PSG) +void ym2151_device::advance() { YM2151Operator *op; unsigned int i; int a,p; /* LFO */ - if (PSG->test&2) - PSG->lfo_phase = 0; + if (test&2) + lfo_phase = 0; else { - PSG->lfo_timer += PSG->lfo_timer_add; - if (PSG->lfo_timer >= PSG->lfo_overflow) + lfo_timer += lfo_timer_add; + if (lfo_timer >= lfo_overflow) { - PSG->lfo_timer -= PSG->lfo_overflow; - PSG->lfo_counter += PSG->lfo_counter_add; - PSG->lfo_phase += (PSG->lfo_counter>>4); - PSG->lfo_phase &= 255; - PSG->lfo_counter &= 15; + lfo_timer -= lfo_overflow; + lfo_counter += lfo_counter_add; + lfo_phase += (lfo_counter>>4); + lfo_phase &= 255; + lfo_counter &= 15; } } - i = PSG->lfo_phase; + i = lfo_phase; /* calculate LFO AM and PM waveform value (all verified on real chip, except for noise algorithm which is impossible to analyse)*/ - switch (PSG->lfo_wsel) + switch (lfo_wsel) { case 0: /* saw */ @@ -2173,8 +1543,8 @@ static inline void advance(YM2151 *PSG) p = a-128; break; } - PSG->lfa = a * PSG->amd / 128; - PSG->lfp = p * PSG->pmd / 128; + lfa = a * amd / 128; + lfp = p * pmd / 128; /* The Noise Generator of the YM2151 is 17-bit shift register. @@ -2182,26 +1552,26 @@ static inline void advance(YM2151 *PSG) * Output of the register is negated (bit0 XOR bit3). * Simply use bit16 as the noise output. */ - PSG->noise_p += PSG->noise_f; - i = (PSG->noise_p>>16); /* number of events (shifts of the shift register) */ - PSG->noise_p &= 0xffff; + noise_p += noise_f; + i = (noise_p>>16); /* number of events (shifts of the shift register) */ + noise_p &= 0xffff; while (i) { UINT32 j; - j = ( (PSG->noise_rng ^ (PSG->noise_rng>>3) ) & 1) ^ 1; - PSG->noise_rng = (j<<16) | (PSG->noise_rng>>1); + j = ( (noise_rng ^ (noise_rng>>3) ) & 1) ^ 1; + noise_rng = (j<<16) | (noise_rng>>1); i--; } /* phase generator */ - op = &PSG->oper[0]; /* CH 0 M1 */ + op = &oper[0]; /* CH 0 M1 */ i = 8; do { if (op->pms) /* only when phase modulation from LFO is enabled for this channel */ { - INT32 mod_ind = PSG->lfp; /* -128..+127 (8bits signed) */ + INT32 mod_ind = lfp; /* -128..+127 (8bits signed) */ if (op->pms < 6) mod_ind >>= (6 - op->pms); else @@ -2210,10 +1580,10 @@ static inline void advance(YM2151 *PSG) if (mod_ind) { UINT32 kc_channel = op->kc_i + mod_ind; - (op+0)->phase += ( (PSG->freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; - (op+1)->phase += ( (PSG->freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; - (op+2)->phase += ( (PSG->freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; - (op+3)->phase += ( (PSG->freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; + (op+0)->phase += ( (freq[ kc_channel + (op+0)->dt2 ] + (op+0)->dt1) * (op+0)->mul ) >> 1; + (op+1)->phase += ( (freq[ kc_channel + (op+1)->dt2 ] + (op+1)->dt1) * (op+1)->mul ) >> 1; + (op+2)->phase += ( (freq[ kc_channel + (op+2)->dt2 ] + (op+2)->dt1) * (op+2)->mul ) >> 1; + (op+3)->phase += ( (freq[ kc_channel + (op+3)->dt2 ] + (op+3)->dt1) * (op+3)->mul ) >> 1; } else /* phase modulation from LFO is equal to zero */ { @@ -2245,258 +1615,241 @@ static inline void advance(YM2151 *PSG) * the sound played is the same as after normal KEY ON. */ - if (PSG->csm_req) /* CSM KEYON/KEYOFF seqeunce request */ + if (csm_req) /* CSM KEYON/KEYOFF seqeunce request */ { - if (PSG->csm_req==2) /* KEY ON */ + if (csm_req==2) /* KEY ON */ { - op = &PSG->oper[0]; /* CH 0 M1 */ + op = &oper[0]; /* CH 0 M1 */ i = 32; do { - KEY_ON(op, 2); + op->key_on(2, eg_cnt); op++; i--; - }while (i); - PSG->csm_req = 1; + } while (i); + csm_req = 1; } else /* KEY OFF */ { - op = &PSG->oper[0]; /* CH 0 M1 */ + op = &oper[0]; /* CH 0 M1 */ i = 32; do { - KEY_OFF(op,~2); + op->key_off(2); op++; i--; }while (i); - PSG->csm_req = 0; + csm_req = 0; } } } -#if 0 -static inline signed int acc_calc(signed int value) + +//------------------------------------------------- +// ym2151_device - constructor +//------------------------------------------------- + +ym2151_device::ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2151, "YM2151", tag, owner, clock, "ym2151", __FILE__), + device_sound_interface(mconfig, *this), + m_stream(nullptr), + m_lastreg(0), + m_irqhandler(*this), + m_portwritehandler(*this) +{ +} + + +//------------------------------------------------- +// read - read from the device +//------------------------------------------------- + +READ8_MEMBER( ym2151_device::read ) { - if (value>=0) + if (offset & 1) { - if (value < 0x0200) - return (value & ~0); - if (value < 0x0400) - return (value & ~1); - if (value < 0x0800) - return (value & ~3); - if (value < 0x1000) - return (value & ~7); - if (value < 0x2000) - return (value & ~15); - if (value < 0x4000) - return (value & ~31); - return (value & ~63); + m_stream->update(); + return status; } - /*else value < 0*/ - if (value > -0x0200) - return (~abs(value) & ~0); - if (value > -0x0400) - return (~abs(value) & ~1); - if (value > -0x0800) - return (~abs(value) & ~3); - if (value > -0x1000) - return (~abs(value) & ~7); - if (value > -0x2000) - return (~abs(value) & ~15); - if (value > -0x4000) - return (~abs(value) & ~31); - return (~abs(value) & ~63); + else + return 0xff; /* confirmed on a real YM2151 */ } -#endif -/* first macro saves left and right channels to mono file */ -/* second macro saves left and right channels to stereo file */ -#if 0 /*MONO*/ - #ifdef SAVE_SEPARATE_CHANNELS - #define SAVE_SINGLE_CHANNEL(j) \ - { signed int pom= -(chanout[j] & PSG->pan[j*2]); \ - if (pom > 32767) pom = 32767; else if (pom < -32768) pom = -32768; \ - fputc((unsigned short)pom&0xff,sample[j]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[j]); \ - } - #else - #define SAVE_SINGLE_CHANNEL(j) - #endif -#else /*STEREO*/ - #ifdef SAVE_SEPARATE_CHANNELS - #define SAVE_SINGLE_CHANNEL(j) \ - { signed int pom = -(chanout[j] & PSG->pan[j*2]); \ - if (pom > 32767) pom = 32767; else if (pom < -32768) pom = -32768; \ - fputc((unsigned short)pom&0xff,sample[j]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[j]); \ - pom = -(chanout[j] & PSG->pan[j*2+1]); \ - if (pom > 32767) pom = 32767; else if (pom < -32768) pom = -32768; \ - fputc((unsigned short)pom&0xff,sample[j]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[j]); \ - } - #else - #define SAVE_SINGLE_CHANNEL(j) - #endif -#endif -/* first macro saves left and right channels to mono file */ -/* second macro saves left and right channels to stereo file */ -#if 1 /*MONO*/ - #ifdef SAVE_SAMPLE - #define SAVE_ALL_CHANNELS \ - { signed int pom = outl; \ - /*pom = acc_calc(pom);*/ \ - /*fprintf(sample[8]," %i\n",pom);*/ \ - fputc((unsigned short)pom&0xff,sample[8]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[8]); \ - } - #else - #define SAVE_ALL_CHANNELS - #endif -#else /*STEREO*/ - #ifdef SAVE_SAMPLE - #define SAVE_ALL_CHANNELS \ - { signed int pom = outl; \ - fputc((unsigned short)pom&0xff,sample[8]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[8]); \ - pom = outr; \ - fputc((unsigned short)pom&0xff,sample[8]); \ - fputc(((unsigned short)pom>>8)&0xff,sample[8]); \ - } - #else - #define SAVE_ALL_CHANNELS - #endif -#endif +//------------------------------------------------- +// write - write from the device +//------------------------------------------------- +WRITE8_MEMBER( ym2151_device::write ) +{ + if (offset & 1) + { + m_stream->update(); + write_reg(m_lastreg, data); + } + else + m_lastreg = data; +} -/* Generate samples for one of the YM2151's -* -* 'num' is the number of virtual YM2151 -* '**buffers' is table of pointers to the buffers: left and right -* 'length' is the number of samples that should be generated -*/ -void ym2151_update_one(void *chip, SAMP **buffers, int length) + +READ8_MEMBER( ym2151_device::status_r ) { - YM2151 *PSG = (YM2151 *)chip; - signed int *chanout = PSG->chanout; - int i; - signed int outl,outr; - SAMP *bufL, *bufR; + return read(space, 1); +} + +WRITE8_MEMBER( ym2151_device::register_w ) +{ + write(space, 0, data); +} + +WRITE8_MEMBER( ym2151_device::data_w ) +{ + write(space, 1, data); +} - bufL = buffers[0]; - bufR = buffers[1]; -#ifdef USE_MAME_TIMERS - /* ASG 980324 - handled by real timers now */ -#else - if (PSG->tim_B) +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2151_device::device_reset() +{ + int i; + /* initialize hardware registers */ + for (i=0; i<32; i++) { - PSG->tim_B_val -= ( length << TIMER_SH ); - if (PSG->tim_B_val<=0) - { - PSG->tim_B_val += PSG->tim_B_tab[ PSG->timer_B_index ]; - if ( PSG->irq_enable & 0x08 ) - { - int oldstate = PSG->status & 3; - PSG->status |= 2; - if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(chip->device, 1); - } - } + memset(&oper[i],'\0', sizeof(YM2151Operator)); + oper[i].volume = MAX_ATT_INDEX; + oper[i].kc_i = 768; /* min kc_i value */ } -#endif - for (i=0; i<length; i++) + eg_timer = 0; + eg_cnt = 0; + + lfo_timer = 0; + lfo_counter= 0; + lfo_phase = 0; + lfo_wsel = 0; + pmd = 0; + amd = 0; + lfa = 0; + lfp = 0; + + test= 0; + + irq_enable = 0; + /* ASG 980324 -- reset the timers before writing to the registers */ + timer_A->enable(false); + timer_B->enable(false); + timer_A_index = 0; + timer_B_index = 0; + timer_A_index_old = 0; + timer_B_index_old = 0; + + noise = 0; + noise_rng = 0; + noise_p = 0; + noise_f = noise_tab[0]; + + csm_req = 0; + status = 0; + + write_reg(0x1b, 0); /* only because of CT1, CT2 output pins */ + write_reg(0x18, 0); /* set LFO frequency */ + for (i=0x20; i<0x100; i++) /* set the operators */ { - advance_eg(PSG); - - chanout[0] = 0; - chanout[1] = 0; - chanout[2] = 0; - chanout[3] = 0; - chanout[4] = 0; - chanout[5] = 0; - chanout[6] = 0; - chanout[7] = 0; - - chan_calc(PSG, 0); - SAVE_SINGLE_CHANNEL(0) - chan_calc(PSG, 1); - SAVE_SINGLE_CHANNEL(1) - chan_calc(PSG, 2); - SAVE_SINGLE_CHANNEL(2) - chan_calc(PSG, 3); - SAVE_SINGLE_CHANNEL(3) - chan_calc(PSG, 4); - SAVE_SINGLE_CHANNEL(4) - chan_calc(PSG, 5); - SAVE_SINGLE_CHANNEL(5) - chan_calc(PSG, 6); - SAVE_SINGLE_CHANNEL(6) - chan7_calc(PSG); - SAVE_SINGLE_CHANNEL(7) - - outl = chanout[0] & PSG->pan[0]; - outr = chanout[0] & PSG->pan[1]; - outl += (chanout[1] & PSG->pan[2]); - outr += (chanout[1] & PSG->pan[3]); - outl += (chanout[2] & PSG->pan[4]); - outr += (chanout[2] & PSG->pan[5]); - outl += (chanout[3] & PSG->pan[6]); - outr += (chanout[3] & PSG->pan[7]); - outl += (chanout[4] & PSG->pan[8]); - outr += (chanout[4] & PSG->pan[9]); - outl += (chanout[5] & PSG->pan[10]); - outr += (chanout[5] & PSG->pan[11]); - outl += (chanout[6] & PSG->pan[12]); - outr += (chanout[6] & PSG->pan[13]); - outl += (chanout[7] & PSG->pan[14]); - outr += (chanout[7] & PSG->pan[15]); - - outl >>= FINAL_SH; - outr >>= FINAL_SH; - if (outl > MAXOUT) outl = MAXOUT; - else if (outl < MINOUT) outl = MINOUT; - if (outr > MAXOUT) outr = MAXOUT; - else if (outr < MINOUT) outr = MINOUT; - ((SAMP*)bufL)[i] = (SAMP)outl; - ((SAMP*)bufR)[i] = (SAMP)outr; - - SAVE_ALL_CHANNELS - -#ifdef USE_MAME_TIMERS - /* ASG 980324 - handled by real timers now */ -#else - /* calculate timer A */ - if (PSG->tim_A) - { - PSG->tim_A_val -= ( 1 << TIMER_SH ); - if (PSG->tim_A_val <= 0) - { - PSG->tim_A_val += PSG->tim_A_tab[ PSG->timer_A_index ]; - if (PSG->irq_enable & 0x04) - { - int oldstate = PSG->status & 3; - PSG->status |= 1; - if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(chip->device, 1); - } - if (PSG->irq_enable & 0x80) - PSG->csm_req = 2; /* request KEY ON / KEY OFF sequence */ - } - } -#endif - advance(PSG); + write_reg(i, 0); } } -void ym2151_set_irq_handler(void *chip, void(*handler)(device_t *device, int irq)) + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2151_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { - YM2151 *PSG = (YM2151 *)chip; - PSG->irqhandler = handler; + for (int i=0; i<samples; i++) + { + advance_eg(); + + for(int ch=0; ch<8; ch++) + chanout[ch] = 0; + + for(int ch=0; ch<7; ch++) + chan_calc(ch); + chan7_calc(); + + int outl = 0; + int outr = 0; + for(int ch=0; ch<8; ch++) { + outl += chanout[ch] & pan[2*ch]; + outr += chanout[ch] & pan[2*ch+1]; + } + + if (outl > 32767) + outl = 32767; + else if (outl < -32768) + outl = -32768; + if (outr > 32767) + outr = 32767; + else if (outr < -32768) + outr = -32768; + outputs[0][i] = outl; + outputs[1][i] = outr; + + advance(); + } } -void ym2151_set_port_write_handler(void *chip, void (*handler)(device_t *, offs_t, UINT8)) + +void ym2151_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - YM2151 *PSG = (YM2151 *)chip; - PSG->porthandler = handler; + switch(id) { + case TIMER_IRQ_A_OFF: { + int old = irqlinestate; + irqlinestate &= ~1; + if(old && !irqlinestate) + m_irqhandler(0); + break; + } + + case TIMER_IRQ_B_OFF: { + int old = irqlinestate; + irqlinestate &= ~2; + if(old && !irqlinestate) + m_irqhandler(0); + break; + } + + case TIMER_A: { + timer_A->adjust(timer_A_time[ timer_A_index ]); + timer_A_index_old = timer_A_index; + if (irq_enable & 0x80) + csm_req = 2; /* request KEY ON / KEY OFF sequence */ + if (irq_enable & 0x04) + { + status |= 1; + int old = irqlinestate; + irqlinestate |= 1; + if (!old) + m_irqhandler(1); + } + break; + } + + case TIMER_B: { + timer_B->adjust(timer_B_time[ timer_B_index ]); + timer_B_index_old = timer_B_index; + if (irq_enable & 0x08) + { + status |= 2; + int old = irqlinestate; + irqlinestate |= 2; + if (!old) + m_irqhandler(1); + } + break; + } + } } diff --git a/src/devices/sound/ym2151.h b/src/devices/sound/ym2151.h index 8ad1c8ea773..a3e46774485 100644 --- a/src/devices/sound/ym2151.h +++ b/src/devices/sound/ym2151.h @@ -1,5 +1,5 @@ // license:GPL-2.0+ -// copyright-holders:Jarek Burczynski +// copyright-holders:Jarek Burczynski,Ernesto Corvi /* ** File: ym2151.h - header file for software implementation of YM2151 ** FM Operator Type-M(OPM) @@ -36,53 +36,244 @@ #define __YM2151_H__ -/* 16- and 8-bit samples (signed) are supported*/ -#define SAMPLE_BITS 16 +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** -typedef stream_sample_t SAMP; -/* -#if (SAMPLE_BITS==16) - typedef INT16 SAMP; -#endif -#if (SAMPLE_BITS==8) - typedef signed char SAMP; -#endif -*/ +#define MCFG_YM2151_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, YM2151, _clock) -/* -** Initialize YM2151 emulator(s). -** -** 'num' is the number of virtual YM2151's to allocate -** 'clock' is the chip clock in Hz -** 'rate' is sampling rate -*/ -void *ym2151_init(device_t *device, int clock, int rate); +#define MCFG_YM2151_IRQ_HANDLER(_devcb) \ + devcb = &ym2151_device::set_irq_handler(*device, DEVCB_##_devcb); +#define MCFG_YM2151_PORT_WRITE_HANDLER(_devcb) \ + devcb = &ym2151_device::set_port_write_handler(*device, DEVCB_##_devcb); -/* shutdown the YM2151 emulators*/ -void ym2151_shutdown(void *chip); -/* reset all chip registers for YM2151 number 'num'*/ -void ym2151_reset_chip(void *chip); +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** -/* -** Generate samples for one of the YM2151's -** -** 'num' is the number of virtual YM2151 -** '**buffers' is table of pointers to the buffers: left and right -** 'length' is the number of samples that should be generated -*/ -void ym2151_update_one(void *chip, SAMP **buffers, int length); -/* write 'v' to register 'r' on YM2151 chip number 'n'*/ -void ym2151_write_reg(void *chip, int r, int v); +// ======================> ym2151_device + +class ym2151_device : public device_t, + public device_sound_interface +{ +public: + // construction/destruction + ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<ym2151_device &>(device).m_irqhandler.set_callback(object); } + template<class _Object> static devcb_base &set_port_write_handler(device_t &device, _Object object) { return downcast<ym2151_device &>(device).m_portwritehandler.set_callback(object); } + + // read/write + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( register_w ); + DECLARE_WRITE8_MEMBER( data_w ); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_post_load() override; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; + +private: + enum { + TIMER_IRQ_A_OFF, + TIMER_IRQ_B_OFF, + TIMER_A, + TIMER_B + }; + + enum { + RATE_STEPS = 8, + TL_RES_LEN = 256, /* 8 bits addressing (real chip) */ + + /* TL_TAB_LEN is calculated as: + * 13 - sinus amplitude bits (Y axis) + * 2 - sinus sign bit (Y axis) + * TL_RES_LEN - sinus resolution (X axis) + */ + TL_TAB_LEN = 13*2*TL_RES_LEN, + + SIN_BITS = 10, + SIN_LEN = 1 << SIN_BITS, + SIN_MASK = SIN_LEN - 1 + }; + + int tl_tab[TL_TAB_LEN]; + unsigned int sin_tab[SIN_LEN]; + UINT32 d1l_tab[16]; + + static const UINT8 eg_inc[19*RATE_STEPS]; + static const UINT8 eg_rate_select[32+64+32]; + static const UINT8 eg_rate_shift[32+64+32]; + static const UINT32 dt2_tab[4]; + static const UINT8 dt1_tab[4*32]; + static const UINT16 phaseinc_rom[768]; + static const UINT8 lfo_noise_waveform[256]; + + /* struct describing a single operator */ + struct YM2151Operator + { + UINT32 phase; /* accumulated operator phase */ + UINT32 freq; /* operator frequency count */ + INT32 dt1; /* current DT1 (detune 1 phase inc/decrement) value */ + UINT32 mul; /* frequency count multiply */ + UINT32 dt1_i; /* DT1 index * 32 */ + UINT32 dt2; /* current DT2 (detune 2) value */ + + signed int *connect; /* operator output 'direction' */ + + /* only M1 (operator 0) is filled with this data: */ + signed int *mem_connect; /* where to put the delayed sample (MEM) */ + INT32 mem_value; /* delayed sample (MEM) value */ + + /* channel specific data; note: each operator number 0 contains channel specific data */ + UINT32 fb_shift; /* feedback shift value for operators 0 in each channel */ + INT32 fb_out_curr; /* operator feedback value (used only by operators 0) */ + INT32 fb_out_prev; /* previous feedback value (used only by operators 0) */ + UINT32 kc; /* channel KC (copied to all operators) */ + UINT32 kc_i; /* just for speedup */ + UINT32 pms; /* channel PMS */ + UINT32 ams; /* channel AMS */ + /* end of channel specific data */ + + UINT32 AMmask; /* LFO Amplitude Modulation enable mask */ + UINT32 state; /* Envelope state: 4-attack(AR) 3-decay(D1R) 2-sustain(D2R) 1-release(RR) 0-off */ + UINT8 eg_sh_ar; /* (attack state) */ + UINT8 eg_sel_ar; /* (attack state) */ + UINT32 tl; /* Total attenuation Level */ + INT32 volume; /* current envelope attenuation level */ + UINT8 eg_sh_d1r; /* (decay state) */ + UINT8 eg_sel_d1r; /* (decay state) */ + UINT32 d1l; /* envelope switches to sustain state after reaching this level */ + UINT8 eg_sh_d2r; /* (sustain state) */ + UINT8 eg_sel_d2r; /* (sustain state) */ + UINT8 eg_sh_rr; /* (release state) */ + UINT8 eg_sel_rr; /* (release state) */ + + UINT32 key; /* 0=last key was KEY OFF, 1=last key was KEY ON */ + + UINT32 ks; /* key scale */ + UINT32 ar; /* attack rate */ + UINT32 d1r; /* decay rate */ + UINT32 d2r; /* sustain rate */ + UINT32 rr; /* release rate */ + + UINT32 reserved0; /**/ + UINT32 reserved1; /**/ + + void key_on(UINT32 key_set, UINT32 eg_cnt); + void key_off(UINT32 key_set); + }; + + signed int chanout[8]; + signed int m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */ + signed int mem; /* one sample delay memory */ + + YM2151Operator oper[32]; /* the 32 operators */ + + UINT32 pan[16]; /* channels output masks (0xffffffff = enable) */ + + UINT32 eg_cnt; /* global envelope generator counter */ + UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/64/3 */ + UINT32 eg_timer_add; /* step of eg_timer */ + UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 3 samples (on real chip) */ + + UINT32 lfo_phase; /* accumulated LFO phase (0 to 255) */ + UINT32 lfo_timer; /* LFO timer */ + UINT32 lfo_timer_add; /* step of lfo_timer */ + UINT32 lfo_overflow; /* LFO generates new output when lfo_timer reaches this value */ + UINT32 lfo_counter; /* LFO phase increment counter */ + UINT32 lfo_counter_add; /* step of lfo_counter */ + UINT8 lfo_wsel; /* LFO waveform (0-saw, 1-square, 2-triangle, 3-random noise) */ + UINT8 amd; /* LFO Amplitude Modulation Depth */ + INT8 pmd; /* LFO Phase Modulation Depth */ + UINT32 lfa; /* LFO current AM output */ + INT32 lfp; /* LFO current PM output */ + + UINT8 test; /* TEST register */ + UINT8 ct; /* output control pins (bit1-CT2, bit0-CT1) */ + + UINT32 noise; /* noise enable/period register (bit 7 - noise enable, bits 4-0 - noise period */ + UINT32 noise_rng; /* 17 bit noise shift register */ + UINT32 noise_p; /* current noise 'phase'*/ + UINT32 noise_f; /* current noise period */ + + UINT32 csm_req; /* CSM KEY ON / KEY OFF sequence request */ + + UINT32 irq_enable; /* IRQ enable for timer B (bit 3) and timer A (bit 2); bit 7 - CSM mode (keyon to all slots, everytime timer A overflows) */ + UINT32 status; /* chip status (BUSY, IRQ Flags) */ + UINT8 connect[8]; /* channels connections */ + + emu_timer *timer_A, *timer_A_irq_off; + emu_timer *timer_B, *timer_B_irq_off; + + attotime timer_A_time[1024]; /* timer A times for MAME */ + attotime timer_B_time[256]; /* timer B times for MAME */ + int irqlinestate; + + UINT32 timer_A_index; /* timer A index */ + UINT32 timer_B_index; /* timer B index */ + UINT32 timer_A_index_old; /* timer A previous index */ + UINT32 timer_B_index_old; /* timer B previous index */ + + /* Frequency-deltas to get the closest frequency possible. + * There are 11 octaves because of DT2 (max 950 cents over base frequency) + * and LFO phase modulation (max 800 cents below AND over base frequency) + * Summary: octave explanation + * 0 note code - LFO PM + * 1 note code + * 2 note code + * 3 note code + * 4 note code + * 5 note code + * 6 note code + * 7 note code + * 8 note code + * 9 note code + DT2 + LFO PM + * 10 note code + DT2 + LFO PM + */ + UINT32 freq[11*768]; /* 11 octaves, 768 'cents' per octave */ + + /* Frequency deltas for DT1. These deltas alter operator frequency + * after it has been taken from frequency-deltas table. + */ + INT32 dt1_freq[8*32]; /* 8 DT1 levels, 32 KC values */ + + UINT32 noise_tab[32]; /* 17bit Noise Generator periods */ + + // internal state + sound_stream * m_stream; + UINT8 m_lastreg; + devcb_write_line m_irqhandler; + devcb_write8 m_portwritehandler; + + void init_tables(); + void envelope_KONKOFF(YM2151Operator * op, int v); + void set_connect(YM2151Operator *om1, int cha, int v); + void advance(); + void advance_eg(); + void write_reg(int r, int v); + void chan_calc(unsigned int chan); + void chan7_calc(); + int op_calc(YM2151Operator * OP, unsigned int env, signed int pm); + int op_calc1(YM2151Operator * OP, unsigned int env, signed int pm); + void refresh_EG(YM2151Operator * op); +}; -/* read status register on YM2151 chip number 'n'*/ -int ym2151_read_status(void *chip); -/* set interrupt handler on YM2151 chip number 'n'*/ -void ym2151_set_irq_handler(void *chip, void (*handler)(device_t *device, int irq)); +// device type definition +extern const device_type YM2151; -/* set port write handler on YM2151 chip number 'n'*/ -void ym2151_set_port_write_handler(void *chip, void (*handler)(device_t *, offs_t, UINT8)); -#endif /*__YM2151_H__*/ +#endif /* __2151INTF_H__ */ diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index dd47ada0c34..553723f59ac 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -15,7 +15,7 @@ #include "cpu/m6502/m6502.h" #include "sound/tms5220.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/pokey.h" #include "machine/atarigen.h" diff --git a/src/mame/audio/cyberbal.cpp b/src/mame/audio/cyberbal.cpp index 249a220efc8..32a9403a2f6 100644 --- a/src/mame/audio/cyberbal.cpp +++ b/src/mame/audio/cyberbal.cpp @@ -7,7 +7,7 @@ ****************************************************************************/ #include "emu.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/atarigen.h" #include "includes/cyberbal.h" diff --git a/src/mame/audio/s11c_bg.h b/src/mame/audio/s11c_bg.h index 136bd037825..55d4b853f47 100644 --- a/src/mame/audio/s11c_bg.h +++ b/src/mame/audio/s11c_bg.h @@ -11,7 +11,7 @@ #include "emu.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "sound/hc55516.h" #include "machine/6821pia.h" diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp index d3add75d6fd..917729fe3c2 100644 --- a/src/mame/audio/seibu.cpp +++ b/src/mame/audio/seibu.cpp @@ -37,7 +37,7 @@ #include "emu.h" #include "audio/seibu.h" #include "sound/3812intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/2203intf.h" #include "sound/okiadpcm.h" #include "sound/okim6295.h" diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 450febcf665..ff492e6c48c 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -27,7 +27,7 @@ #include "cpu/z80/z80.h" #include "sound/3812intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/2203intf.h" #include "sound/okim6295.h" diff --git a/src/mame/audio/t5182.h b/src/mame/audio/t5182.h index cef7d593c2b..4fd09da6d2c 100644 --- a/src/mame/audio/t5182.h +++ b/src/mame/audio/t5182.h @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Jonathan Gevaryahu -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "cpu/z80/z80.h" class t5182_device : public device_t diff --git a/src/mame/audio/williams.cpp b/src/mame/audio/williams.cpp index 94d9a39673a..78172f3251d 100644 --- a/src/mame/audio/williams.cpp +++ b/src/mame/audio/williams.cpp @@ -34,7 +34,7 @@ #include "machine/6821pia.h" #include "cpu/m6809/m6809.h" #include "williams.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/hc55516.h" #include "sound/dac.h" diff --git a/src/mame/audio/williams.h b/src/mame/audio/williams.h index 1c19bcd3985..f7217f60bdb 100644 --- a/src/mame/audio/williams.h +++ b/src/mame/audio/williams.h @@ -11,7 +11,7 @@ #include "emu.h" #include "machine/6821pia.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/hc55516.h" #include "sound/dac.h" diff --git a/src/mame/audio/wpcsnd.h b/src/mame/audio/wpcsnd.h index 0975b2d584a..54a9cd3df0b 100644 --- a/src/mame/audio/wpcsnd.h +++ b/src/mame/audio/wpcsnd.h @@ -11,7 +11,7 @@ #include "emu.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/hc55516.h" #include "sound/dac.h" diff --git a/src/mame/drivers/88games.cpp b/src/mame/drivers/88games.cpp index ab9c1508f9b..14431d778c0 100644 --- a/src/mame/drivers/88games.cpp +++ b/src/mame/drivers/88games.cpp @@ -9,7 +9,7 @@ #include "emu.h" #include "cpu/m6809/konami.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/watchdog.h" diff --git a/src/mame/drivers/ajax.cpp b/src/mame/drivers/ajax.cpp index 143c7633f1e..1e7b55127fa 100644 --- a/src/mame/drivers/ajax.cpp +++ b/src/mame/drivers/ajax.cpp @@ -16,7 +16,7 @@ #include "cpu/z80/z80.h" #include "cpu/m6809/m6809.h" #include "cpu/m6809/konami.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/ajax.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/aliens.cpp b/src/mame/drivers/aliens.cpp index 8b35cd22888..257c70ab0ab 100644 --- a/src/mame/drivers/aliens.cpp +++ b/src/mame/drivers/aliens.cpp @@ -13,7 +13,7 @@ Preliminary driver by: #include "cpu/z80/z80.h" #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/aliens.h" diff --git a/src/mame/drivers/aquarium.cpp b/src/mame/drivers/aquarium.cpp index 07d4dc17321..88de9d913fa 100644 --- a/src/mame/drivers/aquarium.cpp +++ b/src/mame/drivers/aquarium.cpp @@ -36,7 +36,7 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/aquarium.h" diff --git a/src/mame/drivers/asterix.cpp b/src/mame/drivers/asterix.cpp index 03f58aa8f06..51dd931f416 100644 --- a/src/mame/drivers/asterix.cpp +++ b/src/mame/drivers/asterix.cpp @@ -16,7 +16,7 @@ TODO: #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/eepromser.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/k053260.h" #include "includes/konamipt.h" #include "includes/asterix.h" diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp index c3075697c5f..dcf86e81ce7 100644 --- a/src/mame/drivers/asuka.cpp +++ b/src/mame/drivers/asuka.cpp @@ -223,7 +223,7 @@ DIP locations verified for: #include "audio/taitosnd.h" #include "machine/watchdog.h" #include "sound/2610intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "includes/asuka.h" #include "machine/bonzeadv.h" diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp index 6f304e1f1c8..e9b875c1b6d 100644 --- a/src/mame/drivers/atarisy1.cpp +++ b/src/mame/drivers/atarisy1.cpp @@ -196,7 +196,7 @@ RoadBlasters (aka Future Vette):005* #include "machine/atarigen.h" #include "machine/6522via.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/pokey.h" #include "video/atarimo.h" #include "includes/atarisy1.h" diff --git a/src/mame/drivers/badlands.cpp b/src/mame/drivers/badlands.cpp index 17f7cf3369a..90ae1a82234 100644 --- a/src/mame/drivers/badlands.cpp +++ b/src/mame/drivers/badlands.cpp @@ -168,7 +168,7 @@ Measurements - #include "cpu/m68000/m68000.h" #include "cpu/m6502/m6502.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/badlands.h" diff --git a/src/mame/drivers/bingoc.cpp b/src/mame/drivers/bingoc.cpp index 388d813a5bb..2ec0fe3e47c 100644 --- a/src/mame/drivers/bingoc.cpp +++ b/src/mame/drivers/bingoc.cpp @@ -33,7 +33,7 @@ SOUND : YM2151 uPD7759C #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/upd7759.h" diff --git a/src/mame/drivers/bionicc.cpp b/src/mame/drivers/bionicc.cpp index c5daebc5512..c36ebafe9ce 100644 --- a/src/mame/drivers/bionicc.cpp +++ b/src/mame/drivers/bionicc.cpp @@ -60,7 +60,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/bionicc.h" diff --git a/src/mame/drivers/blockhl.cpp b/src/mame/drivers/blockhl.cpp index a59c5313544..afee149859d 100644 --- a/src/mame/drivers/blockhl.cpp +++ b/src/mame/drivers/blockhl.cpp @@ -25,7 +25,7 @@ #include "machine/watchdog.h" #include "video/k052109.h" #include "video/k051960.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/blockout.cpp b/src/mame/drivers/blockout.cpp index bb8b9d370d6..c9c719ed387 100644 --- a/src/mame/drivers/blockout.cpp +++ b/src/mame/drivers/blockout.cpp @@ -69,7 +69,7 @@ #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/blockout.h" diff --git a/src/mame/drivers/boogwing.cpp b/src/mame/drivers/boogwing.cpp index f02e4160f8f..780070251f8 100644 --- a/src/mame/drivers/boogwing.cpp +++ b/src/mame/drivers/boogwing.cpp @@ -87,7 +87,7 @@ #include "machine/deco102.h" #include "machine/decocrpt.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" READ16_MEMBER( boogwing_state::boogwing_protection_region_0_104_r ) diff --git a/src/mame/drivers/cabal.cpp b/src/mame/drivers/cabal.cpp index 6a7629a5a6c..71b93b4915e 100644 --- a/src/mame/drivers/cabal.cpp +++ b/src/mame/drivers/cabal.cpp @@ -47,7 +47,7 @@ Dip locations verified with Fabtek manual for the trackball version #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "includes/cabal.h" diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index 909a3007e56..c22b7b48539 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -81,7 +81,7 @@ Versions known to exist but not dumped: #include "cpu/z80/z80.h" #include "includes/cave.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/ymz280b.h" #include "ppsatan.lh" diff --git a/src/mame/drivers/cbuster.cpp b/src/mame/drivers/cbuster.cpp index 90bed21b655..e9f29bd5234 100644 --- a/src/mame/drivers/cbuster.cpp +++ b/src/mame/drivers/cbuster.cpp @@ -36,7 +36,7 @@ #include "cpu/h6280/h6280.h" #include "includes/cbuster.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" WRITE16_MEMBER(cbuster_state::twocrude_control_w) diff --git a/src/mame/drivers/chinagat.cpp b/src/mame/drivers/chinagat.cpp index b6b6db080b3..52a52ae5d33 100644 --- a/src/mame/drivers/chinagat.cpp +++ b/src/mame/drivers/chinagat.cpp @@ -76,7 +76,7 @@ Dip locations and factory settings verified with China Gate US manual. #include "cpu/m6809/m6809.h" #include "cpu/z80/z80.h" #include "cpu/mcs48/mcs48.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/2203intf.h" #include "sound/okim6295.h" #include "includes/ddragon.h" diff --git a/src/mame/drivers/chqflag.cpp b/src/mame/drivers/chqflag.cpp index 2a89ee1919b..a1a00780ef1 100644 --- a/src/mame/drivers/chqflag.cpp +++ b/src/mame/drivers/chqflag.cpp @@ -18,7 +18,7 @@ #include "cpu/z80/z80.h" #include "cpu/m6809/konami.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/chqflag.h" #include "includes/konamipt.h" #include "chqflag.lh" diff --git a/src/mame/drivers/cischeat.cpp b/src/mame/drivers/cischeat.cpp index e36cde2e1b8..c116effd6d0 100644 --- a/src/mame/drivers/cischeat.cpp +++ b/src/mame/drivers/cischeat.cpp @@ -171,7 +171,7 @@ Cisco Heat. #include "emu.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "machine/jalcrpt.h" #include "includes/cischeat.h" diff --git a/src/mame/drivers/cninja.cpp b/src/mame/drivers/cninja.cpp index ac43b80b4bf..3531d53b847 100644 --- a/src/mame/drivers/cninja.cpp +++ b/src/mame/drivers/cninja.cpp @@ -49,7 +49,7 @@ Note about version levels using Mutant Fighter as the example: #include "includes/cninja.h" #include "machine/decocrpt.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" WRITE16_MEMBER(cninja_state::cninja_sound_w) diff --git a/src/mame/drivers/contra.cpp b/src/mame/drivers/contra.cpp index 82550236657..b6ef8a34417 100644 --- a/src/mame/drivers/contra.cpp +++ b/src/mame/drivers/contra.cpp @@ -22,7 +22,7 @@ Dip locations and factory settings verified with manual #include "cpu/m6809/hd6309.h" #include "cpu/m6809/m6809.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/contra.h" diff --git a/src/mame/drivers/cps1.cpp b/src/mame/drivers/cps1.cpp index 193f031e037..cf950ed78a8 100644 --- a/src/mame/drivers/cps1.cpp +++ b/src/mame/drivers/cps1.cpp @@ -242,7 +242,7 @@ Stephh's log (2006.09.20) : #include "cpu/pic16c5x/pic16c5x.h" #include "cpu/m68000/m68000.h" #include "machine/eepromser.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/qsound.h" #include "machine/kabuki.h" diff --git a/src/mame/drivers/crimfght.cpp b/src/mame/drivers/crimfght.cpp index 89adee82837..4b5397d6393 100644 --- a/src/mame/drivers/crimfght.cpp +++ b/src/mame/drivers/crimfght.cpp @@ -17,7 +17,7 @@ #include "cpu/z80/z80.h" #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/crimfght.h" diff --git a/src/mame/drivers/cyberbal.cpp b/src/mame/drivers/cyberbal.cpp index ead47e3d344..6798d43c693 100644 --- a/src/mame/drivers/cyberbal.cpp +++ b/src/mame/drivers/cyberbal.cpp @@ -23,7 +23,7 @@ #include "emu.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "rendlay.h" #include "includes/cyberbal.h" diff --git a/src/mame/drivers/darkseal.cpp b/src/mame/drivers/darkseal.cpp index bbe8901ae6e..a212f36c041 100644 --- a/src/mame/drivers/darkseal.cpp +++ b/src/mame/drivers/darkseal.cpp @@ -21,7 +21,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/darkseal.h" diff --git a/src/mame/drivers/dassault.cpp b/src/mame/drivers/dassault.cpp index 95578188cf2..c7a3c5c2b96 100644 --- a/src/mame/drivers/dassault.cpp +++ b/src/mame/drivers/dassault.cpp @@ -211,7 +211,7 @@ Dip locations verified with US conversion kit manual. #include "cpu/h6280/h6280.h" #include "includes/dassault.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" /**********************************************************************************/ diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp index bf5cc684c3e..8b842da4a03 100644 --- a/src/mame/drivers/dblewing.cpp +++ b/src/mame/drivers/dblewing.cpp @@ -71,7 +71,7 @@ Notes: #include "cpu/m68000/m68000.h" #include "machine/decocrpt.h" #include "machine/deco102.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "video/deco16ic.h" #include "video/decospr.h" diff --git a/src/mame/drivers/dbz.cpp b/src/mame/drivers/dbz.cpp index 074a34826f7..29f84dccbc6 100644 --- a/src/mame/drivers/dbz.cpp +++ b/src/mame/drivers/dbz.cpp @@ -55,7 +55,7 @@ Notes: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/dbz.h" diff --git a/src/mame/drivers/ddragon.cpp b/src/mame/drivers/ddragon.cpp index 7fcb26fb459..f5e995bd031 100644 --- a/src/mame/drivers/ddragon.cpp +++ b/src/mame/drivers/ddragon.cpp @@ -58,7 +58,7 @@ Dip locations verified with manual for ddragon & ddragon2 #include "cpu/m6805/m6805.h" #include "cpu/m6809/m6809.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/ddragon.h" diff --git a/src/mame/drivers/ddragon3.cpp b/src/mame/drivers/ddragon3.cpp index 4fe00e232b0..58cb491e9b1 100644 --- a/src/mame/drivers/ddragon3.cpp +++ b/src/mame/drivers/ddragon3.cpp @@ -185,7 +185,7 @@ ROMs (All ROMs are 27C010 EPROM. - means not populated) #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/ddragon3.h" diff --git a/src/mame/drivers/de_2.cpp b/src/mame/drivers/de_2.cpp index d51d3d5f4a3..e953fece289 100644 --- a/src/mame/drivers/de_2.cpp +++ b/src/mame/drivers/de_2.cpp @@ -15,7 +15,7 @@ #include "cpu/m6809/m6809.h" #include "machine/decopincpu.h" #include "machine/6821pia.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "de2.lh" #include "de2a3.lh" diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index 176419ce338..8a341c2c765 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -371,7 +371,7 @@ NOTE: There are several unpopulated locations (denoted by *) for additional rom #include "machine/decocrpt.h" #include "machine/deco156.h" #include "includes/deco32.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" /**********************************************************************************/ diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp index 0d27c9dea85..b5a3f154b11 100644 --- a/src/mame/drivers/dietgo.cpp +++ b/src/mame/drivers/dietgo.cpp @@ -23,7 +23,7 @@ PAL16R6A 11H #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "machine/decocrpt.h" #include "machine/deco102.h" diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp index 50ab7f5e64f..fd9aa8f77cd 100644 --- a/src/mame/drivers/dooyong.cpp +++ b/src/mame/drivers/dooyong.cpp @@ -78,7 +78,7 @@ are almost identical, except for much darker BG layer colors). #include "cpu/m68000/m68000.h" #include "machine/gen_latch.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/dooyong.h" diff --git a/src/mame/drivers/exterm.cpp b/src/mame/drivers/exterm.cpp index d0432f005f6..0db0060e437 100644 --- a/src/mame/drivers/exterm.cpp +++ b/src/mame/drivers/exterm.cpp @@ -66,7 +66,7 @@ #include "cpu/tms34010/tms34010.h" #include "cpu/m6502/m6502.h" #include "sound/dac.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "includes/exterm.h" diff --git a/src/mame/drivers/exzisus.cpp b/src/mame/drivers/exzisus.cpp index 2c0830798ea..ddb590701c7 100644 --- a/src/mame/drivers/exzisus.cpp +++ b/src/mame/drivers/exzisus.cpp @@ -39,7 +39,7 @@ TODO: #include "cpu/z80/z80.h" #include "includes/taitoipt.h" #include "audio/taitosnd.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/exzisus.h" diff --git a/src/mame/drivers/f-32.cpp b/src/mame/drivers/f-32.cpp index a3fa89710d5..3d994121908 100644 --- a/src/mame/drivers/f-32.cpp +++ b/src/mame/drivers/f-32.cpp @@ -30,7 +30,7 @@ f5 #include "emu.h" #include "cpu/e132xs/e132xs.h" #include "machine/eepromser.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" class mosaicf2_state : public driver_device diff --git a/src/mame/drivers/fantland.cpp b/src/mame/drivers/fantland.cpp index dd1ebe141d7..06f807891a5 100644 --- a/src/mame/drivers/fantland.cpp +++ b/src/mame/drivers/fantland.cpp @@ -49,7 +49,7 @@ Year + Game Main CPU Sound CPU Sound Video #include "cpu/z80/z80.h" #include "cpu/nec/nec.h" #include "cpu/i86/i86.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3526intf.h" #include "sound/dac.h" #include "includes/fantland.h" diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp index a70ccb2cbed..e344c87fbe5 100644 --- a/src/mame/drivers/fb01.cpp +++ b/src/mame/drivers/fb01.cpp @@ -8,7 +8,7 @@ #include "emu.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "video/hd44780.h" #include "machine/i8251.h" diff --git a/src/mame/drivers/fcrash.cpp b/src/mame/drivers/fcrash.cpp index 07b60b63649..ac5f9eafee4 100644 --- a/src/mame/drivers/fcrash.cpp +++ b/src/mame/drivers/fcrash.cpp @@ -91,7 +91,7 @@ slampic: no sound. A priority problem between sprites and crowd. #include "includes/cps1.h" #include "sound/2203intf.h" #include "sound/msm5205.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "machine/eepromser.h" diff --git a/src/mame/drivers/flkatck.cpp b/src/mame/drivers/flkatck.cpp index 6a2cc418a79..57b6d209c80 100644 --- a/src/mame/drivers/flkatck.cpp +++ b/src/mame/drivers/flkatck.cpp @@ -15,7 +15,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m6809/hd6309.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/flkatck.h" diff --git a/src/mame/drivers/funkyjet.cpp b/src/mame/drivers/funkyjet.cpp index 9ab39a3f0c6..44f4e923553 100644 --- a/src/mame/drivers/funkyjet.cpp +++ b/src/mame/drivers/funkyjet.cpp @@ -95,7 +95,7 @@ Notes: #include "machine/decocrpt.h" #include "machine/gen_latch.h" #include "includes/funkyjet.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp index 39a20fe191b..d2e52e5fbb4 100644 --- a/src/mame/drivers/gaiden.cpp +++ b/src/mame/drivers/gaiden.cpp @@ -135,7 +135,7 @@ Notes: #include "cpu/z80/z80.h" #include "machine/watchdog.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/gaiden.h" diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 2436731958a..74f8ead74d5 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -125,7 +125,7 @@ #include "cpu/m6502/m6502.h" #include "machine/watchdog.h" #include "sound/tms5220.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/pokey.h" #include "includes/gauntlet.h" diff --git a/src/mame/drivers/gotcha.cpp b/src/mame/drivers/gotcha.cpp index d571a608f2d..e73a66048bf 100644 --- a/src/mame/drivers/gotcha.cpp +++ b/src/mame/drivers/gotcha.cpp @@ -63,7 +63,7 @@ Notes: #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/gotcha.h" diff --git a/src/mame/drivers/gradius3.cpp b/src/mame/drivers/gradius3.cpp index cd9111eb19e..3e4da6283e7 100644 --- a/src/mame/drivers/gradius3.cpp +++ b/src/mame/drivers/gradius3.cpp @@ -28,7 +28,7 @@ #include "cpu/z80/z80.h" #include "machine/gen_latch.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/gradius3.h" diff --git a/src/mame/drivers/hyprduel.cpp b/src/mame/drivers/hyprduel.cpp index 356be1ef249..aee5bbd05ff 100644 --- a/src/mame/drivers/hyprduel.cpp +++ b/src/mame/drivers/hyprduel.cpp @@ -38,7 +38,7 @@ fix comms so it boots, it's a bit of a hack for hyperduel at the moment ;-) #include "emu.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/2413intf.h" #include "includes/hyprduel.h" diff --git a/src/mame/drivers/jackal.cpp b/src/mame/drivers/jackal.cpp index 5dfc0c3b6ad..7f28f96d665 100644 --- a/src/mame/drivers/jackal.cpp +++ b/src/mame/drivers/jackal.cpp @@ -74,7 +74,7 @@ Address Dir Data Description #include "emu.h" #include "cpu/m6809/m6809.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/jackal.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp index 568e625ca37..b69406e5d51 100644 --- a/src/mame/drivers/kaneko16.cpp +++ b/src/mame/drivers/kaneko16.cpp @@ -101,7 +101,7 @@ Non-Bugs (happen on real PCB) #include "cpu/m68000/m68000.h" #include "includes/kaneko16.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/kaneko_hit.h" diff --git a/src/mame/drivers/lemmings.cpp b/src/mame/drivers/lemmings.cpp index 1a2add50c99..f146938b059 100644 --- a/src/mame/drivers/lemmings.cpp +++ b/src/mame/drivers/lemmings.cpp @@ -20,7 +20,7 @@ #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/lemmings.h" diff --git a/src/mame/drivers/m107.cpp b/src/mame/drivers/m107.cpp index e2a057b39b7..01cfb02a90c 100644 --- a/src/mame/drivers/m107.cpp +++ b/src/mame/drivers/m107.cpp @@ -31,7 +31,7 @@ confirmed for m107 games as well. #include "includes/m107.h" #include "includes/iremipt.h" #include "machine/irem_cpu.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/iremga20.h" // this is the hacky code from m92.c, but better than per-game irq vector hacks. diff --git a/src/mame/drivers/m72.cpp b/src/mame/drivers/m72.cpp index 84e51098f57..0280a91cc60 100644 --- a/src/mame/drivers/m72.cpp +++ b/src/mame/drivers/m72.cpp @@ -188,7 +188,7 @@ other supported games as well. #include "cpu/nec/nec.h" #include "cpu/nec/v25.h" #include "machine/irem_cpu.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/iremipt.h" #include "includes/m72.h" #include "cpu/mcs51/mcs51.h" diff --git a/src/mame/drivers/m90.cpp b/src/mame/drivers/m90.cpp index 9bc262da880..37a1bc99138 100644 --- a/src/mame/drivers/m90.cpp +++ b/src/mame/drivers/m90.cpp @@ -25,7 +25,7 @@ #include "includes/iremipt.h" #include "machine/irem_cpu.h" #include "sound/dac.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/m90.h" diff --git a/src/mame/drivers/m92.cpp b/src/mame/drivers/m92.cpp index 2b17ab8bce0..43af99b2524 100644 --- a/src/mame/drivers/m92.cpp +++ b/src/mame/drivers/m92.cpp @@ -206,7 +206,7 @@ psoldier dip locations still need verification. #include "includes/m92.h" #include "includes/iremipt.h" #include "machine/irem_cpu.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/iremga20.h" diff --git a/src/mame/drivers/madmotor.cpp b/src/mame/drivers/madmotor.cpp index ef0f0e1ef9b..74b4215cd40 100644 --- a/src/mame/drivers/madmotor.cpp +++ b/src/mame/drivers/madmotor.cpp @@ -18,7 +18,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/madmotor.h" diff --git a/src/mame/drivers/mainevt.cpp b/src/mame/drivers/mainevt.cpp index df053833820..ee1cf77313f 100644 --- a/src/mame/drivers/mainevt.cpp +++ b/src/mame/drivers/mainevt.cpp @@ -27,7 +27,7 @@ Notes: #include "cpu/m6809/hd6309.h" #include "cpu/m6809/m6809.h" #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/mainevt.h" diff --git a/src/mame/drivers/megasys1.cpp b/src/mame/drivers/megasys1.cpp index 9cd36745da0..92314029c94 100644 --- a/src/mame/drivers/megasys1.cpp +++ b/src/mame/drivers/megasys1.cpp @@ -128,7 +128,7 @@ RAM RW 0f0000-0f3fff 0e0000-0effff? < #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/jalcrpt.h" #include "includes/megasys1.h" diff --git a/src/mame/drivers/micro3d.cpp b/src/mame/drivers/micro3d.cpp index 69c65059836..41c560e7070 100644 --- a/src/mame/drivers/micro3d.cpp +++ b/src/mame/drivers/micro3d.cpp @@ -29,7 +29,7 @@ #include "cpu/mcs51/mcs51.h" #include "machine/mc68681.h" #include "machine/mc68901.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "includes/micro3d.h" diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp index 07d37c9cff9..f321c4c7939 100644 --- a/src/mame/drivers/mlanding.cpp +++ b/src/mame/drivers/mlanding.cpp @@ -50,7 +50,7 @@ #include "includes/taitoipt.h" #include "machine/z80ctc.h" #include "audio/taitosnd.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" diff --git a/src/mame/drivers/moo.cpp b/src/mame/drivers/moo.cpp index f1e05fff9e0..95f781bc5b1 100644 --- a/src/mame/drivers/moo.cpp +++ b/src/mame/drivers/moo.cpp @@ -118,7 +118,7 @@ Bucky: #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/eepromser.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/k054539.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/mugsmash.cpp b/src/mame/drivers/mugsmash.cpp index 0cee7ed9153..75271f73223 100644 --- a/src/mame/drivers/mugsmash.cpp +++ b/src/mame/drivers/mugsmash.cpp @@ -44,7 +44,7 @@ behavior we use . #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/mugsmash.h" diff --git a/src/mame/drivers/namcos1.cpp b/src/mame/drivers/namcos1.cpp index 4fb045627b0..7ffb0a192a8 100644 --- a/src/mame/drivers/namcos1.cpp +++ b/src/mame/drivers/namcos1.cpp @@ -338,7 +338,7 @@ C - uses sub board with support for player 3 and 4 controls #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "includes/namcos1.h" diff --git a/src/mame/drivers/namcos2.cpp b/src/mame/drivers/namcos2.cpp index ff872936921..6b067727e1f 100644 --- a/src/mame/drivers/namcos2.cpp +++ b/src/mame/drivers/namcos2.cpp @@ -453,7 +453,7 @@ $a00000 checks have been seen on the Final Lap boards. #include "cpu/m6809/m6809.h" #include "includes/namcoic.h" #include "machine/nvram.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/c140.h" #include "finallap.lh" diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index a6ccb0f8875..983af62a30b 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -524,7 +524,7 @@ Filter Board #include "cpu/m6809/m6809.h" #include "cpu/tms32025/tms32025.h" #include "includes/namcoic.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/c140.h" #include "includes/namcos21.h" #include "machine/nvram.h" diff --git a/src/mame/drivers/namcos86.cpp b/src/mame/drivers/namcos86.cpp index 094fd5a4138..97b4dddd6bf 100644 --- a/src/mame/drivers/namcos86.cpp +++ b/src/mame/drivers/namcos86.cpp @@ -177,7 +177,7 @@ TODO: #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/n63701x.h" #include "includes/namcos86.h" diff --git a/src/mame/drivers/nemesis.cpp b/src/mame/drivers/nemesis.cpp index ee481f5040e..6fac76bf94b 100644 --- a/src/mame/drivers/nemesis.cpp +++ b/src/mame/drivers/nemesis.cpp @@ -54,7 +54,7 @@ So this is the correct behavior of real hardware, not an emulation bug. #include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ay8910.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "sound/k051649.h" #include "includes/nemesis.h" diff --git a/src/mame/drivers/opwolf.cpp b/src/mame/drivers/opwolf.cpp index f1e607c482f..3751c60a2ff 100644 --- a/src/mame/drivers/opwolf.cpp +++ b/src/mame/drivers/opwolf.cpp @@ -282,7 +282,7 @@ register. So what is controlling priority. #include "cpu/m68000/m68000.h" #include "includes/taitoipt.h" #include "audio/taitosnd.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "includes/opwolf.h" diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index c5b1f19898d..9d56c0d7225 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -31,7 +31,7 @@ #include "video/k053250.h" #include "machine/eepromser.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/k053260.h" #include "includes/overdriv.h" diff --git a/src/mame/drivers/parodius.cpp b/src/mame/drivers/parodius.cpp index 1706aaf53ea..a5fa9f3b9b9 100644 --- a/src/mame/drivers/parodius.cpp +++ b/src/mame/drivers/parodius.cpp @@ -12,7 +12,7 @@ #include "cpu/z80/z80.h" #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/k053260.h" #include "includes/konamipt.h" #include "includes/parodius.h" diff --git a/src/mame/drivers/rastan.cpp b/src/mame/drivers/rastan.cpp index ad62a646ebe..95a2af14072 100644 --- a/src/mame/drivers/rastan.cpp +++ b/src/mame/drivers/rastan.cpp @@ -159,7 +159,7 @@ Note: The 'rastsagaa' set's rom numbers were named as RSxx_37 through RSxx_42 #include "machine/watchdog.h" #include "includes/taitoipt.h" #include "audio/taitosnd.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "includes/rastan.h" diff --git a/src/mame/drivers/rbisland.cpp b/src/mame/drivers/rbisland.cpp index c71c201750d..30eca45adb7 100644 --- a/src/mame/drivers/rbisland.cpp +++ b/src/mame/drivers/rbisland.cpp @@ -325,7 +325,7 @@ Stephh's notes (based on the game M68000 code and some tests) : #include "includes/taitoipt.h" #include "audio/taitosnd.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/rbisland.h" diff --git a/src/mame/drivers/rbmk.cpp b/src/mame/drivers/rbmk.cpp index de71f98e760..127967fa23a 100644 --- a/src/mame/drivers/rbmk.cpp +++ b/src/mame/drivers/rbmk.cpp @@ -55,7 +55,7 @@ Notes: #include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" #include "sound/okim6295.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/eepromser.h" diff --git a/src/mame/drivers/rockrage.cpp b/src/mame/drivers/rockrage.cpp index 706efdddde4..7a988fda984 100644 --- a/src/mame/drivers/rockrage.cpp +++ b/src/mame/drivers/rockrage.cpp @@ -53,7 +53,7 @@ Notes: #include "cpu/m6809/m6809.h" #include "cpu/m6809/hd6309.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/rockrage.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/rohga.cpp b/src/mame/drivers/rohga.cpp index 0fb48078601..7a371beb3bf 100644 --- a/src/mame/drivers/rohga.cpp +++ b/src/mame/drivers/rohga.cpp @@ -112,7 +112,7 @@ #include "machine/decocrpt.h" #include "machine/gen_latch.h" #include "includes/rohga.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" READ16_MEMBER(rohga_state::rohga_irq_ack_r) diff --git a/src/mame/drivers/rpunch.cpp b/src/mame/drivers/rpunch.cpp index 66391efbcbf..112c0f38874 100644 --- a/src/mame/drivers/rpunch.cpp +++ b/src/mame/drivers/rpunch.cpp @@ -110,7 +110,7 @@ #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/rpunch.h" diff --git a/src/mame/drivers/s11.cpp b/src/mame/drivers/s11.cpp index 02da6935124..c8fb4f85934 100644 --- a/src/mame/drivers/s11.cpp +++ b/src/mame/drivers/s11.cpp @@ -23,7 +23,7 @@ ToDo: #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" #include "sound/hc55516.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "audio/s11c_bg.h" #include "includes/s11.h" diff --git a/src/mame/drivers/s11a.cpp b/src/mame/drivers/s11a.cpp index 96d942d963f..c809eabf3e7 100644 --- a/src/mame/drivers/s11a.cpp +++ b/src/mame/drivers/s11a.cpp @@ -26,7 +26,7 @@ Note: To start a game, certain switches need to be activated. You must first pr #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" #include "sound/hc55516.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "audio/s11c_bg.h" #include "includes/s11a.h" diff --git a/src/mame/drivers/s11b.cpp b/src/mame/drivers/s11b.cpp index db3f7faeacf..a9f074adc5e 100644 --- a/src/mame/drivers/s11b.cpp +++ b/src/mame/drivers/s11b.cpp @@ -26,7 +26,7 @@ #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" #include "sound/hc55516.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "audio/s11c_bg.h" #include "includes/s11b.h" diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp index f1409047f01..5efd4c9e5ae 100644 --- a/src/mame/drivers/s11c.cpp +++ b/src/mame/drivers/s11c.cpp @@ -10,7 +10,7 @@ #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" #include "sound/hc55516.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "audio/s11c_bg.h" #include "includes/s11c.h" diff --git a/src/mame/drivers/sandscrp.cpp b/src/mame/drivers/sandscrp.cpp index e06ca1c6e67..16da2fd9722 100644 --- a/src/mame/drivers/sandscrp.cpp +++ b/src/mame/drivers/sandscrp.cpp @@ -78,7 +78,7 @@ Is there another alt program rom set labeled 9 & 10? #include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "video/kan_pand.h" #include "machine/kaneko_hit.h" diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index ec657f6dc01..b1d1c178394 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -20,7 +20,7 @@ #include "machine/fd1089.h" #include "machine/fd1094.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/segapcm.h" #include "includes/segaipt.h" diff --git a/src/mame/drivers/segaorun.cpp b/src/mame/drivers/segaorun.cpp index a3e33761331..3226cc88bfa 100644 --- a/src/mame/drivers/segaorun.cpp +++ b/src/mame/drivers/segaorun.cpp @@ -274,7 +274,7 @@ Notes: #include "emu.h" #include "includes/segaorun.h" #include "machine/fd1089.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/segapcm.h" #include "includes/segaipt.h" diff --git a/src/mame/drivers/segas24.cpp b/src/mame/drivers/segas24.cpp index 9cb65b09071..d6e5deaf9fa 100644 --- a/src/mame/drivers/segas24.cpp +++ b/src/mame/drivers/segas24.cpp @@ -339,7 +339,7 @@ Notes: #include "cpu/m68000/m68000.h" #include "sound/ym2151.h" #include "sound/dac.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/fd1094.h" #include "machine/nvram.h" #include "video/segaic24.h" diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 76f9db19643..9d4cb0a5c67 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -263,7 +263,7 @@ ROMs: #include "emu.h" #include "includes/segaxbd.h" #include "machine/nvram.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/segapcm.h" #include "includes/segaipt.h" diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp index 54212cb0da8..9495f33306b 100644 --- a/src/mame/drivers/segaybd.cpp +++ b/src/mame/drivers/segaybd.cpp @@ -60,7 +60,7 @@ MB89372 - Uses 3 serial data transfer protocols: ASYNC, COP & BOP. Has a built #include "includes/segaybd.h" #include "machine/mb8421.h" #include "machine/nvram.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/segapcm.h" #include "includes/segaipt.h" diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index 9d2b4a26441..03481b39564 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -1372,7 +1372,7 @@ Note: on screen copyright is (c)1998 Coinmaster. #include "sound/2612intf.h" #include "sound/3812intf.h" #include "sound/okim6295.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "machine/watchdog.h" diff --git a/src/mame/drivers/sf.cpp b/src/mame/drivers/sf.cpp index 5b751885904..2be49c5a124 100644 --- a/src/mame/drivers/sf.cpp +++ b/src/mame/drivers/sf.cpp @@ -14,7 +14,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/sf.h" diff --git a/src/mame/drivers/shadfrce.cpp b/src/mame/drivers/shadfrce.cpp index 434fb0f4184..62a6c229a6d 100644 --- a/src/mame/drivers/shadfrce.cpp +++ b/src/mame/drivers/shadfrce.cpp @@ -143,7 +143,7 @@ lev 7 : 0x7c : 0000 11d0 - just rte #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/shadfrce.h" diff --git a/src/mame/drivers/shisen.cpp b/src/mame/drivers/shisen.cpp index 1ad20d759f1..6954a34b2f3 100644 --- a/src/mame/drivers/shisen.cpp +++ b/src/mame/drivers/shisen.cpp @@ -11,7 +11,7 @@ driver by Nicola Salmoria #include "emu.h" #include "cpu/z80/z80.h" #include "sound/dac.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/shisen.h" READ8_MEMBER(shisen_state::dsw1_r) diff --git a/src/mame/drivers/sidearms.cpp b/src/mame/drivers/sidearms.cpp index 2890bf9438b..35341c137e8 100644 --- a/src/mame/drivers/sidearms.cpp +++ b/src/mame/drivers/sidearms.cpp @@ -49,7 +49,7 @@ Notes: #include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/sidearms.h" void sidearms_state::machine_start() diff --git a/src/mame/drivers/silkroad.cpp b/src/mame/drivers/silkroad.cpp index 17a42041e8b..9edc760cd0b 100644 --- a/src/mame/drivers/silkroad.cpp +++ b/src/mame/drivers/silkroad.cpp @@ -8,7 +8,7 @@ #include "emu.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/silkroad.h" diff --git a/src/mame/drivers/silvmil.cpp b/src/mame/drivers/silvmil.cpp index 72948726546..9a9ca868bc4 100644 --- a/src/mame/drivers/silvmil.cpp +++ b/src/mame/drivers/silvmil.cpp @@ -29,7 +29,7 @@ Very likely to be 'whatever crystals we had on hand which were close enough for #include "machine/gen_latch.h" #include "sound/okim6295.h" #include "video/decospr.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" class silvmil_state : public driver_device diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp index cf2aca9ebdf..0d4b65eb120 100644 --- a/src/mame/drivers/simpsons.cpp +++ b/src/mame/drivers/simpsons.cpp @@ -102,7 +102,7 @@ Notes: #include "machine/eepromser.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/k053260.h" #include "includes/simpsons.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp index 48e763e179f..ae59208aaf3 100644 --- a/src/mame/drivers/snowbros.cpp +++ b/src/mame/drivers/snowbros.cpp @@ -78,7 +78,7 @@ a joystick. This is not an emulation bug. #include "includes/snowbros.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "cpu/mcs51/mcs51.h" // for semicom mcu #include "machine/watchdog.h" diff --git a/src/mame/drivers/suna16.cpp b/src/mame/drivers/suna16.cpp index d7555c3118e..e32d00c6f16 100644 --- a/src/mame/drivers/suna16.cpp +++ b/src/mame/drivers/suna16.cpp @@ -27,7 +27,7 @@ Year + Game By Board Hardware #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/ay8910.h" #include "sound/3526intf.h" #include "includes/suna16.h" diff --git a/src/mame/drivers/supbtime.cpp b/src/mame/drivers/supbtime.cpp index d16806d13d9..d4d4ff92354 100644 --- a/src/mame/drivers/supbtime.cpp +++ b/src/mame/drivers/supbtime.cpp @@ -25,7 +25,7 @@ down hardware (it doesn't write any good sound data btw, mostly zeros). #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/supbtime.h" diff --git a/src/mame/drivers/surpratk.cpp b/src/mame/drivers/surpratk.cpp index 180ee2f0e4e..df8cce02f09 100644 --- a/src/mame/drivers/surpratk.cpp +++ b/src/mame/drivers/surpratk.cpp @@ -13,7 +13,7 @@ #include "emu.h" #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/surpratk.h" diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp index 2316b5b72f4..01594e25506 100644 --- a/src/mame/drivers/system16.cpp +++ b/src/mame/drivers/system16.cpp @@ -92,7 +92,7 @@ #include "cpu/z80/z80.h" #include "includes/system16.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/2612intf.h" #include "sound/rf5c68.h" #include "sound/2203intf.h" diff --git a/src/mame/drivers/taito_x.cpp b/src/mame/drivers/taito_x.cpp index 4d1a8f88731..1cb4bae5933 100644 --- a/src/mame/drivers/taito_x.cpp +++ b/src/mame/drivers/taito_x.cpp @@ -323,7 +323,7 @@ Stephh's notes (based on the game M68000 code and some tests) : #include "includes/taito_x.h" #include "machine/cchip.h" #include "sound/2610intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" READ16_MEMBER(taitox_state::superman_dsw_input_r) { diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index 163a8987db3..a2717528521 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -143,7 +143,7 @@ #include "cpu/z80/z80.h" #include "cpu/nec/nec.h" #include "includes/tatsumi.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/nvram.h" #include "roundup5.lh" diff --git a/src/mame/drivers/tceptor.cpp b/src/mame/drivers/tceptor.cpp index ed0a1d79207..84eeae9edbe 100644 --- a/src/mame/drivers/tceptor.cpp +++ b/src/mame/drivers/tceptor.cpp @@ -13,7 +13,7 @@ #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" #include "cpu/m68000/m68000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "rendlay.h" #include "tceptor2.lh" #include "includes/tceptor.h" diff --git a/src/mame/drivers/tecmo16.cpp b/src/mame/drivers/tecmo16.cpp index dd1c30d5f70..b1a33a42128 100644 --- a/src/mame/drivers/tecmo16.cpp +++ b/src/mame/drivers/tecmo16.cpp @@ -28,7 +28,7 @@ Notes: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/tecmo16.h" diff --git a/src/mame/drivers/thunderx.cpp b/src/mame/drivers/thunderx.cpp index 42e78c0a8a1..fca3af14cb5 100644 --- a/src/mame/drivers/thunderx.cpp +++ b/src/mame/drivers/thunderx.cpp @@ -37,7 +37,7 @@ #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/gen_latch.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/konamipt.h" #include "includes/thunderx.h" diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp index 92ca1bf0d52..6f5aef5d5bb 100644 --- a/src/mame/drivers/tmnt.cpp +++ b/src/mame/drivers/tmnt.cpp @@ -58,7 +58,7 @@ Updates: #include "machine/eepromser.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/samples.h" #include "sound/k054539.h" diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp index bbb15359f14..40e734cb960 100644 --- a/src/mame/drivers/tnzs.cpp +++ b/src/mame/drivers/tnzs.cpp @@ -626,7 +626,7 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/11/06 #include "includes/taitoipt.h" #include "sound/2203intf.h" #include "includes/tnzs.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" SAMPLES_START_CB_MEMBER(tnzs_state::kageki_init_samples) { diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp index afaf0db60da..084b7236212 100644 --- a/src/mame/drivers/toaplan2.cpp +++ b/src/mame/drivers/toaplan2.cpp @@ -356,7 +356,7 @@ To Do / Unknowns: #include "cpu/nec/v25.h" #include "cpu/z80/z80.h" #include "cpu/z180/z180.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "sound/ymz280b.h" #include "includes/toaplan2.h" diff --git a/src/mame/drivers/tomcat.cpp b/src/mame/drivers/tomcat.cpp index 78d6280c427..0470acf130b 100644 --- a/src/mame/drivers/tomcat.cpp +++ b/src/mame/drivers/tomcat.cpp @@ -36,7 +36,7 @@ #include "machine/6532riot.h" #include "sound/pokey.h" #include "sound/tms5220.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp index 512bb5b6b91..753a79a301e 100644 --- a/src/mame/drivers/topspeed.cpp +++ b/src/mame/drivers/topspeed.cpp @@ -161,7 +161,7 @@ From JP manual #include "machine/z80ctc.h" #include "machine/taitoio.h" #include "audio/taitosnd.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/msm5205.h" #include "sound/flt_vol.h" #include "includes/taitoipt.h" diff --git a/src/mame/drivers/tumbleb.cpp b/src/mame/drivers/tumbleb.cpp index 9a42c1f2304..7dff5713178 100644 --- a/src/mame/drivers/tumbleb.cpp +++ b/src/mame/drivers/tumbleb.cpp @@ -303,7 +303,7 @@ Stephh's notes (based on the games M68000 code and some tests) : #include "cpu/h6280/h6280.h" #include "cpu/mcs51/mcs51.h" // for semicom mcu #include "machine/decocrpt.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "sound/okim6295.h" #include "includes/tumbleb.h" diff --git a/src/mame/drivers/tumblep.cpp b/src/mame/drivers/tumblep.cpp index 3193f55bdf0..4beb483767d 100644 --- a/src/mame/drivers/tumblep.cpp +++ b/src/mame/drivers/tumblep.cpp @@ -45,7 +45,7 @@ Stephh's notes (based on the games M68000 code and some tests) : #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" #include "machine/decocrpt.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "sound/okim6295.h" #include "includes/tumblep.h" diff --git a/src/mame/drivers/twin16.cpp b/src/mame/drivers/twin16.cpp index 94b7b897dfe..bb5077ed122 100644 --- a/src/mame/drivers/twin16.cpp +++ b/src/mame/drivers/twin16.cpp @@ -48,7 +48,7 @@ Known Issues: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/watchdog.h" diff --git a/src/mame/drivers/ultraman.cpp b/src/mame/drivers/ultraman.cpp index 3e0813a87fd..77aabf6aa2f 100644 --- a/src/mame/drivers/ultraman.cpp +++ b/src/mame/drivers/ultraman.cpp @@ -15,7 +15,7 @@ #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/ultraman.h" diff --git a/src/mame/drivers/unico.cpp b/src/mame/drivers/unico.cpp index 91c165fadd9..5462050d1d4 100644 --- a/src/mame/drivers/unico.cpp +++ b/src/mame/drivers/unico.cpp @@ -28,7 +28,7 @@ Year + Game PCB Notes #include "cpu/m68000/m68000.h" #include "machine/eepromser.h" #include "includes/unico.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/3812intf.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/vamphalf.cpp b/src/mame/drivers/vamphalf.cpp index b84b9a6a817..1d295101d3e 100644 --- a/src/mame/drivers/vamphalf.cpp +++ b/src/mame/drivers/vamphalf.cpp @@ -64,7 +64,7 @@ TODO: #include "machine/eepromser.h" #include "machine/nvram.h" #include "sound/qs1000.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" diff --git a/src/mame/drivers/vaportra.cpp b/src/mame/drivers/vaportra.cpp index c258b8b812e..9b14ecb9d81 100644 --- a/src/mame/drivers/vaportra.cpp +++ b/src/mame/drivers/vaportra.cpp @@ -14,7 +14,7 @@ #include "cpu/m68000/m68000.h" #include "cpu/h6280/h6280.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/vaportra.h" diff --git a/src/mame/drivers/vball.cpp b/src/mame/drivers/vball.cpp index a4e70ebff79..de4d56c9065 100644 --- a/src/mame/drivers/vball.cpp +++ b/src/mame/drivers/vball.cpp @@ -87,7 +87,7 @@ VBlank = 58Hz #include "emu.h" #include "cpu/m6502/m6502.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/vball.h" diff --git a/src/mame/drivers/vendetta.cpp b/src/mame/drivers/vendetta.cpp index be350529af5..e803c5101f8 100644 --- a/src/mame/drivers/vendetta.cpp +++ b/src/mame/drivers/vendetta.cpp @@ -94,7 +94,7 @@ #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ #include "machine/eepromser.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/k053260.h" #include "includes/konamipt.h" #include "includes/vendetta.h" diff --git a/src/mame/drivers/vigilant.cpp b/src/mame/drivers/vigilant.cpp index 4b615dd94e6..af5b0dae08f 100644 --- a/src/mame/drivers/vigilant.cpp +++ b/src/mame/drivers/vigilant.cpp @@ -25,7 +25,7 @@ Bottom board - M75-B-A (all versions regardless of mask ROM/EPROM) #include "cpu/z80/z80.h" #include "sound/dac.h" #include "sound/2203intf.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "includes/vigilant.h" #include "includes/iremipt.h" diff --git a/src/mame/drivers/wecleman.cpp b/src/mame/drivers/wecleman.cpp index 96e4ddb5fd6..49253d6fdbd 100644 --- a/src/mame/drivers/wecleman.cpp +++ b/src/mame/drivers/wecleman.cpp @@ -265,7 +265,7 @@ TODO: #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "cpu/m6809/m6809.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "wecleman.lh" #include "includes/wecleman.h" diff --git a/src/mame/drivers/wwfsstar.cpp b/src/mame/drivers/wwfsstar.cpp index 1607b3fade3..d22c6dd3255 100644 --- a/src/mame/drivers/wwfsstar.cpp +++ b/src/mame/drivers/wwfsstar.cpp @@ -156,7 +156,7 @@ Notes: #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" #include "includes/wwfsstar.h" diff --git a/src/mame/drivers/xexex.cpp b/src/mame/drivers/xexex.cpp index f22a006732a..bee2ffbc8af 100644 --- a/src/mame/drivers/xexex.cpp +++ b/src/mame/drivers/xexex.cpp @@ -137,7 +137,7 @@ Unresolved Issues: #include "machine/eepromser.h" #include "machine/k053252.h" #include "sound/k054539.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/flt_vol.h" #include "includes/xexex.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/xmen.cpp b/src/mame/drivers/xmen.cpp index 14bf4d15178..717b52153d5 100644 --- a/src/mame/drivers/xmen.cpp +++ b/src/mame/drivers/xmen.cpp @@ -21,7 +21,7 @@ likewise a 2 screen game #include "machine/eepromser.h" #include "machine/watchdog.h" #include "cpu/z80/z80.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "rendlay.h" #include "includes/xmen.h" #include "includes/konamipt.h" diff --git a/src/mame/includes/amspdwy.h b/src/mame/includes/amspdwy.h index a969761c664..f9691cc55f9 100644 --- a/src/mame/includes/amspdwy.h +++ b/src/mame/includes/amspdwy.h @@ -7,7 +7,7 @@ *************************************************************************/ #include "machine/gen_latch.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" class amspdwy_state : public driver_device { diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 5a9829516cf..4f995c554fc 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -11,7 +11,7 @@ #include "cpu/m6502/m6502.h" #include "cpu/t11/t11.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/pokey.h" #include "sound/tms5220.h" #include "slapstic.h" diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h index e14e72776a2..142d995fa9f 100644 --- a/src/mame/includes/gauntlet.h +++ b/src/mame/includes/gauntlet.h @@ -8,7 +8,7 @@ #include "machine/atarigen.h" #include "video/atarimo.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/pokey.h" #include "sound/tms5220.h" diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index 7abe1e4b6a3..518db7366f4 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -7,7 +7,7 @@ *************************************************************************/ #include "machine/eepromser.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/dac.h" #include "machine/pit8253.h" #include "cpu/i86/i186.h" diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h index ee2dbf233df..62d93568718 100644 --- a/src/mame/includes/metro.h +++ b/src/mame/includes/metro.h @@ -7,7 +7,7 @@ *************************************************************************/ #include "sound/okim6295.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/es8712.h" #include "video/k053936.h" #include "machine/eepromser.h" diff --git a/src/mame/includes/segas16a.h b/src/mame/includes/segas16a.h index d29c18ef35f..ee1b003a686 100644 --- a/src/mame/includes/segas16a.h +++ b/src/mame/includes/segas16a.h @@ -16,7 +16,7 @@ #include "machine/nvram.h" #include "machine/segaic16.h" #include "machine/watchdog.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "video/segaic16.h" #include "video/sega16sp.h" diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h index e03fead08b6..90ae1981bdf 100644 --- a/src/mame/includes/segas16b.h +++ b/src/mame/includes/segas16b.h @@ -12,7 +12,7 @@ #include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/segaic16.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/2413intf.h" #include "sound/upd7759.h" #include "video/segaic16.h" diff --git a/src/mame/includes/x1.h b/src/mame/includes/x1.h index c20e9bf0375..f2a4e4e9420 100644 --- a/src/mame/includes/x1.h +++ b/src/mame/includes/x1.h @@ -18,7 +18,7 @@ #include "machine/wd_fdc.h" #include "machine/z80dma.h" #include "video/mc6845.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/ay8910.h" #include "sound/wave.h" #include "imagedev/cassette.h" diff --git a/src/mame/includes/x68k.h b/src/mame/includes/x68k.h index f1aee48d2f0..0d7cfa18664 100644 --- a/src/mame/includes/x68k.h +++ b/src/mame/includes/x68k.h @@ -18,7 +18,7 @@ #include "sound/okim6258.h" #include "machine/ram.h" #include "machine/8530scc.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "machine/i8255.h" #define MC68901_TAG "mc68901" diff --git a/src/mame/machine/tatsumi.cpp b/src/mame/machine/tatsumi.cpp index f30fb88d9af..a9282ed2c7b 100644 --- a/src/mame/machine/tatsumi.cpp +++ b/src/mame/machine/tatsumi.cpp @@ -2,7 +2,7 @@ // copyright-holders:Bryan McPhail #include "emu.h" #include "includes/tatsumi.h" -#include "sound/2151intf.h" +#include "sound/ym2151.h" #include "sound/okim6295.h" |