From 30f1de6c831ecd15c1bf06b5d1dd875063a0b9b3 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Fri, 14 Aug 2015 08:40:51 +0200 Subject: [PATCH] harddriv.c: reduce tagmap lookups (nw) --- src/mame/audio/atarijsa.c | 10 +- src/mame/audio/atarijsa.h | 5 + src/mame/drivers/harddriv.c | 204 ++++++++++++++++++----------------- src/mame/includes/harddriv.h | 9 +- src/mame/machine/harddriv.c | 17 ++- 5 files changed, 134 insertions(+), 111 deletions(-) diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c index 69180d61031..b4a8cc67501 100644 --- a/src/mame/audio/atarijsa.c +++ b/src/mame/audio/atarijsa.c @@ -629,6 +629,7 @@ atari_jsa_i_device::atari_jsa_i_device(const machine_config &mconfig, const char : atari_jsa_base_device(mconfig, ATARI_JSA_I, "Atari JSA I Sound Board", tag, owner, clock, "atjsa1", 2), m_pokey(*this, "pokey"), m_tms5220(*this, "tms"), + m_jsai(*this, "JSAI"), m_pokey_volume(1.0), m_tms5220_volume(1.0) { @@ -653,7 +654,7 @@ READ8_MEMBER( atari_jsa_i_device::rdio_r ) // 0x01 = coin 1 // - UINT8 result = ioport("JSAI")->read(); + UINT8 result = m_jsai->read(); if (!m_test_read_cb()) result ^= 0x80; if (m_tms5220 != NULL && m_tms5220->readyq_r() == 0) @@ -841,6 +842,7 @@ void atari_jsa_i_device::update_all_volumes() atari_jsa_ii_device::atari_jsa_ii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : atari_jsa_oki_base_device(mconfig, ATARI_JSA_II, "Atari JSA II Sound Board", tag, owner, clock, "atjsa2", 1) + , m_jsaii(*this, "JSAII") { } @@ -863,7 +865,7 @@ READ8_MEMBER( atari_jsa_ii_device::rdio_r ) // 0x01 = coin 1 // - UINT8 result = ioport("JSAII")->read(); + UINT8 result = m_jsaii->read(); if (!m_test_read_cb()) result ^= 0x80; @@ -904,11 +906,13 @@ ioport_constructor atari_jsa_ii_device::device_input_ports() const atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : atari_jsa_oki_base_device(mconfig, ATARI_JSA_III, "Atari JSA III Sound Board", tag, owner, clock, "atjsa3", 1) + , m_jsaiii(*this, "JSAIII") { } atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, int channels) : atari_jsa_oki_base_device(mconfig, devtype, name, tag, owner, clock, shortname, channels) + , m_jsaiii(*this, "JSAIII") { } @@ -931,7 +935,7 @@ READ8_MEMBER( atari_jsa_iii_device::rdio_r ) // 0x01 = coin R (active high) // - UINT8 result = ioport("JSAIII")->read(); + UINT8 result = m_jsaiii->read(); if (!m_test_read_cb()) result ^= 0x90; return result; diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index e1866d1c75c..3ae12a653dc 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -200,6 +200,7 @@ protected: // devices optional_device m_pokey; optional_device m_tms5220; + required_ioport m_jsai; // internal state double m_pokey_volume; @@ -222,6 +223,8 @@ protected: // device level overrides virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; + + required_ioport m_jsaii; }; @@ -245,6 +248,8 @@ protected: // device level overrides virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; + + required_ioport m_jsaiii; }; diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index c172cca7118..95a60fb7134 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -355,6 +355,8 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d m_ds3dac2(*this, "ds3dac2"), m_harddriv_sound(*this, "harddriv_sound"), m_jsa(*this, "jsa"), + m_screen(*this, "screen"), + m_duartn68681(*this, "duartn68681"), m_hd34010_host_access(0), m_dsk_pio_access(0), m_msp_ram(*this, "msp_ram"), @@ -384,6 +386,11 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d m_gsp_control_hi(*this, "gsp_control_hi"), m_gsp_paletteram_lo(*this, "gsp_palram_lo"), m_gsp_paletteram_hi(*this, "gsp_palram_hi"), + m_in0(*this, "IN0"), + m_sw1(*this, "SW1"), + m_a80000(*this, "a80000"), + m_8badc(*this, "8BADC"), + m_12badc(*this, "12BADC"), m_irq_state(0), m_gsp_irq_state(0), m_msp_irq_state(0), @@ -499,9 +506,18 @@ class harddriv_new_state : public driver_device public: harddriv_new_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_mainpcb(*this, "mainpcb") + , m_leftpcb(*this, "leftpcb") + , m_rightpcb(*this, "rightpcb") { } TIMER_DEVICE_CALLBACK_MEMBER(hack_timer); + DECLARE_WRITE_LINE_MEMBER(tx_a); + + required_device m_mainpcb; + optional_device m_leftpcb; + optional_device m_rightpcb; + }; @@ -777,40 +793,40 @@ static INPUT_PORTS_START( harddriv ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) /* aux coin */ PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - seat */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - seat */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_NAME("Shifter Lever Y") - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_NAME("Shifter Lever X") - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - wheel */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Wheel") - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - line volts */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - line volts */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - shift force */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - shift force */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 - force brake */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -861,40 +877,40 @@ static INPUT_PORTS_START( racedriv ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) /* aux coin */ PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - seat */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - seat */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_NAME("Shifter Lever Y") - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_NAME("Shifter Lever X") - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - wheel */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Wheel") - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - line volts */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - line volts */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 - force brake */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -991,39 +1007,39 @@ static INPUT_PORTS_START( racedrivc ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - force brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") + PORT_START("mainpcb:12BADC.1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") + PORT_START("mainpcb:12BADC.2") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") + PORT_START("mainpcb:12BADC.3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1073,40 +1089,40 @@ static INPUT_PORTS_START( stunrun ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* stunrun has its own coins */ @@ -1163,40 +1179,40 @@ static INPUT_PORTS_START( steeltal ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Real Helicopter Flight") PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* volume control */ - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* left/right */ - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* up/down */ - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Collective") PORT_REVERSE /* collective */ - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Rudder") PORT_PLAYER(2) /* rudder */ /* steeltal has its own coins */ @@ -1260,39 +1276,39 @@ static INPUT_PORTS_START( strtdriv ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - voice mic */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - voice mic */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - volume */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - volume */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - elevator */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - elevator */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Elevator") PORT_REVERSE /* up/down */ - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - canopy */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - canopy */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_NAME("Brake") PORT_REVERSE - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - seat adjust */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - seat adjust */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") /* FAKE */ + PORT_START("mainpcb:12BADC.1") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") /* FAKE */ + PORT_START("mainpcb:12BADC.2") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* FAKE */ + PORT_START("mainpcb:12BADC.3") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1350,39 +1366,39 @@ static INPUT_PORTS_START( hdrivair ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - voice mic */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - voice mic */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - volume */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - volume */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - elevator */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - elevator */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE PORT_NAME("Elevator") /* up/down */ - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - canopy */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - canopy */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Brake") - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - seat adjust */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - seat adjust */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_REVERSE PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") + PORT_START("mainpcb:12BADC.1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") + PORT_START("mainpcb:12BADC.2") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") + PORT_START("mainpcb:12BADC.3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1986,13 +2002,11 @@ static MACHINE_CONFIG_START( steeltalp_machine, harddriv_new_state ) MCFG_DEVICE_ADD("mainpcb", STEELTALP_BOARD_DEVICE, 0) MACHINE_CONFIG_END -WRITE_LINE_MEMBER(racedriv_board_device_state::tx_a) +WRITE_LINE_MEMBER(harddriv_new_state::tx_a) { // passive connection, one way, to both screens - mc68681_device* left = machine().device(":leftpcb:duartn68681"); - mc68681_device* right = machine().device(":rightpcb:duartn68681"); - left->rx_a_w(state); - right->rx_a_w(state); + m_leftpcb->m_duartn68681->rx_a_w(state); + m_rightpcb->m_duartn68681->rx_a_w(state); } static MACHINE_CONFIG_START( racedriv_panorama_machine, harddriv_new_state ) @@ -2002,7 +2016,7 @@ static MACHINE_CONFIG_START( racedriv_panorama_machine, harddriv_new_state ) // MCFG_QUANTUM_TIME(attotime::from_hz(100000)) MCFG_DEVICE_MODIFY("mainpcb:duartn68681") - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(racedriv_board_device_state,tx_a )) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, harddriv_new_state,tx_a)) MCFG_TIMER_DRIVER_ADD_PERIODIC("hack_timer", harddriv_new_state, hack_timer, attotime::from_hz(60)) // MCFG_QUANTUM_TIME(attotime::from_hz(60000)) @@ -2012,13 +2026,9 @@ MACHINE_CONFIG_END // by forcing them to stay in sync using this ugly method everything works much better. TIMER_DEVICE_CALLBACK_MEMBER(harddriv_new_state::hack_timer) { - screen_device* middle = machine().device(":mainpcb:screen"); - screen_device* left = machine().device(":leftpcb:screen"); - screen_device* right = machine().device(":rightpcb:screen"); - - left->reset_origin(0, 0); - middle->reset_origin(0, 0); - right->reset_origin(0, 0); + m_leftpcb->m_screen->reset_origin(0, 0); + m_mainpcb->m_screen->reset_origin(0, 0); + m_rightpcb->m_screen->reset_origin(0, 0); } /************************************* diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 5a1925474a4..7602b616330 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -59,6 +59,8 @@ public: optional_device m_ds3dac2; optional_device m_harddriv_sound; optional_device m_jsa; + optional_device m_screen; + optional_device m_duartn68681; UINT8 m_hd34010_host_access; UINT8 m_dsk_pio_access; @@ -106,6 +108,12 @@ public: optional_shared_ptr m_gsp_paletteram_lo; optional_shared_ptr m_gsp_paletteram_hi; + 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 */ UINT8 m_irq_state; UINT8 m_gsp_irq_state; @@ -525,7 +533,6 @@ class racedriv_board_device_state : public harddriv_state { public: racedriv_board_device_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - DECLARE_WRITE_LINE_MEMBER(tx_a); protected: virtual machine_config_constructor device_mconfig_additions() const; diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 24a6ff0da7c..e802f2bfe09 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -200,7 +200,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_msp_io_w ) READ16_MEMBER( harddriv_state::hd68k_a80000_r ) { - return ioport("a80000")->read_safe(0xffff); + return m_a80000->read(); } READ16_MEMBER( harddriv_state::hd68k_port0_r ) @@ -222,7 +222,7 @@ READ16_MEMBER( harddriv_state::hd68k_port0_r ) */ screen_device &scr = m_gsp->screen(); - int temp = (ioport("SW1")->read_safe(0xff) << 8) | ioport("IN0")->read_safe(0xff); + int temp = ((m_sw1 ? m_sw1->read() : 0xff) << 8) | m_in0->read(); if (get_hblank(scr)) temp ^= 0x0002; temp ^= 0x0018; /* both EOCs always high for now */ return temp; @@ -231,7 +231,7 @@ READ16_MEMBER( harddriv_state::hd68k_port0_r ) READ16_MEMBER( harddriv_state::hdc68k_port1_r ) { - UINT16 result = ioport("a80000")->read_safe(0xffff); + UINT16 result = m_a80000->read(); UINT16 diff = result ^ m_hdc68k_last_port1; /* if a new shifter position is selected, use it */ @@ -259,7 +259,7 @@ READ16_MEMBER( harddriv_state::hdc68k_port1_r ) READ16_MEMBER( harddriv_state::hda68k_port1_r ) { - UINT16 result = ioport("a80000")->read_safe(0xffff); + UINT16 result = m_a80000->read(); /* merge in the wheel edge latch bit */ if (m_hdc68k_wheel_edge) @@ -272,7 +272,7 @@ READ16_MEMBER( harddriv_state::hda68k_port1_r ) READ16_MEMBER( harddriv_state::hdc68k_wheel_r ) { /* grab the new wheel value and upconvert to 12 bits */ - UINT16 new_wheel = ioport("12BADC0")->read_safe(0xffff) << 4; + UINT16 new_wheel = (m_12badc[0] ? m_12badc[0]->read() : 0xffff) << 4; /* hack to display the wheel position */ if (space.machine().input().code_pressed(KEYCODE_LSHIFT)) @@ -317,23 +317,20 @@ READ16_MEMBER( harddriv_state::hd68k_sound_reset_r ) WRITE16_MEMBER( harddriv_state::hd68k_adc_control_w ) { - static const char *const adc8names[] = { "8BADC0", "8BADC1", "8BADC2", "8BADC3", "8BADC4", "8BADC5", "8BADC6", "8BADC7" }; - static const char *const adc12names[] = { "12BADC0", "12BADC1", "12BADC2", "12BADC3" }; - 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 = ioport(adc8names[m_adc8_select])->read_safe(0xffff); + m_adc8_data = m_8badc[m_adc8_select] ? m_8badc[m_adc8_select]->read() : 0xffff; } /* handle a write to the 12-bit ADC address select */ if (m_adc_control & 0x40) { m_adc12_select = (m_adc_control >> 4) & 0x03; - m_adc12_data = ioport(adc12names[m_adc12_select])->read_safe(0xffff) << 4; + m_adc12_data = (m_12badc[m_adc12_select] ? m_12badc[m_adc12_select]->read() : 0xffff) << 4; } /* bit 7 selects which byte of the 12 bit data to read */