diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index cde7c6e6eff..e107f92437b 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -74,7 +74,7 @@ #define POKEY_DEFAULT_GAIN (32767/11/4) -#define VERBOSE 1 +#define VERBOSE 0 #define VERBOSE_SOUND 0 #define VERBOSE_TIMER 0 #define VERBOSE_POLY 0 @@ -167,7 +167,7 @@ static const int clock_divisors[3] = {1, DIV_64, DIV_15}; // device type definition -const device_type POKEYN = &device_creator; +const device_type POKEY = &device_creator; //************************************************************************** // LIVE DEVICE @@ -177,28 +177,54 @@ const device_type POKEYN = &device_creator; // okim9810_device - constructor //------------------------------------------------- -pokeyn_device::pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, POKEYN, "POKEYN", tag, owner, clock), +pokey_device::pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, POKEY, "POKEY", tag, owner, clock), device_sound_interface(mconfig, *this), device_execute_interface(mconfig, *this), device_state_interface(mconfig, *this), + m_kbd_r(NULL), + m_irq_f(NULL), + m_output_type(LEGACY_LINEAR), m_icount(0), m_stream(NULL) { } +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pokey_device::device_config_complete() +{ + // inherit a copy of the static data + const pokey_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } + + // or initialize to defaults if none provided + else + { + memset(&m_allpot_r_cb, 0, sizeof(m_allpot_r_cb)); + memset(&m_pot_r_cb, 0, sizeof(m_pot_r_cb)); + memset(&m_serin_r_cb, 0, sizeof(m_serin_r_cb)); + memset(&m_serout_w_cb, 0, sizeof(m_serout_w_cb)); + } +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- -void pokeyn_device::device_start() +void pokey_device::device_start() { //int sample_rate = clock(); int i; - if (static_config()) - memcpy(&m_intf, static_config(), sizeof(pokey_interface)); m_clock_period = attotime::from_hz(clock()); /* Setup channels */ @@ -226,6 +252,7 @@ void pokeyn_device::device_start() /* initialize 9 / 17 arrays */ poly_init_9_17(m_poly9, 9); poly_init_9_17(m_poly17, 17); + vol_init(); m_clockmult = DIV_64; m_KBCODE = 0x09; /* Atari 800 'no key' */ @@ -243,14 +270,12 @@ void pokeyn_device::device_start() for (i=0; i<8; i++) { - m_pot_r[i].resolve(m_intf.pot_r[i], *this); + m_pot_r[i].resolve(m_pot_r_cb[i], *this); } - m_allpot_r.resolve(m_intf.allpot_r, *this); - m_serin_r.resolve(m_intf.serin_r, *this); - m_serout_w.resolve(m_intf.serout_w, *this); - m_interrupt_cb = m_intf.interrupt_cb; - m_kbd_r.resolve(m_intf.kbd_r, *this); + m_allpot_r.resolve(m_allpot_r_cb, *this); + m_serin_r.resolve(m_serin_r_cb, *this); + m_serout_w.resolve(m_serout_w_cb, *this); m_stream = stream_alloc(0, 1, clock()); @@ -278,6 +303,10 @@ void pokeyn_device::device_start() save_item(NAME(m_p17)); save_item(NAME(m_clockmult)); save_item(NAME(m_pot_counter)); + save_item(NAME(m_kbd_cnt)); + save_item(NAME(m_kbd_latch)); + save_item(NAME(m_kbd_state)); + save_item(NAME(m_POTx)); save_item(NAME(m_AUDCTL)); save_item(NAME(m_ALLPOT)); @@ -319,7 +348,7 @@ void pokeyn_device::device_start() // device_reset - device-specific reset //------------------------------------------------- -void pokeyn_device::device_reset() +void pokey_device::device_reset() { m_stream->update(); } @@ -329,7 +358,7 @@ void pokeyn_device::device_reset() // device_post_load - device-specific post-load //------------------------------------------------- -void pokeyn_device::device_post_load() +void pokey_device::device_post_load() { } @@ -339,7 +368,7 @@ void pokeyn_device::device_post_load() // changes //------------------------------------------------- -void pokeyn_device::device_clock_changed() +void pokey_device::device_clock_changed() { } @@ -348,7 +377,7 @@ void pokeyn_device::device_clock_changed() // our sound stream //------------------------------------------------- -void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void pokey_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { @@ -357,8 +386,8 @@ void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param if( m_IRQEN & IRQ_SEROR ) { m_IRQST |= IRQ_SEROR; - if( m_interrupt_cb ) - (m_interrupt_cb)(this, IRQ_SEROR); + if( m_irq_f ) + (m_irq_f)(this, IRQ_SEROR); } break; case 4: @@ -366,8 +395,8 @@ void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param if( m_IRQEN & IRQ_SEROC ) { m_IRQST |= IRQ_SEROC; - if( m_interrupt_cb ) - (m_interrupt_cb)(this, IRQ_SEROC); + if( m_irq_f ) + (m_irq_f)(this, IRQ_SEROC); } break; case 5: @@ -377,8 +406,8 @@ void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param /* set the enabled timer irq status bits */ m_IRQST |= IRQ_SERIN; /* call back an application supplied function to handle the interrupt */ - if( m_interrupt_cb ) - (m_interrupt_cb)(this, IRQ_SERIN); + if( m_irq_f ) + (m_irq_f)(this, IRQ_SERIN); } break; case SYNC_WRITE: @@ -403,31 +432,31 @@ void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param } } - void pokeyn_device::execute_run() +void pokey_device::execute_run() +{ + bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); + + do { - bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); + // debugging + //m_ppc = m_pc; // copy PC to previous PC + if (check_debugger) + debugger_instruction_hook(this, 0); //m_pc); - do + // instruction fetch + //UINT16 op = opcode_read(); + + UINT32 new_out = step_one_clock(); + if (m_output != new_out) { - // debugging - //m_ppc = m_pc; // copy PC to previous PC - if (check_debugger) - debugger_instruction_hook(this, 0); //m_pc); + m_stream->update(); + m_output = new_out; + } - // instruction fetch - //UINT16 op = opcode_read(); + m_icount--; + } while (m_icount > 0); - UINT32 new_out = step_one_clock(); - if (m_output != new_out) - { - m_stream->update(); - m_output = new_out; - } - - m_icount--; - } while (m_icount > 0); - - } +} //------------------------------------------------- @@ -435,12 +464,12 @@ void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param // clock cycle. //------------------------------------------------- -void pokeyn_device::step_keyboard() +void pokey_device::step_keyboard() { if (++m_kbd_cnt > 63) m_kbd_cnt = 0; - if (!m_kbd_r.isnull()) { - UINT8 ret = m_kbd_r(m_kbd_cnt); + if (m_kbd_r) { + UINT8 ret = m_kbd_r(this, m_kbd_cnt); switch (m_kbd_cnt) { case POK_KEY_BREAK: @@ -451,8 +480,8 @@ void pokeyn_device::step_keyboard() { /* set break IRQ status and call back the interrupt handler */ m_IRQST |= IRQ_BREAK; - if( m_interrupt_cb ) - (*m_interrupt_cb)(this, IRQ_BREAK); + if( m_irq_f ) + (*m_irq_f)(this, IRQ_BREAK); } } break; @@ -490,8 +519,8 @@ void pokeyn_device::step_keyboard() if( m_IRQST & IRQ_KEYBD ) m_SKSTAT |= SK_KBERR; m_IRQST |= IRQ_KEYBD; - if( m_interrupt_cb ) - (*m_interrupt_cb)(this, IRQ_KEYBD); + if( m_irq_f ) + (*m_irq_f)(this, IRQ_KEYBD); } m_kbd_state++; } @@ -524,7 +553,7 @@ void pokeyn_device::step_keyboard() } } -void pokeyn_device::step_pot() +void pokey_device::step_pot() { int pot; UINT8 upd = 0; @@ -548,7 +577,7 @@ void pokeyn_device::step_pot() * */ -UINT32 pokeyn_device::step_one_clock(void) +UINT32 pokey_device::step_one_clock(void) { int ch, clk; UINT32 sum = 0; @@ -608,8 +637,8 @@ UINT32 pokeyn_device::step_one_clock(void) process_channel(CHAN2); /* check if some of the requested timer interrupts are enabled */ - if ((m_IRQST & IRQ_TIMR2) && m_interrupt_cb ) - (*m_interrupt_cb)(this, IRQ_TIMR2); + if ((m_IRQST & IRQ_TIMR2) && m_irq_f ) + (*m_irq_f)(this, IRQ_TIMR2); } if (m_channel[CHAN1].check_borrow()) @@ -621,8 +650,8 @@ UINT32 pokeyn_device::step_one_clock(void) m_channel[CHAN1].reset_channel(); process_channel(CHAN1); /* check if some of the requested timer interrupts are enabled */ - if ((m_IRQST & IRQ_TIMR1) && m_interrupt_cb ) - (*m_interrupt_cb)(this, IRQ_TIMR1); + if ((m_IRQST & IRQ_TIMR1) && m_irq_f ) + (*m_irq_f)(this, IRQ_TIMR1); } /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */ @@ -638,8 +667,8 @@ UINT32 pokeyn_device::step_one_clock(void) m_channel[CHAN2].sample(); else m_channel[CHAN2].m_filter_sample = 1; - if ((m_IRQST & IRQ_TIMR4) && m_interrupt_cb ) - (*m_interrupt_cb)(this, IRQ_TIMR4); + if ((m_IRQST & IRQ_TIMR4) && m_irq_f ) + (*m_irq_f)(this, IRQ_TIMR4); } if (m_channel[CHAN3].check_borrow()) @@ -659,7 +688,7 @@ UINT32 pokeyn_device::step_one_clock(void) for (ch = 0; ch < 4; ch++) { - sum += (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? m_channel[ch].m_volume : 0 ); + sum |= (((((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? (m_channel[ch].m_AUDC & VOLUME_MASK) : 0 )) << (ch * 4)); } return sum; } @@ -670,17 +699,66 @@ UINT32 pokeyn_device::step_one_clock(void) //------------------------------------------------- -void pokeyn_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void pokey_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { stream_sample_t *buffer = outputs[0]; - while( samples > 0 ) + if (m_output_type == LEGACY_LINEAR) { - /* store sum of output signals into the buffer */ + INT32 out = 0; + for (int i = 0; i < 4; i++) + out += ((m_output >> (4*i)) & 0x0f); + out *= POKEY_DEFAULT_GAIN; + out = (out > 0x7fff) ? 0x7fff : out; + while( samples > 0 ) + { + *buffer++ = out; + samples--; + } + } + else if (m_output_type == RC_LOWPASS) + { + double rTot = m_voltab[m_output]; - *buffer++ = (m_output > 0x7fff) ? 0x7fff : m_output; - samples--; + double V0 = rTot / (rTot+m_r_pullup) * m_v_ref / 5.0 * 32767.0; + double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-(rTot + m_r_pullup) / (m_cap * m_r_pullup * rTot) * m_clock_period.as_double()); + while( samples > 0 ) + { + /* store sum of output signals into the buffer */ + m_out_filter += (V0 - m_out_filter) * mult; + *buffer++ = m_out_filter; + samples--; + + } + } + else if (m_output_type == OPAMP_LOWPASS) + { + double rTot = m_voltab[m_output]; + /* This post-pokey stage usually has a low-pass filter behind it + * It is approximated by eliminating m_v_ref ( -1.0 term) + */ + + double V0 = ((rTot+m_r_pullup) / rTot - 1.0) * m_v_ref / 5.0 * 32767.0; + double mult = (m_cap == 0.0) ? 1.0 : 1.0 - exp(-(rTot + m_r_pullup) / (m_cap * m_r_pullup * rTot) * m_clock_period.as_double()); + + while( samples > 0 ) + { + /* store sum of output signals into the buffer */ + m_out_filter += (V0 - m_out_filter) * mult; + *buffer++ = m_out_filter; + samples--; + + } + } + else if (m_output_type == DISCRETE_VAR_R) + { + INT32 out = m_voltab[m_output]; + while( samples > 0 ) + { + *buffer++ = out; + samples--; + } } } @@ -688,12 +766,12 @@ void pokeyn_device::sound_stream_update(sound_stream &stream, stream_sample_t ** // read - memory interface for reading the active status //------------------------------------------------- -READ8_MEMBER( pokeyn_device::read ) +READ8_MEMBER( pokey_device::read ) { return read(offset); } -UINT8 pokeyn_device::read(offs_t offset) +UINT8 pokey_device::read(offs_t offset) { int data = 0, pot; @@ -792,17 +870,17 @@ UINT8 pokeyn_device::read(offs_t offset) // write - memory interface for write //------------------------------------------------- -void pokeyn_device::write(offs_t offset, UINT8 data) +void pokey_device::write(offs_t offset, UINT8 data) { synchronize(SYNC_WRITE, (offset<<8) | data); } -WRITE8_MEMBER( pokeyn_device::write ) +WRITE8_MEMBER( pokey_device::write ) { write(offset, data); } -void pokeyn_device::write_internal(offs_t offset, UINT8 data) +void pokey_device::write_internal(offs_t offset, UINT8 data) { /* determine which address was changed */ switch (offset & 15) @@ -953,7 +1031,7 @@ void pokeyn_device::write_internal(offs_t offset, UINT8 data) } -void pokeyn_device::serin_ready(int after) +void pokey_device::serin_ready(int after) { timer_set(m_clock_period * after, 5, 0); } @@ -962,7 +1040,7 @@ void pokeyn_device::serin_ready(int after) // private stuff //------------------------------------------------- -inline void pokeyn_device::process_channel(int ch) +inline void pokey_device::process_channel(int ch) { if ((m_channel[ch].m_AUDC & NOTPOLY5) || (m_poly5[m_p5] & 1)) { @@ -978,7 +1056,7 @@ inline void pokeyn_device::process_channel(int ch) } -void pokeyn_device::pokey_potgo(void) +void pokey_device::pokey_potgo(void) { int pot; @@ -1013,8 +1091,49 @@ void pokeyn_device::pokey_potgo(void) } } +void pokey_device::vol_init() +{ + double resistors[4] = {90000, 26500, 8050, 3400}; + double pull_up = 10000; + /* just a guess, there has to be a resistance since the doc specifies that + * Vout is at least 4.2V if all channels turned off. + */ + double r_off = 8e6; + double r_chan[16]; + double rTot; -void pokeyn_device::poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert) + for (int j=0; j<16; j++) + { + rTot = 1.0 / 1e12; /* avoid div by 0 */; + for (int i=0; i<4; i++) + { + if (j & (1 << i)) + rTot += 1.0 / resistors[i]; + else + rTot += 1.0 / r_off; + } + r_chan[j] = 1.0 / rTot; + } + for (int j=0; j<16; j++) + { + rTot = 1.0 / r_chan[j] + 3.0 / r_chan[0]; + rTot = 1.0 / rTot; + printf("%d : %4.3f\n", j, rTot / (rTot+pull_up)*4.75); + } + for (int j=0; j<0x10000; j++) + { + rTot = 0; + for (int i=0; i<4; i++) + { + rTot += 1.0 / r_chan[(j>>(i*4)) & 0x0f]; + } + rTot = 1.0 / rTot; + m_voltab[j] = rTot; + } + +} + +void pokey_device::poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert) { int mask = (1 << size) - 1; int i; @@ -1032,7 +1151,7 @@ void pokeyn_device::poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert } } -void pokeyn_device::poly_init_9_17(UINT32 *poly, int size) +void pokey_device::poly_init_9_17(UINT32 *poly, int size) { int mask = (1 << size) - 1; int i; @@ -1071,7 +1190,7 @@ void pokeyn_device::poly_init_9_17(UINT32 *poly, int size) } -char *pokeyn_device::audc2str(int val) +char *pokey_device::audc2str(int val) { static char buff[80]; if( val & NOTPOLY5 ) @@ -1097,7 +1216,7 @@ char *pokeyn_device::audc2str(int val) return buff; } -char *pokeyn_device::audctl2str(int val) +char *pokey_device::audctl2str(int val) { static char buff[80]; if( val & POLY9 ) @@ -1121,7 +1240,7 @@ char *pokeyn_device::audctl2str(int val) return buff; } -pokeyn_device::pokey_channel::pokey_channel() +pokey_device::pokey_channel::pokey_channel() : m_AUDF(0), m_AUDC(0), m_borrow_cnt(0), @@ -1144,7 +1263,7 @@ READ8_HANDLER( quad_pokeyn_r ) int pokey_num = (offset >> 3) & ~0x04; int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - pokeyn_device *pokey = space->machine().device(devname[pokey_num]); + pokey_device *pokey = space->machine().device(devname[pokey_num]); return pokey->read(pokey_reg); } @@ -1155,7 +1274,7 @@ WRITE8_HANDLER( quad_pokeyn_w ) int pokey_num = (offset >> 3) & ~0x04; int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - pokeyn_device *pokey = space->machine().device(devname[pokey_num]); + pokey_device *pokey = space->machine().device(devname[pokey_num]); pokey->write(pokey_reg, data); } diff --git a/src/emu/sound/pokey.h b/src/emu/sound/pokey.h index a3463300e2e..0961feb9d17 100644 --- a/src/emu/sound/pokey.h +++ b/src/emu/sound/pokey.h @@ -19,7 +19,7 @@ #ifndef __POKEY_H__ #define __POKEY_H__ -#include "devlegcy.h" +#include "machine/rescap.h" /* CONSTANT DEFINITIONS */ @@ -35,32 +35,71 @@ * New function pointers for serial input/output and a interrupt callback. *****************************************************************************/ -class pokeyn_device; +#define POKEY_KEYBOARD_HANDLER(_name) UINT8 _name(pokey_device *device, UINT8 k543210) +#define POKEY_INTERRUPT_HANDLER(_name) void _name(pokey_device *device, int mask) -typedef struct _pokey_interface pokey_interface; -struct _pokey_interface -{ - devcb_read8 pot_r[8]; - devcb_read8 allpot_r; - devcb_read8 serin_r; - devcb_write8 serout_w; - void (*interrupt_cb)(pokeyn_device *device, int mask); - /* offset = k0 ... k5 , bit0: kr1, bit1: kr2 */ - /* all are, in contrast to actual hardware, ACTIVE_HIGH */ - devcb_read8 kbd_r; -}; +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_POKEY_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, POKEY, _clock) + +#define MCFG_POKEY_REPLACE(_tag, _clock) \ + MCFG_DEVICE_REPLACE(_tag, POKEY, _clock) + +#define MCFG_POKEY_CONFIG(_intf) \ + MCFG_DEVICE_CONFIG(_intf) + +/* k543210 = k5 ... k0 returns bit0: kr1, bit1: kr2 */ +/* all are, in contrast to actual hardware, ACTIVE_HIGH */ +#define MCFG_POKEY_KEYBOARD_HANDLER(_kbd) \ + (downcast(device))->m_kbd_r = _kbd; + +#define MCFG_POKEY_INTERRUPT_HANDLER(_irqf) \ + (downcast(device))->m_irq_f = _irqf; + +#define MCFG_POKEY_OUTPUT_RC(_R, _C, _V) \ + (downcast(device))->m_output_type = pokey_device::RC_LOWPASS; \ + (downcast(device))->m_r_pullup = (_R); \ + (downcast(device))->m_cap = (_C); \ + (downcast(device))->m_v_ref = (_V); + +#define MCFG_POKEY_OUTPUT_OPAMP(_R, _C, _V) \ + (downcast(device))->m_output_type = pokey_device::OPAMP_LOWPASS; \ + (downcast(device))->m_r_pullup = (_R); \ + (downcast(device))->m_cap = (_C); \ + (downcast(device))->m_v_ref = (_V); + +#define MCFG_POKEY_OUTPUT_DISCRETE() \ + (downcast(device))->m_output_type = pokey_device::DISCRETE_VAR_R; //************************************************************************** // TYPE DEFINITIONS //************************************************************************** +// ======================> pokey_interface + +class pokey_device; + +typedef struct _pokey_interface pokey_interface; +struct _pokey_interface +{ + devcb_read8 m_pot_r_cb[8]; + devcb_read8 m_allpot_r_cb; + devcb_read8 m_serin_r_cb; + devcb_write8 m_serout_w_cb; +}; + + // ======================> pokey_device -class pokeyn_device : public device_t, +class pokey_device : public device_t, public device_sound_interface, public device_execute_interface, - public device_state_interface + public device_state_interface, + public pokey_interface { public: @@ -118,8 +157,16 @@ public: SYNC_WRITE = 14 }; + enum output_type + { + LEGACY_LINEAR = 0, + RC_LOWPASS, + OPAMP_LOWPASS, + DISCRETE_VAR_R + }; + // construction/destruction - pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -129,8 +176,21 @@ public: void serin_ready(int after); + // internal configuration + + POKEY_KEYBOARD_HANDLER((*m_kbd_r)); + POKEY_INTERRUPT_HANDLER((*m_irq_f)); + + // analog output configuration + + output_type m_output_type; + double m_r_pullup; + double m_cap; + double m_v_ref; + protected: // device-level overrides + virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); virtual void device_post_load(); @@ -142,9 +202,6 @@ protected: virtual void execute_run(); - // configuration state - pokey_interface m_intf; - // other internal states int m_icount; @@ -155,7 +212,7 @@ private: { public: pokey_channel(); - pokeyn_device *m_parent; + pokey_device *m_parent; UINT8 m_INTMask; UINT8 m_AUDF; /* AUDFx (D200, D202, D204, D206) */ UINT8 m_AUDC; /* AUDCx (D201, D203, D205, D207) */ @@ -202,6 +259,8 @@ private: void poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert); void poly_init_9_17(UINT32 *poly, int size); + void vol_init(); + inline void process_channel(int ch); void pokey_potgo(void); char *audc2str(int val); @@ -214,7 +273,8 @@ private: pokey_channel m_channel[POKEY_CHANNELS]; - UINT32 m_output; + UINT32 m_output; /* raw output */ + double m_out_filter; /* filtered output */ INT32 m_clock_cnt[3]; /* clock counters */ UINT32 m_p4; /* poly4 index */ @@ -227,9 +287,6 @@ private: devcb_resolved_read8 m_allpot_r; devcb_resolved_read8 m_serin_r; devcb_resolved_write8 m_serout_w; - devcb_resolved_read8 m_kbd_r; - - void (*m_interrupt_cb)(pokeyn_device *device, int mask); UINT8 m_POTx[8]; /* POTx (R/D200-D207) */ UINT8 m_AUDCTL; /* AUDCTL (W/D208) */ @@ -253,11 +310,12 @@ private: UINT32 m_poly5[0x1f]; UINT32 m_poly9[0x1ff]; UINT32 m_poly17[0x1ffff]; + UINT32 m_voltab[0x10000]; }; // device type definition -extern const device_type POKEYN; +extern const device_type POKEY; /* fix me: eventually this should be a single device with pokey subdevices */ diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c index bfec28f33b3..309056c650a 100644 --- a/src/mame/audio/atarijsa.c +++ b/src/mame/audio/atarijsa.c @@ -57,7 +57,7 @@ static cpu_device *jsacpu; static const char *test_port; static UINT16 test_mask; -static pokeyn_device *pokey; +static pokey_device *pokey; static ym2151_device *ym2151; static device_t *tms5220; static okim6295_device *oki6295; @@ -140,14 +140,14 @@ void atarijsa_init(running_machine &machine, const char *testport, int testmask) /* determine which sound hardware is installed */ tms5220 = machine.device("tms"); ym2151 = machine.device("ymsnd"); - pokey = machine.device("pokey"); + pokey = machine.device("pokey"); oki6295 = machine.device("adpcm"); oki6295_l = machine.device("adpcml"); oki6295_r = machine.device("adpcmr"); /* install POKEY memory handlers */ if (pokey != NULL) - jsacpu->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokeyn_device::read),pokey), write8_delegate(FUNC(pokeyn_device::write),pokey)); + jsacpu->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokey_device::read),pokey), write8_delegate(FUNC(pokey_device::write),pokey)); init_save_state(machine); atarijsa_reset(); @@ -839,7 +839,7 @@ MACHINE_CONFIG_DERIVED( jsa_i_stereo_pokey, jsa_i_stereo ) /* basic machine hardware */ /* sound hardware */ - MCFG_SOUND_ADD("pokey", POKEYN, JSA_MASTER_CLOCK/2) + MCFG_POKEY_ADD("pokey", JSA_MASTER_CLOCK/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.40) MACHINE_CONFIG_END diff --git a/src/mame/audio/bzone.c b/src/mame/audio/bzone.c index 771a791f247..943047d9b6a 100644 --- a/src/mame/audio/bzone.c +++ b/src/mame/audio/bzone.c @@ -366,18 +366,18 @@ static DISCRETE_SOUND_START(bzone) /* FINAL MIX */ /************************************************/ /* We won't bother emulating the final gain of op-amp IC K5, pin 14. - * There signal never reaches a value where it clips, so we will + * This signal never reaches a value where it clips, so we will * just output the final 16-bit level. */ - /* not sure about pokey output levels - below is just a estimate to get a 5V signal */ - DISCRETE_INPUTX_STREAM(BZ_POKEY_SND, 0, 5.0 / 11000, 0) + /* Convert Pokey output to 5V Signal */ + DISCRETE_INPUTX_STREAM(BZ_POKEY_SND, 0, 5.0 / 32768, 0) DISCRETE_MIXER4(NODE_280, BZ_INP_SOUNDEN, BZ_SHELL_SND, BZ_EXPLOSION_SND, BZ_ENGINE_SND, BZ_POKEY_SND, &bzone_final_mixer_desc) - DISCRETE_OUTPUT(NODE_280, 50000 * BZ_FINAL_GAIN) + DISCRETE_OUTPUT(NODE_280, 48000) DISCRETE_SOUND_END @@ -400,12 +400,13 @@ MACHINE_CONFIG_FRAGMENT( bzone_audio ) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, BZONE_MASTER_CLOCK / 8) - MCFG_SOUND_CONFIG(bzone_pokey_interface) + MCFG_POKEY_ADD("pokey", BZONE_MASTER_CLOCK / 8) + MCFG_POKEY_CONFIG(bzone_pokey_interface) + MCFG_POKEY_OUTPUT_RC(RES_K(10), CAP_U(0.015), 5.0) MCFG_SOUND_ROUTE_EX(0, "discrete", 1.0, 0) MCFG_SOUND_ADD("discrete", DISCRETE, 0) MCFG_SOUND_CONFIG_DISCRETE(bzone) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0 / BZ_FINAL_GAIN) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/audio/jedi.c b/src/mame/audio/jedi.c index 94c5d010c3a..29ceb3c6f5d 100644 --- a/src/mame/audio/jedi.c +++ b/src/mame/audio/jedi.c @@ -170,10 +170,10 @@ WRITE8_MEMBER(jedi_state::speech_reset_w) static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, jedi_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM - AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) - AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write) - AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write) + AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey2", pokey_device, read, write) + AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey3", pokey_device, read, write) + AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey4", pokey_device, read, write) AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(irq_ack_w) AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x00ff) AM_READNOP AM_WRITEONLY AM_SHARE("speech_data") AM_RANGE(0x1200, 0x13ff) AM_READNOP AM_WRITE(speech_strobe_w) @@ -205,18 +205,22 @@ MACHINE_CONFIG_FRAGMENT( jedi_audio ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("pokey1", POKEYN, JEDI_POKEY_CLOCK) + MCFG_POKEY_ADD("pokey1", JEDI_POKEY_CLOCK) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) - MCFG_SOUND_ADD("pokey2", POKEYN, JEDI_POKEY_CLOCK) + MCFG_POKEY_ADD("pokey2", JEDI_POKEY_CLOCK) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) - MCFG_SOUND_ADD("pokey3", POKEYN, JEDI_POKEY_CLOCK) + MCFG_POKEY_ADD("pokey3", JEDI_POKEY_CLOCK) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) - MCFG_SOUND_ADD("pokey4", POKEYN, JEDI_POKEY_CLOCK) + MCFG_POKEY_ADD("pokey4", JEDI_POKEY_CLOCK) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) MCFG_SOUND_ADD("tms", TMS5220, JEDI_TMS5220_CLOCK) diff --git a/src/mame/drivers/asteroid.c b/src/mame/drivers/asteroid.c index b570262baec..2b670a91516 100644 --- a/src/mame/drivers/asteroid.c +++ b/src/mame/drivers/asteroid.c @@ -263,7 +263,7 @@ static ADDRESS_MAP_START( astdelux_map, AS_PROGRAM, 8, asteroid_state ) AM_RANGE(0x2000, 0x2007) AM_READ(asteroid_IN0_r) /* IN0 */ AM_RANGE(0x2400, 0x2407) AM_READ(asteroid_IN1_r) /* IN1 */ AM_RANGE(0x2800, 0x2803) AM_READ(asteroid_DSW1_r) /* DSW1 */ - AM_RANGE(0x2c00, 0x2c0f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x2c00, 0x2c0f) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x2c40, 0x2c7f) AM_DEVREAD("earom", atari_vg_earom_device, read) AM_RANGE(0x3000, 0x3000) AM_WRITE_LEGACY(avgdvg_go_w) AM_RANGE(0x3200, 0x323f) AM_DEVWRITE("earom", atari_vg_earom_device, write) @@ -657,8 +657,9 @@ static MACHINE_CONFIG_DERIVED( astdelux, asteroid ) MCFG_SOUND_CONFIG_DISCRETE(astdelux) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_SOUND_ADD("pokey", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey", MASTER_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_config) + MCFG_POKEY_OUTPUT_RC(RES_K(10), CAP_U(0.015), 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/atarisy1.c b/src/mame/drivers/atarisy1.c index 86baf0b296e..22ff250de8c 100644 --- a/src/mame/drivers/atarisy1.c +++ b/src/mame/drivers/atarisy1.c @@ -508,7 +508,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, atarisy1_state ) AM_RANGE(0x1810, 0x1810) AM_READWRITE_LEGACY(atarigen_6502_sound_r, atarigen_6502_sound_w) AM_RANGE(0x1820, 0x1820) AM_READ(switch_6502_r) AM_RANGE(0x1824, 0x1825) AM_WRITE(led_w) - AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x4000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -799,7 +799,7 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.80) MCFG_SOUND_ROUTE(1, "rspeaker", 0.80) - MCFG_SOUND_ADD("pokey", POKEYN, ATARI_CLOCK_14MHz/8) + MCFG_POKEY_ADD("pokey", ATARI_CLOCK_14MHz/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.40) diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index a6092b1bb2b..d620b77bbae 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -653,6 +653,21 @@ WRITE8_MEMBER(atarisy2_state::mixer_w) /* these gains are cheesed up, but give an approximate effect */ + /* + * Before the volume adjustment, all channels pass through + * a high-pass filter which removes DC components. The + * filter frequency does also depend on the settings on + * the resistors. + * + * The op-amp after the pokey feeds mixes the op-amp output voltage + * with a low impedance back to the input. The internal resistance of the + * pokey now is the ground pole of a three pole resistor mixer: ground, + * 15V and op-amp output voltage. + * + * ==> DISCRETE candidate + * + */ + /* bits 0-2 control the volume of the YM2151, using 22k, 47k, and 100k resistors */ rtop = 1.0/(1.0/100 + 1.0/100); rbott = 0; @@ -818,9 +833,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, atarisy2_state ) AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x2000) AM_RAM AM_RANGE(0x1000, 0x17ff) AM_MIRROR(0x2000) AM_RAM AM_SHARE("eeprom") - AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) + AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey1", pokey_device, read, write) AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ(leta_r) - AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x1840, 0x1840) AM_MIRROR(0x278f) AM_READ(switch_6502_r) AM_RANGE(0x1850, 0x1851) AM_MIRROR(0x278e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w) AM_RANGE(0x1860, 0x1860) AM_MIRROR(0x278f) AM_READ(sound_6502_r) @@ -1276,12 +1291,12 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.60) MCFG_SOUND_ROUTE(1, "rspeaker", 0.60) - MCFG_SOUND_ADD("pokey1", POKEYN, SOUND_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", SOUND_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.35) - MCFG_SOUND_ADD("pokey2", POKEYN, SOUND_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", SOUND_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.35) MCFG_SOUND_ADD("tms", TMS5220C, MASTER_CLOCK/4/4/2) diff --git a/src/mame/drivers/atetris.c b/src/mame/drivers/atetris.c index ed8562902a8..4979bde51ad 100644 --- a/src/mame/drivers/atetris.c +++ b/src/mame/drivers/atetris.c @@ -203,8 +203,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, atetris_state ) AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_SHARE("videoram") AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram") AM_RANGE(0x2400, 0x25ff) AM_MIRROR(0x0200) AM_RAM_WRITE(nvram_w) AM_SHARE("nvram") - AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_WRITE(watchdog_reset_w) AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_WRITE(nvram_enable_w) AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_WRITE(irq_ack_w) @@ -358,12 +358,12 @@ static MACHINE_CONFIG_START( atetris, atetris_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bartop52.c b/src/mame/drivers/bartop52.c index bbf22337757..f16a660c1eb 100644 --- a/src/mame/drivers/bartop52.c +++ b/src/mame/drivers/bartop52.c @@ -37,7 +37,7 @@ static ADDRESS_MAP_START(a5200_mem, AS_PROGRAM, 8, bartop52_state ) AM_RANGE(0x4000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) AM_RANGE(0xd400, 0xd5ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) - AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0xf800, 0xffff) AM_ROM ADDRESS_MAP_END @@ -113,8 +113,6 @@ static const pokey_interface atari_pokey_interface = DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, - atari_interrupt_cb, - DEVCB_HANDLER(atari_a5200_keypads) }; static MACHINE_CONFIG_START( a5200, bartop52_state ) @@ -138,8 +136,12 @@ static MACHINE_CONFIG_START( a5200, bartop52_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT) - MCFG_SOUND_CONFIG(atari_pokey_interface) + + MCFG_POKEY_ADD("pokey", FREQ_17_EXACT) + MCFG_POKEY_CONFIG(atari_pokey_interface) + MCFG_POKEY_KEYBOARD_HANDLER(atari_a5200_keypads) + MCFG_POKEY_INTERRUPT_HANDLER(atari_interrupt_cb) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bwidow.c b/src/mame/drivers/bwidow.c index 52b17f309b5..eae263be4c2 100644 --- a/src/mame/drivers/bwidow.c +++ b/src/mame/drivers/bwidow.c @@ -369,8 +369,8 @@ static ADDRESS_MAP_START( bwidow_map, AS_PROGRAM, 8, bwidow_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) AM_RANGE(0x2800, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x7000, 0x7000) AM_DEVREAD("earom", atari_vg_earom_device, read) AM_RANGE(0x7800, 0x7800) AM_READ_PORT("IN0") AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN3") @@ -399,8 +399,8 @@ static ADDRESS_MAP_START( spacduel_map, AS_PROGRAM, 8, bwidow_state ) AM_RANGE(0x0e00, 0x0e00) AM_WRITE(irq_ack_w) /* interrupt acknowledge */ AM_RANGE(0x0e80, 0x0e80) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) AM_RANGE(0x0f00, 0x0f3f) AM_DEVWRITE("earom", atari_vg_earom_device, write) - AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) AM_RANGE(0x2800, 0x3fff) AM_ROM AM_RANGE(0x4000, 0xffff) AM_ROM @@ -744,12 +744,17 @@ static MACHINE_CONFIG_START( bwidow, bwidow_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8) - MCFG_SOUND_CONFIG(pokey_interface_1) + /* FIXME: There are a number of other filters missing */ + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK / 8) + MCFG_POKEY_CONFIG(pokey_interface_1) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), CAP_U(0.015), 5.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK / 8) + MCFG_POKEY_CONFIG(pokey_interface_2) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), CAP_U(0.015), 5.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bzone.c b/src/mame/drivers/bzone.c index 76d6c91c16a..42eb4032105 100644 --- a/src/mame/drivers/bzone.c +++ b/src/mame/drivers/bzone.c @@ -308,7 +308,7 @@ static ADDRESS_MAP_START( bzone_map, AS_PROGRAM, 8, bzone_state ) AM_RANGE(0x1800, 0x1800) AM_DEVREAD_LEGACY("mathbox", mathbox_status_r) AM_RANGE(0x1810, 0x1810) AM_DEVREAD_LEGACY("mathbox", mathbox_lo_r) AM_RANGE(0x1818, 0x1818) AM_DEVREAD_LEGACY("mathbox", mathbox_hi_r) - AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x1840, 0x1840) AM_DEVWRITE_LEGACY("discrete", bzone_sounds_w) AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w) AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) @@ -332,7 +332,7 @@ static ADDRESS_MAP_START( redbaron_map, AS_PROGRAM, 8, bzone_state ) AM_RANGE(0x1808, 0x1808) AM_WRITE(redbaron_joysound_w) /* and select joystick pot also */ AM_RANGE(0x180a, 0x180a) AM_WRITENOP /* sound reset, yet todo */ AM_RANGE(0x180c, 0x180c) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) - AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x1820, 0x185f) AM_DEVREADWRITE("earom", atari_vg_earom_device, read, write) AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w) AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) @@ -599,8 +599,8 @@ static MACHINE_CONFIG_DERIVED( redbaron, bzone_base ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, 1500000) - MCFG_SOUND_CONFIG(redbaron_pokey_interface) + MCFG_POKEY_ADD("pokey", 1500000) + MCFG_POKEY_CONFIG(redbaron_pokey_interface) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("custom", REDBARON, 0) diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index cbacc30c26f..89307d28356 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -333,8 +333,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ccastles_state ) AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0300) AM_READWRITE(nvram_r, nvram_w) AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x01fc) AM_READ(leta_r) AM_RANGE(0x9600, 0x97ff) AM_READ_PORT("IN0") - AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x9c00, 0x9c7f) AM_WRITE(nvram_recall_w) AM_RANGE(0x9c80, 0x9cff) AM_WRITE(ccastles_hscroll_w) AM_RANGE(0x9d00, 0x9d7f) AM_WRITE(ccastles_vscroll_w) @@ -495,12 +495,16 @@ static MACHINE_CONFIG_START( ccastles, ccastles_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK/8) + /* NOTE: 1k + 0.2k is not 100% exact, but should not make an audible difference */ + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1) + RES_K(0.2), CAP_U(0.01), 5.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_config) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK/8) + /* NOTE: 1k + 0.2k is not 100% exact, but should not make an audible difference */ + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1) + RES_K(0.2), CAP_U(0.01), 5.0) + MCFG_POKEY_CONFIG(pokey_config) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4) MACHINE_CONFIG_END diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c index 6e50a3e6fcf..6d6a2e3b515 100644 --- a/src/mame/drivers/centiped.c +++ b/src/mame/drivers/centiped.c @@ -708,7 +708,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( centiped_map, AS_PROGRAM, 8, centiped_state ) AM_IMPORT_FROM(centiped_base_map) - AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokey_device, read, write) ADDRESS_MAP_END static ADDRESS_MAP_START( magworm_map, AS_PROGRAM, 8, centiped_state ) @@ -761,8 +761,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( milliped_map, AS_PROGRAM, 8, centiped_state ) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) - AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram") AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x2000, 0x2000) AM_READ(centiped_IN0_r) @@ -800,7 +800,7 @@ static ADDRESS_MAP_START( warlords_map, AS_PROGRAM, 8, centiped_state ) AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2") /* DSW2 */ AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("IN0") /* IN0 */ AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */ - AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x1800, 0x1800) AM_WRITE(irq_ack_w) AM_RANGE(0x1c00, 0x1c02) AM_WRITE(coin_count_w) AM_RANGE(0x1c03, 0x1c06) AM_WRITE(led_w) @@ -819,8 +819,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mazeinv_map, AS_PROGRAM, 8, centiped_state ) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) - AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram") AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x2000, 0x2000) AM_READ_PORT("IN0") @@ -1645,7 +1645,8 @@ static MACHINE_CONFIG_DERIVED( centiped, centiped_base ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, 12096000/8) + /* Pokey sound needs filtering with discrete op-amp mixer */ + MCFG_POKEY_ADD("pokey", 12096000/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -1711,12 +1712,12 @@ static MACHINE_CONFIG_DERIVED( milliped, centiped ) MCFG_SCREEN_UPDATE_STATIC(milliped) /* sound hardware */ - MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8) - MCFG_SOUND_CONFIG(milliped_pokey_interface_1) + MCFG_POKEY_REPLACE("pokey", 12096000/8) + MCFG_POKEY_CONFIG(milliped_pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, 12096000/8) - MCFG_SOUND_CONFIG(milliped_pokey_interface_2) + MCFG_POKEY_ADD("pokey2", 12096000/8) + MCFG_POKEY_CONFIG(milliped_pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -1737,8 +1738,8 @@ static MACHINE_CONFIG_DERIVED( warlords, centiped ) MCFG_SCREEN_UPDATE_STATIC(warlords) /* sound hardware */ - MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8) - MCFG_SOUND_CONFIG(warlords_pokey_interface) + MCFG_POKEY_REPLACE("pokey", 12096000/8) + MCFG_POKEY_CONFIG(warlords_pokey_interface) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/cloak.c b/src/mame/drivers/cloak.c index 38334228f74..090857ec637 100644 --- a/src/mame/drivers/cloak.c +++ b/src/mame/drivers/cloak.c @@ -167,8 +167,8 @@ static ADDRESS_MAP_START( master_map, AS_PROGRAM, 8, cloak_state ) AM_RANGE(0x0000, 0x03ff) AM_RAM AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(cloak_videoram_w) AM_SHARE("videoram") AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) /* DSW0 also */ - AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) /* DSW1 also */ + AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) /* DSW0 also */ + AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) /* DSW1 also */ AM_RANGE(0x2000, 0x2000) AM_READ_PORT("P1") AM_RANGE(0x2200, 0x2200) AM_READ_PORT("P2") AM_RANGE(0x2400, 0x2400) AM_READ_PORT("SYSTEM") @@ -359,12 +359,12 @@ static MACHINE_CONFIG_START( cloak, cloak_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, XTAL_10MHz/8) /* Accurate to recording */ - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", XTAL_10MHz/8) /* Accurate to recording */ + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, XTAL_10MHz/8) /* Accurate to recording */ - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", XTAL_10MHz/8) /* Accurate to recording */ + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index d2c02b98d09..67c00588a4c 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -280,8 +280,8 @@ static ADDRESS_MAP_START( cloud9_map, AS_PROGRAM, 8, cloud9_state ) AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x007e) AM_READ_PORT("IN0") AM_RANGE(0x5801, 0x5801) AM_MIRROR(0x007e) AM_READ_PORT("IN1") AM_RANGE(0x5900, 0x5903) AM_MIRROR(0x007c) AM_READ(leta_r) - AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x5c00, 0x5cff) AM_MIRROR(0x0300) AM_DEVREADWRITE("nvram", x2212_device, read, write) AM_RANGE(0x6000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -447,11 +447,11 @@ static MACHINE_CONFIG_START( cloud9, cloud9_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c index 7772b8f5376..be47dd7beb8 100644 --- a/src/mame/drivers/firefox.c +++ b/src/mame/drivers/firefox.c @@ -553,10 +553,10 @@ static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, firefox_state ) AM_RANGE(0x0880, 0x089f) AM_MIRROR(0x07e0) AM_DEVREADWRITE_LEGACY("riot",riot6532_r, riot6532_w) AM_RANGE(0x1000, 0x1000) AM_READ(main_to_sound_r) AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_to_main_w) - AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) - AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write) - AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write) + AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) + AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey3", pokey_device, read, write) + AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE("pokey4", pokey_device, read, write) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -730,19 +730,19 @@ static MACHINE_CONFIG_START( firefox, firefox_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_XTAL/8) + MCFG_POKEY_ADD("pokey1", MASTER_XTAL/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_XTAL/8) + MCFG_POKEY_ADD("pokey2", MASTER_XTAL/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) - MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_XTAL/8) + MCFG_POKEY_ADD("pokey3", MASTER_XTAL/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) - MCFG_SOUND_ADD("pokey4", POKEYN, MASTER_XTAL/8) + MCFG_POKEY_ADD("pokey4", MASTER_XTAL/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) diff --git a/src/mame/drivers/foodf.c b/src/mame/drivers/foodf.c index f84e3c23354..d18127eda16 100644 --- a/src/mame/drivers/foodf.c +++ b/src/mame/drivers/foodf.c @@ -221,9 +221,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, foodf_state ) AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE(foodf_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITE(nvram_recall_w) AM_RANGE(0x958000, 0x958001) AM_MIRROR(0x023ffe) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) - AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey2", pokeyn_device, read, write, 0x00ff) - AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey1", pokeyn_device, read, write, 0x00ff) - AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey3", pokeyn_device, read, write, 0x00ff) + AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey2", pokey_device, read, write, 0x00ff) + AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey1", pokey_device, read, write, 0x00ff) + AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey3", pokey_device, read, write, 0x00ff) ADDRESS_MAP_END @@ -380,14 +380,14 @@ static MACHINE_CONFIG_START( foodf, foodf_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/2/10) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK/2/10) + MCFG_POKEY_CONFIG(pokey_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/2/10) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK/2/10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) - MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_CLOCK/2/10) + MCFG_POKEY_ADD("pokey3", MASTER_CLOCK/2/10) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) MACHINE_CONFIG_END diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c index 1121dd249fb..a87503393fc 100644 --- a/src/mame/drivers/gauntlet.c +++ b/src/mame/drivers/gauntlet.c @@ -348,7 +348,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, gauntlet_state ) AM_RANGE(0x1010, 0x101f) AM_MIRROR(0x27c0) AM_READ_LEGACY(atarigen_6502_sound_r) AM_RANGE(0x1020, 0x102f) AM_MIRROR(0x27c0) AM_READ_PORT("COIN") AM_WRITE(mixer_w) AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE(switch_6502_r, sound_ctl_w) - AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0x1810, 0x1811) AM_MIRROR(0x27ce) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w) AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_DEVWRITE_LEGACY("tms", tms5220_data_w) AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x27c0) AM_READWRITE_LEGACY(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w) @@ -545,7 +545,7 @@ static MACHINE_CONFIG_START( gauntlet, gauntlet_state ) MCFG_SOUND_ROUTE(1, "lspeaker", 0.48) MCFG_SOUND_ROUTE(0, "rspeaker", 0.48) - MCFG_SOUND_ADD("pokey", POKEYN, ATARI_CLOCK_14MHz/8) + MCFG_POKEY_ADD("pokey", ATARI_CLOCK_14MHz/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.32) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.32) diff --git a/src/mame/drivers/irobot.c b/src/mame/drivers/irobot.c index 7271e3ccf03..093fde82abb 100644 --- a/src/mame/drivers/irobot.c +++ b/src/mame/drivers/irobot.c @@ -317,17 +317,17 @@ static MACHINE_CONFIG_START( irobot, irobot_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MAIN_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey1", MAIN_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey2", POKEYN, MAIN_CLOCK/8) + MCFG_POKEY_ADD("pokey2", MAIN_CLOCK/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey3", POKEYN, MAIN_CLOCK/8) + MCFG_POKEY_ADD("pokey3", MAIN_CLOCK/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey4", POKEYN, MAIN_CLOCK/8) + MCFG_POKEY_ADD("pokey4", MAIN_CLOCK/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/drivers/liberatr.c b/src/mame/drivers/liberatr.c index 686ac1ddb75..c3c0073aefa 100644 --- a/src/mame/drivers/liberatr.c +++ b/src/mame/drivers/liberatr.c @@ -231,8 +231,8 @@ static ADDRESS_MAP_START( liberatr_map, AS_PROGRAM, 8, liberatr_state ) AM_RANGE(0x6c05, 0x6c06) AM_WRITE(coin_counter_w) AM_RANGE(0x6c07, 0x6c07) AM_WRITEONLY AM_SHARE("planet_select") AM_RANGE(0x6e00, 0x6e3f) AM_WRITE(earom_w) - AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) - AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) + AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) + AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) AM_RANGE(0x8000, 0xefff) AM_ROM AM_RANGE(0xfffa, 0xffff) AM_ROM ADDRESS_MAP_END @@ -264,8 +264,8 @@ static ADDRESS_MAP_START( liberat2_map, AS_PROGRAM, 8, liberatr_state ) AM_RANGE(0x4c05, 0x4c06) AM_WRITE(coin_counter_w) AM_RANGE(0x4c07, 0x4c07) AM_WRITEONLY AM_SHARE("planet_select") AM_RANGE(0x4e00, 0x4e3f) AM_WRITE(earom_w) - AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) - AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) + AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) + AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) //AM_RANGE(0x6000, 0x601f) AM_WRITE(pokey1_w) /* bug ??? */ AM_RANGE(0x6000, 0xbfff) AM_ROM AM_RANGE(0xfffa, 0xffff) AM_ROM @@ -404,12 +404,12 @@ static MACHINE_CONFIG_START( liberatr, liberatr_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/maxaflex.c b/src/mame/drivers/maxaflex.c index 2168da2dfdc..593b69032d8 100644 --- a/src/mame/drivers/maxaflex.c +++ b/src/mame/drivers/maxaflex.c @@ -277,7 +277,7 @@ static ADDRESS_MAP_START(a600xl_mem, AS_PROGRAM, 8, maxaflex_state ) AM_RANGE(0xc000, 0xcfff) AM_ROM /* OS */ AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) AM_RANGE(0xd500, 0xd7ff) AM_NOP @@ -368,7 +368,6 @@ static const pokey_interface pokey_config = { { DEVCB_NULL }, DEVCB_NULL, DEVCB_NULL,DEVCB_NULL, - atari_interrupt_cb }; READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pa_r) @@ -429,8 +428,10 @@ static MACHINE_CONFIG_START( a600xl, maxaflex_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey", FREQ_17_EXACT) + MCFG_POKEY_CONFIG(pokey_config) + MCFG_POKEY_INTERRUPT_HANDLER(atari_interrupt_cb) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) diff --git a/src/mame/drivers/mhavoc.c b/src/mame/drivers/mhavoc.c index b9b6ef89702..5e2aba99c5f 100644 --- a/src/mame/drivers/mhavoc.c +++ b/src/mame/drivers/mhavoc.c @@ -206,9 +206,9 @@ READ8_MEMBER(mhavoc_state::dual_pokey_r) int pokey_reg = (offset % 8) | control; if (pokey_num == 0) - return machine().device("pokey1")->read(pokey_reg); + return machine().device("pokey1")->read(pokey_reg); else - return machine().device("pokey2")->read(pokey_reg); + return machine().device("pokey2")->read(pokey_reg); } @@ -219,9 +219,9 @@ WRITE8_MEMBER(mhavoc_state::dual_pokey_w) int pokey_reg = (offset % 8) | control; if (pokey_num == 0) - machine().device("pokey1")->write(pokey_reg, data); + machine().device("pokey1")->write(pokey_reg, data); else - machine().device("pokey2")->write(pokey_reg, data); + machine().device("pokey2")->write(pokey_reg, data); } @@ -499,17 +499,17 @@ static MACHINE_CONFIG_START( mhavoc, mhavoc_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MHAVOC_CLOCK_1_25M) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey1", MHAVOC_CLOCK_1_25M) + MCFG_POKEY_CONFIG(pokey_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey2", POKEYN, MHAVOC_CLOCK_1_25M) + MCFG_POKEY_ADD("pokey2", MHAVOC_CLOCK_1_25M) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey3", POKEYN, MHAVOC_CLOCK_1_25M) + MCFG_POKEY_ADD("pokey3", MHAVOC_CLOCK_1_25M) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("pokey4", POKEYN, MHAVOC_CLOCK_1_25M) + MCFG_POKEY_ADD("pokey4", MHAVOC_CLOCK_1_25M) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -532,10 +532,10 @@ static MACHINE_CONFIG_DERIVED( alphaone, mhavoc ) MCFG_SCREEN_VISIBLE_AREA(0, 580, 0, 500) /* sound hardware */ - MCFG_SOUND_REPLACE("pokey1", POKEYN, MHAVOC_CLOCK_1_25M) + MCFG_POKEY_REPLACE("pokey1", MHAVOC_CLOCK_1_25M) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_REPLACE("pokey2", POKEYN, MHAVOC_CLOCK_1_25M) + MCFG_POKEY_REPLACE("pokey2", MHAVOC_CLOCK_1_25M) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_DEVICE_REMOVE("pokey3") diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index ae7befe2d93..1250c1b7896 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -732,7 +732,7 @@ WRITE8_MEMBER(missile_state::missile_w) /* POKEY */ else if (offset < 0x4800) { - pokeyn_device *pokey_dev = downcast(machine().device("pokey")); + pokey_device *pokey_dev = downcast(machine().device("pokey")); pokey_dev->write(*machine().firstcpu->space(), offset, data, 0xff); } @@ -795,7 +795,7 @@ READ8_MEMBER(missile_state::missile_r) /* POKEY */ else if (offset < 0x4800) { - pokeyn_device *pokey_dev = downcast(machine().device("pokey")); + pokey_device *pokey_dev = downcast(machine().device("pokey")); result = pokey_dev->read(*machine().firstcpu->space(), offset & 0x0f, 0xff); } @@ -1053,8 +1053,10 @@ static MACHINE_CONFIG_START( missile, missile_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEYN, MASTER_CLOCK/8) - MCFG_SOUND_CONFIG(pokey_config) + MCFG_POKEY_ADD("pokey", MASTER_CLOCK/8) + MCFG_POKEY_CONFIG(pokey_config) + MCFG_POKEY_OUTPUT_RC(RES_K(10), CAP_U(0.1), 5.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/quantum.c b/src/mame/drivers/quantum.c index 6295a612156..0ff1cbc4321 100644 --- a/src/mame/drivers/quantum.c +++ b/src/mame/drivers/quantum.c @@ -82,13 +82,13 @@ READ16_MEMBER(quantum_state::trackball_r) READ8_MEMBER(quantum_state::input_1_r) { - return (machine().root_device().ioport("DSW0")->read() << (7 - (offset - pokeyn_device::POT0_C))) & 0x80; + return (machine().root_device().ioport("DSW0")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80; } READ8_MEMBER(quantum_state::input_2_r) { - return (machine().root_device().ioport("DSW1")->read() << (7 - (offset - pokeyn_device::POT0_C))) & 0x80; + return (machine().root_device().ioport("DSW1")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80; } @@ -131,8 +131,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, quantum_state ) AM_RANGE(0x000000, 0x013fff) AM_ROM AM_RANGE(0x018000, 0x01cfff) AM_RAM AM_RANGE(0x800000, 0x801fff) AM_RAM AM_BASE_LEGACY((UINT16 **)&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) - AM_RANGE(0x840000, 0x84001f) AM_DEVREADWRITE8("pokey1", pokeyn_device, read, write, 0x00ff) - AM_RANGE(0x840020, 0x84003f) AM_DEVREADWRITE8("pokey2", pokeyn_device, read, write, 0x00ff) + AM_RANGE(0x840000, 0x84001f) AM_DEVREADWRITE8("pokey1", pokey_device, read, write, 0x00ff) + AM_RANGE(0x840020, 0x84003f) AM_DEVREADWRITE8("pokey2", pokey_device, read, write, 0x00ff) AM_RANGE(0x900000, 0x9001ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x940000, 0x940001) AM_READ(trackball_r) /* trackball */ AM_RANGE(0x948000, 0x948001) AM_READ_PORT("SYSTEM") @@ -261,12 +261,14 @@ static MACHINE_CONFIG_START( quantum, quantum_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, 600000) - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", 600000) + MCFG_POKEY_CONFIG(pokey_interface_1) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, 600000) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", 600000) + MCFG_POKEY_CONFIG(pokey_interface_2) + MCFG_POKEY_OUTPUT_OPAMP(RES_K(1), 0.0, 5.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/runaway.c b/src/mame/drivers/runaway.c index 809f3eb06ad..a28fd4f0200 100644 --- a/src/mame/drivers/runaway.c +++ b/src/mame/drivers/runaway.c @@ -97,8 +97,8 @@ static ADDRESS_MAP_START( runaway_map, AS_PROGRAM, 8, runaway_state ) AM_RANGE(0x3000, 0x3007) AM_READ(runaway_input_r) AM_RANGE(0x4000, 0x4000) AM_READ_PORT("4000") AM_RANGE(0x5000, 0x5000) AM_DEVREAD("earom", atari_vg_earom_device, read) - AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x7000, 0x700f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x7000, 0x700f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x8000, 0xcfff) AM_ROM AM_RANGE(0xf000, 0xffff) AM_ROM /* for the interrupt vectors */ ADDRESS_MAP_END @@ -373,12 +373,12 @@ static MACHINE_CONFIG_START( runaway, runaway_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, 12096000 / 8) - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", 12096000 / 8) + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, 12096000 / 8) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", 12096000 / 8) + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index bb6a4158c53..6d303a2dec4 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -344,16 +344,16 @@ static MACHINE_CONFIG_START( starwars, starwars_state ) MCFG_SOUND_START(starwars) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8) + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_CLOCK / 8) + MCFG_POKEY_ADD("pokey3", MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - MCFG_SOUND_ADD("pokey4", POKEYN, MASTER_CLOCK / 8) + MCFG_POKEY_ADD("pokey4", MASTER_CLOCK / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) MCFG_SOUND_ADD("tms", TMS5220, MASTER_CLOCK/2/9) diff --git a/src/mame/drivers/tempest.c b/src/mame/drivers/tempest.c index 2c31f869bac..9fd8302e9bf 100644 --- a/src/mame/drivers/tempest.c +++ b/src/mame/drivers/tempest.c @@ -415,8 +415,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tempest_state ) AM_RANGE(0x6060, 0x6060) AM_DEVREAD_LEGACY("mathbox", mathbox_lo_r) AM_RANGE(0x6070, 0x6070) AM_DEVREAD_LEGACY("mathbox", mathbox_hi_r) AM_RANGE(0x6080, 0x609f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w) - AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x60e0, 0x60e0) AM_WRITE(tempest_led_w) AM_RANGE(0x9000, 0xdfff) AM_ROM AM_RANGE(0xf000, 0xffff) AM_ROM /* for the reset / interrupt vectors */ @@ -610,13 +610,17 @@ static MACHINE_CONFIG_START( tempest, tempest_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8) - MCFG_SOUND_CONFIG(pokey_interface_1) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_POKEY_ADD("pokey1", MASTER_CLOCK / 8) + MCFG_POKEY_CONFIG(pokey_interface_1) + MCFG_POKEY_OUTPUT_RC(RES_K(10), CAP_U(0.015), 5.0) - MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8) - MCFG_SOUND_CONFIG(pokey_interface_2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + + MCFG_POKEY_ADD("pokey2", MASTER_CLOCK / 8) + MCFG_POKEY_CONFIG(pokey_interface_2) + MCFG_POKEY_OUTPUT_RC(RES_K(10), CAP_U(0.015), 5.0) + + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c index 4beb6f4905d..33eff5b5448 100644 --- a/src/mame/drivers/tomcat.c +++ b/src/mame/drivers/tomcat.c @@ -332,8 +332,8 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, tomcat_state ) AM_RANGE(0x30e0, 0x30e0) AM_NOP // COINRD Inputs: D7 = Coin L, D6 = Coin R, D5 = SOUNDFLAG AM_RANGE(0x5000, 0x507f) AM_RAM // 6532 ram AM_RANGE(0x5080, 0x509f) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w) - AM_RANGE(0x6000, 0x601f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x6000, 0x601f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x8000, 0xffff) AM_NOP // main sound program rom ADDRESS_MAP_END @@ -428,10 +428,10 @@ static MACHINE_CONFIG_START( tomcat, tomcat_state ) MCFG_VIDEO_START(avg_tomcat) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("pokey1", POKEYN, XTAL_14_31818MHz / 8) + MCFG_POKEY_ADD("pokey1", XTAL_14_31818MHz / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.20) - MCFG_SOUND_ADD("pokey2", POKEYN, XTAL_14_31818MHz / 8) + MCFG_POKEY_ADD("pokey2", XTAL_14_31818MHz / 8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.20) MCFG_SOUND_ADD("tms", TMS5220, 325000) diff --git a/src/mame/drivers/tunhunt.c b/src/mame/drivers/tunhunt.c index 301b435d84e..de5558d9d36 100644 --- a/src/mame/drivers/tunhunt.c +++ b/src/mame/drivers/tunhunt.c @@ -145,8 +145,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tunhunt_state ) AM_RANGE(0x2400, 0x2400) AM_WRITENOP /* INT ACK */ AM_RANGE(0x2800, 0x2800) AM_WRITE(tunhunt_control_w) AM_RANGE(0x2c00, 0x2fff) AM_WRITEONLY AM_SHARE("spriteram") - AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) - AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) + AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey1", pokey_device, read, write) + AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("pokey2", pokey_device, read, write) AM_RANGE(0x5000, 0x7fff) AM_ROM AM_RANGE(0xfffa, 0xffff) AM_ROM ADDRESS_MAP_END @@ -323,12 +323,12 @@ static MACHINE_CONFIG_START( tunhunt, tunhunt_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey1", POKEYN, 1209600) - MCFG_SOUND_CONFIG(pokey_interface_1) + MCFG_POKEY_ADD("pokey1", 1209600) + MCFG_POKEY_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("pokey2", POKEYN, 1209600) - MCFG_SOUND_CONFIG(pokey_interface_2) + MCFG_POKEY_ADD("pokey2", 1209600) + MCFG_POKEY_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END diff --git a/src/mame/includes/atari.h b/src/mame/includes/atari.h index 27e32165b4c..d259e1e262f 100644 --- a/src/mame/includes/atari.h +++ b/src/mame/includes/atari.h @@ -31,10 +31,10 @@ void atari_machine_start(running_machine &machine); MACHINE_START( atarixl ); -void atari_interrupt_cb(pokeyn_device *device, int mask); +void atari_interrupt_cb(pokey_device *device, int mask); -READ8_DEVICE_HANDLER(atari_a800_keyboard); -READ8_DEVICE_HANDLER(atari_a5200_keypads); +POKEY_KEYBOARD_HANDLER(atari_a800_keyboard); +POKEY_KEYBOARD_HANDLER(atari_a5200_keypads); /* video */ diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c index fa7d3580c86..96696111cea 100644 --- a/src/mame/machine/atari.c +++ b/src/mame/machine/atari.c @@ -24,7 +24,7 @@ static void a600xl_mmu(running_machine &machine, UINT8 new_mmu); static void pokey_reset(running_machine &machine); -void atari_interrupt_cb(pokeyn_device *device, int mask) +void atari_interrupt_cb(pokey_device *device, int mask) { if (VERBOSE_POKEY) @@ -155,7 +155,7 @@ void a600xl_mmu(running_machine &machine, UINT8 new_mmu) **************************************************************/ -READ8_DEVICE_HANDLER(atari_a800_keyboard) +POKEY_KEYBOARD_HANDLER(atari_a800_keyboard) { int ipt; static const char *const tag[] = { @@ -165,30 +165,30 @@ READ8_DEVICE_HANDLER(atari_a800_keyboard) UINT8 ret = 0x00; /* decode special */ - switch (offset) + switch (k543210) { - case pokeyn_device::POK_KEY_BREAK: + case pokey_device::POK_KEY_BREAK: /* special case ... */ ret |= ((device->machine().root_device().ioport(tag[0])->read_safe(0) & 0x04) ? 0x02 : 0x00); break; - case pokeyn_device::POK_KEY_CTRL: + case pokey_device::POK_KEY_CTRL: /* CTRL */ ret |= ((device->machine().root_device().ioport("fake")->read_safe(0) & 0x02) ? 0x02 : 0x00); break; - case pokeyn_device::POK_KEY_SHIFT: + case pokey_device::POK_KEY_SHIFT: /* SHIFT */ ret |= ((device->machine().root_device().ioport("fake")->read_safe(0) & 0x01) ? 0x02 : 0x00); break; } /* return on BREAK key now! */ - if (offset == AKEY_BREAK || offset == AKEY_NONE) + if (k543210 == AKEY_BREAK || k543210 == AKEY_NONE) return ret; /* decode regular key */ - ipt = device->machine().root_device().ioport(tag[offset >> 3])->read_safe(0); + ipt = device->machine().root_device().ioport(tag[k543210 >> 3])->read_safe(0); - if (ipt & (1 << (offset & 0x07))) + if (ipt & (1 << (k543210 & 0x07))) ret |= 0x01; return ret; @@ -223,38 +223,38 @@ READ8_DEVICE_HANDLER(atari_a800_keyboard) **************************************************************/ -READ8_DEVICE_HANDLER(atari_a5200_keypads) +POKEY_KEYBOARD_HANDLER(atari_a5200_keypads) { int ipt; static const char *const tag[] = { "keypad_0", "keypad_1", "keypad_2", "keypad_3" }; UINT8 ret = 0x00; /* decode special */ - switch (offset) + switch (k543210) { - case pokeyn_device::POK_KEY_BREAK: + case pokey_device::POK_KEY_BREAK: /* special case ... */ ret |= ((device->machine().root_device().ioport(tag[0])->read_safe(0) & 0x01) ? 0x02 : 0x00); break; - case pokeyn_device::POK_KEY_CTRL: - case pokeyn_device::POK_KEY_SHIFT: + case pokey_device::POK_KEY_CTRL: + case pokey_device::POK_KEY_SHIFT: break; } /* decode regular key */ /* if kr5 and kr0 not set just return */ - if ((offset & 0x21) != 0x21) + if ((k543210 & 0x21) != 0x21) return ret; - offset = (offset >> 1) & 0x0f; + k543210 = (k543210 >> 1) & 0x0f; /* return on BREAK key now! */ - if (offset == 0) + if (k543210 == 0) return ret; - ipt = device->machine().root_device().ioport(tag[offset >> 2])->read_safe(0); + ipt = device->machine().root_device().ioport(tag[k543210 >> 2])->read_safe(0); - if (ipt & (1 <<(offset & 0x03))) + if (ipt & (1 <<(k543210 & 0x03))) ret |= 0x01; return ret; @@ -270,7 +270,7 @@ READ8_DEVICE_HANDLER(atari_a5200_keypads) static void pokey_reset(running_machine &machine) { - pokeyn_device *pokey = downcast(machine.device("pokey")); + pokey_device *pokey = downcast(machine.device("pokey")); pokey->write(15,0); } diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index da42b666f05..e10a1a8f366 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -863,7 +863,7 @@ void atarigen_set_ym2413_vol(running_machine &machine, int volume) void atarigen_set_pokey_vol(running_machine &machine, int volume) { - atarigen_set_vol(machine, volume, POKEYN); + atarigen_set_vol(machine, volume, POKEY); } void atarigen_set_tms5220_vol(running_machine &machine, int volume)