From 064e459e32805bb9d30b31497bc68efc9cd21df2 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 2 Apr 2018 12:53:27 -0400 Subject: harddriv.cpp: Add ADC0809 device (nw) --- src/mame/drivers/harddriv.cpp | 41 ++++++++++++++++++++++++++--------------- src/mame/includes/harddriv.h | 6 ++---- src/mame/machine/harddriv.cpp | 15 +++------------ 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index d2ffdb2a6ba..8f3815b51cb 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -360,6 +360,7 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type, m_jsa(*this, "jsa"), m_screen(*this, "screen"), m_duartn68681(*this, "duartn68681"), + m_adc8(*this, "adc8"), m_hd34010_host_access(0), m_msp_ram(*this, "msp_ram"), m_dsk_ram(nullptr), @@ -393,7 +394,6 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type, m_in0(*this, "IN0"), m_sw1(*this, "SW1"), m_a80000(*this, "a80000"), - m_8badc(*this, "8BADC.%u", 0), m_12badc(*this, "12BADC.%u", 0), m_irq_state(0), m_gsp_irq_state(0), @@ -441,8 +441,6 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type, m_ds3xdsp_sdata(0), m_ds3xdsp_internal_timer(*this, "ds3xdsp_timer"), m_adc_control(0), - m_adc8_select(0), - m_adc8_data(0), m_adc12_select(0), m_adc12_byte(0), m_adc12_data(0), @@ -549,7 +547,8 @@ void harddriv_state::driver_68k_map(address_map &map) map(0x60c000, 0x60ffff).w(this, FUNC(harddriv_state::hd68k_irq_ack_w)); map(0xa00000, 0xa7ffff).w(this, FUNC(harddriv_state::hd68k_wr0_write)); map(0xa80000, 0xafffff).r(this, FUNC(harddriv_state::hd68k_a80000_r)).w(this, FUNC(harddriv_state::hd68k_wr1_write)); - map(0xb00000, 0xb7ffff).rw(this, FUNC(harddriv_state::hd68k_adc8_r), FUNC(harddriv_state::hd68k_wr2_write)); + map(0xb00001, 0xb00001).mirror(0x7fffe).r("adc8", FUNC(adc0808_device::data_r)); + map(0xb00000, 0xb7ffff).w(this, FUNC(harddriv_state::hd68k_wr2_write)); map(0xb80000, 0xbfffff).rw(this, FUNC(harddriv_state::hd68k_adc12_r), FUNC(harddriv_state::hd68k_adc_control_w)); map(0xc00000, 0xc03fff).rw(this, FUNC(harddriv_state::hd68k_gsp_io_r), FUNC(harddriv_state::hd68k_gsp_io_w)); map(0xc04000, 0xc07fff).rw(this, FUNC(harddriv_state::hd68k_msp_io_r), FUNC(harddriv_state::hd68k_msp_io_w)); @@ -599,7 +598,8 @@ void harddriv_state::multisync_68k_map(address_map &map) map(0x60c000, 0x60ffff).rw(this, FUNC(harddriv_state::hd68k_port0_r), FUNC(harddriv_state::hd68k_irq_ack_w)); map(0xa00000, 0xa7ffff).w(this, FUNC(harddriv_state::hd68k_wr0_write)); map(0xa80000, 0xafffff).r(this, FUNC(harddriv_state::hd68k_a80000_r)).w(this, FUNC(harddriv_state::hd68k_wr1_write)); - map(0xb00000, 0xb7ffff).rw(this, FUNC(harddriv_state::hd68k_adc8_r), FUNC(harddriv_state::hd68k_wr2_write)); + map(0xb00001, 0xb00001).mirror(0x7fffe).r("adc8", FUNC(adc0808_device::data_r)); + map(0xb00000, 0xb7ffff).w(this, FUNC(harddriv_state::hd68k_wr2_write)); map(0xb80000, 0xbfffff).rw(this, FUNC(harddriv_state::hd68k_adc12_r), FUNC(harddriv_state::hd68k_adc_control_w)); map(0xc00000, 0xc03fff).rw(this, FUNC(harddriv_state::hd68k_gsp_io_r), FUNC(harddriv_state::hd68k_gsp_io_w)); map(0xc04000, 0xc07fff).rw(this, FUNC(harddriv_state::hd68k_msp_io_r), FUNC(harddriv_state::hd68k_msp_io_w)); @@ -639,7 +639,8 @@ void harddriv_state::multisync2_68k_map(address_map &map) map(0x60c000, 0x60ffff).rw(this, FUNC(harddriv_state::hd68k_port0_r), FUNC(harddriv_state::hd68k_irq_ack_w)); map(0xa00000, 0xa7ffff).w(this, FUNC(harddriv_state::hd68k_wr0_write)); map(0xa80000, 0xafffff).r(this, FUNC(harddriv_state::hd68k_a80000_r)).w(this, FUNC(harddriv_state::hd68k_wr1_write)); - map(0xb00000, 0xb7ffff).rw(this, FUNC(harddriv_state::hd68k_adc8_r), FUNC(harddriv_state::hd68k_wr2_write)); + map(0xb00001, 0xb00001).mirror(0x7fffe).r("adc8", FUNC(adc0808_device::data_r)); + map(0xb00000, 0xb7ffff).w(this, FUNC(harddriv_state::hd68k_wr2_write)); map(0xb80000, 0xbfffff).rw(this, FUNC(harddriv_state::hd68k_adc12_r), FUNC(harddriv_state::hd68k_adc_control_w)); map(0xc00000, 0xc03fff).rw(this, FUNC(harddriv_state::hd68k_gsp_io_r), FUNC(harddriv_state::hd68k_gsp_io_w)); map(0xc04000, 0xc07fff).rw(this, FUNC(harddriv_state::hd68k_msp_io_r), FUNC(harddriv_state::hd68k_msp_io_w)); @@ -788,7 +789,7 @@ static INPUT_PORTS_START( harddriv ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -871,7 +872,7 @@ static INPUT_PORTS_START( racedriv ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -955,7 +956,7 @@ static INPUT_PORTS_START( racedriv_pan ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("leftpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("leftpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -967,7 +968,7 @@ static INPUT_PORTS_START( racedriv_pan ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("rightpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("rightpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -994,7 +995,7 @@ static INPUT_PORTS_START( racedrivc ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -1083,7 +1084,7 @@ static INPUT_PORTS_START( stunrun ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -1172,7 +1173,7 @@ static INPUT_PORTS_START( steeltal ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -1262,7 +1263,7 @@ static INPUT_PORTS_START( strtdriv ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -1352,7 +1353,7 @@ static INPUT_PORTS_START( hdrivair ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) /* HBLANK */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("mainpcb:screen") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 12-bit EOC */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 8-bit EOC */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("mainpcb:adc8", adc0808_device, eoc_r) PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -1463,6 +1464,16 @@ MACHINE_CONFIG_START(harddriv_state::driver_nomsp) MCFG_WATCHDOG_ADD("watchdog") + MCFG_DEVICE_ADD("adc8", ADC0809, 1000000) // unknown clock + MCFG_ADC0808_IN0_CB(IOPORT("8BADC.0")) + MCFG_ADC0808_IN1_CB(IOPORT("8BADC.1")) + MCFG_ADC0808_IN2_CB(IOPORT("8BADC.2")) + MCFG_ADC0808_IN3_CB(IOPORT("8BADC.3")) + MCFG_ADC0808_IN4_CB(IOPORT("8BADC.4")) + MCFG_ADC0808_IN5_CB(IOPORT("8BADC.5")) + MCFG_ADC0808_IN6_CB(IOPORT("8BADC.6")) + MCFG_ADC0808_IN7_CB(IOPORT("8BADC.7")) + MCFG_CPU_ADD("gsp", TMS34010, HARDDRIV_GSP_CLOCK) MCFG_CPU_PROGRAM_MAP(driver_gsp_map) MCFG_TMS340X0_HALT_ON_RESET(true) /* halt on reset */ diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index c6a58bd6a3a..f089b61fd22 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -21,6 +21,7 @@ #include "cpu/tms34010/tms34010.h" #include "machine/74259.h" +#include "machine/adc0808.h" #include "machine/asic65.h" #include "machine/eeprompar.h" #include "machine/mc68681.h" @@ -99,7 +100,6 @@ public: DECLARE_READ16_MEMBER( hd68k_a80000_r ); DECLARE_READ16_MEMBER( hd68k_port0_r ); - DECLARE_READ16_MEMBER( hd68k_adc8_r ); DECLARE_READ16_MEMBER( hd68k_adc12_r ); DECLARE_READ16_MEMBER( hdc68k_port1_r ); DECLARE_READ16_MEMBER( hda68k_port1_r ); @@ -300,6 +300,7 @@ protected: optional_device m_jsa; optional_device m_screen; optional_device m_duartn68681; + required_device m_adc8; uint8_t m_hd34010_host_access; @@ -354,7 +355,6 @@ protected: required_ioport m_in0; optional_ioport m_sw1; required_ioport m_a80000; - optional_ioport_array<8> m_8badc; optional_ioport_array<4> m_12badc; /* machine state */ @@ -416,8 +416,6 @@ protected: optional_device m_ds3xdsp_internal_timer; uint16_t m_adc_control; - uint8_t m_adc8_select; - uint8_t m_adc8_data; uint8_t m_adc12_select; uint8_t m_adc12_byte; uint16_t m_adc12_data; diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp index a6199aa9679..529aebac5ce 100644 --- a/src/mame/machine/harddriv.cpp +++ b/src/mame/machine/harddriv.cpp @@ -221,7 +221,7 @@ READ16_MEMBER( harddriv_state::hd68k_port0_r ) int temp = (m_sw1.read_safe(0xff) << 8) | m_in0->read(); if (get_hblank(scr)) temp ^= 0x0002; - temp ^= 0x0018; /* both EOCs always high for now */ + temp ^= 0x0008; /* 12-bit EOC always high for now */ return temp; } @@ -285,12 +285,6 @@ READ16_MEMBER( harddriv_state::hdc68k_wheel_r ) } -READ16_MEMBER( harddriv_state::hd68k_adc8_r ) -{ - return m_adc8_data; -} - - READ16_MEMBER( harddriv_state::hd68k_adc12_r ) { return m_adc12_byte ? ((m_adc12_data >> 8) & 0x0f) : (m_adc12_data & 0xff); @@ -317,11 +311,8 @@ WRITE16_MEMBER( harddriv_state::hd68k_adc_control_w ) COMBINE_DATA(&m_adc_control); /* handle a write to the 8-bit ADC address select */ - if (m_adc_control & 0x08) - { - m_adc8_select = m_adc_control & 0x07; - m_adc8_data = m_8badc[m_adc8_select].read_safe(0xffff); - } + m_adc8->address_w(space, 0, m_adc_control & 0x07); + m_adc8->start_w(BIT(m_adc_control, 3)); /* handle a write to the 12-bit ADC address select */ if (m_adc_control & 0x40) -- cgit v1.2.3