diff options
Diffstat (limited to 'src/mame/drivers/midvunit.cpp')
-rw-r--r-- | src/mame/drivers/midvunit.cpp | 183 |
1 files changed, 62 insertions, 121 deletions
diff --git a/src/mame/drivers/midvunit.cpp b/src/mame/drivers/midvunit.cpp index b9c256c77c2..7feda3c7cd4 100644 --- a/src/mame/drivers/midvunit.cpp +++ b/src/mame/drivers/midvunit.cpp @@ -57,6 +57,8 @@ void midvunit_state::machine_start() save_item(NAME(m_wheel_board_output)); save_item(NAME(m_wheel_board_last)); save_item(NAME(m_wheel_board_u8_latch)); + + m_optional_drivers.resolve(); } @@ -366,7 +368,7 @@ WRITE32_MEMBER(midvunit_state::offroadc_serial_data_w) READ32_MEMBER(midvunit_state::midvunit_wheel_board_r) { //logerror("midvunit_wheel_board_r: %08X\n", m_wheel_board_output); - return m_wheel_board_output; + return m_wheel_board_output << 8; } void midvunit_state::set_input(const char *s) @@ -406,7 +408,7 @@ WRITE32_MEMBER(midvunit_state::midvunit_wheel_board_w) switch (wa) { case 0: - m_wheel_board_output = m_galil_input[m_galil_input_index++] << 8; + m_wheel_board_output = m_galil_input[m_galil_input_index++]; break; case 1: if (arg != 0xD) @@ -442,7 +444,7 @@ WRITE32_MEMBER(midvunit_state::midvunit_wheel_board_w) } break; case 2: - m_wheel_board_output = (m_galil_input_index < m_galil_input_length) ? 0x8000 : 0x0; + m_wheel_board_output = (m_galil_input_index < m_galil_input_length) ? 0x80 : 0x0; break; case 3: // Galil init? break; @@ -476,7 +478,7 @@ WRITE32_MEMBER(midvunit_state::midvunit_wheel_board_w) break; case 5: // DRVCTLZ for (uint8_t bit = 0; bit < 8; bit++) - output().set_lamp_value(bit, BIT(data, bit)); + m_optional_drivers[bit] = BIT(data, bit); //logerror("Wheel board (U10 74HC574; Lamps) = %02X\n", arg); break; case 6: // PRTCTLZ @@ -493,6 +495,18 @@ WRITE32_MEMBER(midvunit_state::midvunit_wheel_board_w) } +DECLARE_CUSTOM_INPUT_MEMBER(midvunit_state::motion_r) +{ + uint8_t status = m_motion->read(); + for (uint8_t bit = 0; bit < 8; bit++) + { + if (BIT(status, bit)) + return bit + 1; + } + return 0; +} + + /************************************* * * War Gods I/O ASICs @@ -640,8 +654,8 @@ void midvunit_state::midvplus_map(address_map &map) * Input ports * *************************************/ - -static INPUT_PORTS_START( crusnusa ) + +static INPUT_PORTS_START( midvunit ) PORT_START("991030") PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") @@ -661,30 +675,54 @@ static INPUT_PORTS_START( crusnusa ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_UP ) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("4th Gear") /* 4th */ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("3rd Gear") /* 3rd */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("2nd Gear") /* 2nd */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1st Gear") /* 1st */ + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("4th Gear") /* 4th */ + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("3rd Gear") /* 3rd */ + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("2nd Gear") /* 2nd */ + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("1st Gear") /* 1st */ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN1") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Radio") /* radio */ + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Radio") /* radio */ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("View 1") /* view 1 */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 2") /* view 2 */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 3") /* view 3 */ + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("View 1") /* view 1 */ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("View 2") /* view 2 */ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("View 3") /* view 3 */ + PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("WHEEL") /* wheel */ + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) + + PORT_START("ACCEL") /* gas pedal */ + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) + + PORT_START("BRAKE") /* brake pedal */ + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) +INPUT_PORTS_END + + +static INPUT_PORTS_START( crusnusa ) + PORT_INCLUDE( midvunit ) + + PORT_START("MOTION") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Mat Not Plugged In") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Mat Stepped On") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Opto Path Broken") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Opto Detector Not Receiving") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Opto LED Not Emitting") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Fail Safe Switch Engaged") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Fail Safe Switch Not Connected Correctly") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Board Not Plugged In") + + PORT_MODIFY("IN1") PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Stop") - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Right Mat") - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Rear Mat") - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Left Mat") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Front Mat") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Mat Plugin") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Mat Step") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Opto Detector") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Failsafe Switch") + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Device 1") + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Device 2") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Device 3") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_NAME("Motion Status - Device 4") + PORT_BIT( 0xf000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midvunit_state, motion_r, nullptr ) PORT_START("DSW") /* DSW2 at U97 */ @@ -771,55 +809,11 @@ static INPUT_PORTS_START( crusnusa ) PORT_DIPSETTING( 0x1c00, "Spain-3" ) PORT_DIPSETTING( 0x1800, "Spain-4" ) PORT_DIPSETTING( 0x0e00, "Netherland-1" ) - - PORT_START("WHEEL") /* wheel */ - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("ACCEL") /* gas pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("BRAKE") /* brake pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) INPUT_PORTS_END static INPUT_PORTS_START( crusnwld ) - PORT_START("991030") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - - PORT_START("992000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - - PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Enter") PORT_CODE(KEYCODE_F2) /* Test switch */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_UP ) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("4th Gear") /* 4th */ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("3rd Gear") /* 3rd */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("2nd Gear") /* 2nd */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1st Gear") /* 1st */ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Radio") /* radio */ - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("View 1") /* view 1 */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 2") /* view 2 */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 3") /* view 3 */ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("View 4") /* view 4 */ - PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_INCLUDE( midvunit ) PORT_START("DSW") /* DSW2 at U97 */ @@ -901,55 +895,11 @@ static INPUT_PORTS_START( crusnwld ) PORT_DIPSETTING( 0x1c00, "Spain-3" ) PORT_DIPSETTING( 0x1800, "Spain-4" ) PORT_DIPSETTING( 0x0e00, "Netherland-1" ) - - PORT_START("WHEEL") /* wheel */ - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("ACCEL") /* gas pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("BRAKE") /* brake pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) INPUT_PORTS_END static INPUT_PORTS_START( offroadc ) - PORT_START("991030") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - - PORT_START("992000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - - PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Enter") PORT_CODE(KEYCODE_F2) /* Test switch */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_UP ) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("4th Gear") /* 4th */ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("3rd Gear") /* 3rd */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("2nd Gear") /* 2nd */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1st Gear") /* 1st */ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Radio") /* radio */ - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("View 1") /* view 1 */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 2") /* view 2 */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 3") /* view 3 */ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("View 4") /* view 4 */ - PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_INCLUDE( midvunit ) PORT_START("DSW") /* DSW2 at U97 */ @@ -997,15 +947,6 @@ static INPUT_PORTS_START( offroadc ) PORT_DIPSETTING( 0x7800, "Norway 1" ) PORT_DIPSETTING( 0x7000, "Denmark 1" ) PORT_DIPSETTING( 0x6800, "Hungary 1" ) - - PORT_START("WHEEL") /* wheel */ - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("ACCEL") /* gas pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) - - PORT_START("BRAKE") /* brake pedal */ - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) INPUT_PORTS_END |