From e5a6298428d689058990b54de0afe54387622250 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 2 Apr 2018 20:41:01 -0400 Subject: atarisy2.cpp: Use ADC0809 device (nw) --- src/mame/drivers/atarisy2.cpp | 55 +++++++++++++++++++------------------------ src/mame/includes/atarisy2.h | 10 ++------ 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 5d4358be8e8..e2ebf225637 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -128,6 +128,7 @@ #include "emu.h" #include "includes/atarisy2.h" +#include "machine/adc0808.h" #include "machine/eeprompar.h" #include "speaker.h" @@ -199,7 +200,6 @@ MACHINE_START_MEMBER(atarisy2_state,atarisy2) atarigen_state::machine_start(); save_item(NAME(m_interrupt_enable)); - save_item(NAME(m_which_adc)); save_item(NAME(m_p2portwr_state)); save_item(NAME(m_p2portrd_state)); save_item(NAME(m_sound_reset_state)); @@ -217,8 +217,6 @@ MACHINE_RESET_MEMBER(atarisy2_state,atarisy2) m_p2portwr_state = 0; m_p2portrd_state = 0; - - m_which_adc = 0; } @@ -355,23 +353,6 @@ WRITE8_MEMBER(atarisy2_state::switch_6502_w) * *************************************/ -WRITE16_MEMBER(atarisy2_state::adc_strobe_w) -{ - m_which_adc = offset & 3; -} - - -READ16_MEMBER(atarisy2_state::adc_r) -{ - static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" }; - - if (m_which_adc < m_pedal_count) - return ~ioport(adcnames[m_which_adc])->read(); - - return ioport(adcnames[m_which_adc])->read() | 0xff00; -} - - READ8_MEMBER(atarisy2_state::leta_r) { static const char *const letanames[] = { "LETA0", "LETA1", "LETA2", "LETA3" }; @@ -637,8 +618,8 @@ WRITE8_MEMBER(atarisy2_state::mixer_w) if (!(data & 0x08)) rbott += 1.0/47; if (!(data & 0x10)) rbott += 1.0/22; gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott))); - m_pokey1->set_output_gain(ALL_OUTPUTS, gain); - m_pokey2->set_output_gain(ALL_OUTPUTS, gain); + m_pokey[0]->set_output_gain(ALL_OUTPUTS, gain); + m_pokey[1]->set_output_gain(ALL_OUTPUTS, gain); /* bits 5-7 control the volume of the TMS5220, using 22k, 47k, and 100k resistors */ if (m_tms5220.found()) @@ -755,10 +736,12 @@ WRITE8_MEMBER(atarisy2_state::coincount_w) /* full memory map derived from schematics */ void atarisy2_state::main_map(address_map &map) { + map.unmap_value_high(); map(0x0000, 0x0fff).ram(); map(0x1000, 0x11ff).mirror(0x0200).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x1400, 0x1403).mirror(0x007c).rw(this, FUNC(atarisy2_state::adc_r), FUNC(atarisy2_state::bankselect_w)); - map(0x1480, 0x1487).mirror(0x0078).w(this, FUNC(atarisy2_state::adc_strobe_w)); + map(0x1400, 0x1400).mirror(0x007e).r("adc", FUNC(adc0808_device::data_r)); + map(0x1400, 0x1403).mirror(0x007c).w(this, FUNC(atarisy2_state::bankselect_w)); + map(0x1480, 0x148f).mirror(0x0070).w("adc", FUNC(adc0808_device::address_offset_start_w)).umask16(0x00ff); map(0x1580, 0x1581).mirror(0x001e).w(this, FUNC(atarisy2_state::int0_ack_w)); map(0x15a0, 0x15a1).mirror(0x001e).w(this, FUNC(atarisy2_state::int1_ack_w)); map(0x15c0, 0x15c1).mirror(0x001e).w(this, FUNC(atarisy2_state::scanline_int_ack_w)); @@ -789,9 +772,9 @@ void atarisy2_state::sound_map(address_map &map) { map(0x0000, 0x0fff).mirror(0x2000).ram(); map(0x1000, 0x17ff).mirror(0x2000).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)); - map(0x1800, 0x180f).mirror(0x2780).rw(m_pokey1, FUNC(pokey_device::read), FUNC(pokey_device::write)); + map(0x1800, 0x180f).mirror(0x2780).rw(m_pokey[0], FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x1810, 0x1813).mirror(0x278c).r(this, FUNC(atarisy2_state::leta_r)); - map(0x1830, 0x183f).mirror(0x2780).rw(m_pokey2, FUNC(pokey_device::read), FUNC(pokey_device::write)); + map(0x1830, 0x183f).mirror(0x2780).rw(m_pokey[1], FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x1840, 0x1840).mirror(0x278f).r(this, FUNC(atarisy2_state::switch_6502_r)); map(0x1850, 0x1851).mirror(0x278e).rw(m_ym2151, FUNC(ym2151_device::read), FUNC(ym2151_device::write)); map(0x1860, 0x1860).mirror(0x278f).r(this, FUNC(atarisy2_state::sound_6502_r)); @@ -998,13 +981,13 @@ static INPUT_PORTS_START( ssprint ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_MODIFY("ADC0") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(1) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_INVERT PORT_PLAYER(1) PORT_MODIFY("ADC1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_INVERT PORT_PLAYER(2) PORT_MODIFY("ADC2") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(3) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_INVERT PORT_PLAYER(3) PORT_MODIFY("LETA0") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) @@ -1086,10 +1069,10 @@ static INPUT_PORTS_START( apb ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_MODIFY("ADC0") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_MODIFY("ADC1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(1) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_INVERT PORT_PLAYER(1) PORT_MODIFY("LETA0") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) @@ -1202,6 +1185,16 @@ MACHINE_CONFIG_START(atarisy2_state::atarisy2) MCFG_MACHINE_START_OVERRIDE(atarisy2_state,atarisy2) MCFG_MACHINE_RESET_OVERRIDE(atarisy2_state,atarisy2) + MCFG_DEVICE_ADD("adc", ADC0809, MASTER_CLOCK/32) // 625 kHz + MCFG_ADC0808_IN0_CB(IOPORT("ADC0")) // J102 pin 5 (POT1) + MCFG_ADC0808_IN1_CB(IOPORT("ADC1")) // J102 pin 7 (POT2) + MCFG_ADC0808_IN2_CB(IOPORT("ADC2")) // J102 pin 9 (POT3) + MCFG_ADC0808_IN3_CB(IOPORT("ADC3")) // J102 pin 8 (POT4) + // IN4 = J102 pin 6 (unused) + // IN5 = J102 pin 4 (unused) + // IN6 = J102 pin 2 (unused) + // IN7 = J102 pin 3 (unused) + MCFG_EEPROM_2804_ADD("eeprom") MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 61d409d6bf7..dad4499172d 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -29,8 +29,7 @@ public: m_alpha_tilemap(*this, "alpha"), m_soundcomm(*this, "soundcomm"), m_ym2151(*this, "ymsnd"), - m_pokey1(*this, "pokey1"), - m_pokey2(*this, "pokey2"), + m_pokey(*this, "pokey%u", 1U), m_tms5220(*this, "tms"), m_rombank1(*this, "rombank1"), m_rombank2(*this, "rombank2"), @@ -51,12 +50,9 @@ public: required_device m_soundcomm; required_device m_ym2151; - required_device m_pokey1; - required_device m_pokey2; + required_device_array m_pokey; optional_device m_tms5220; - uint8_t m_which_adc; - uint8_t m_p2portwr_state; uint8_t m_p2portrd_state; @@ -92,8 +88,6 @@ public: DECLARE_READ16_MEMBER(switch_r); DECLARE_READ8_MEMBER(switch_6502_r); DECLARE_WRITE8_MEMBER(switch_6502_w); - DECLARE_WRITE16_MEMBER(adc_strobe_w); - DECLARE_READ16_MEMBER(adc_r); DECLARE_READ8_MEMBER(leta_r); DECLARE_WRITE8_MEMBER(mixer_w); DECLARE_WRITE8_MEMBER(sound_reset_w); -- cgit v1.2.3