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 diff --git a/src/mame/drivers/seattle.cpp b/src/mame/drivers/seattle.cpp index 0a62335df79..2dac678e781 100644 --- a/src/mame/drivers/seattle.cpp +++ b/src/mame/drivers/seattle.cpp @@ -280,7 +280,9 @@ public: m_dcs(*this, "dcs"), m_ethernet(*this, "ethernet"), m_ioasic(*this, "ioasic"), - m_io_analog(*this, "AN%u", 0) + m_io_analog(*this, "AN%u", 0), + m_lamps(*this, "lamp%u", 0U), + m_leds(*this, "led%u", 0U) {} required_device m_nvram; @@ -290,6 +292,8 @@ public: optional_device m_ethernet; required_device m_ioasic; optional_ioport_array<8> m_io_analog; + output_finder<16> m_lamps; + output_finder<24> m_leds; widget_data m_widget; uint32_t m_interrupt_enable; @@ -305,7 +309,7 @@ public: uint8_t m_pending_analog_read; uint8_t m_status_leds; uint32_t m_cmos_write_enabled; - uint32_t m_output; + uint16_t m_output_last; uint8_t m_output_mode; uint32_t m_gear; int8_t m_wheel_force; @@ -426,10 +430,13 @@ void seattle_state::machine_start() save_item(NAME(m_pending_analog_read)); save_item(NAME(m_status_leds)); save_item(NAME(m_cmos_write_enabled)); - save_item(NAME(m_output)); + save_item(NAME(m_output_last)); save_item(NAME(m_output_mode)); save_item(NAME(m_gear)); save_item(NAME(m_wheel_calibrated)); + + m_lamps.resolve(); + m_leds.resolve(); } @@ -671,33 +678,28 @@ WRITE32_MEMBER(seattle_state::analog_port_w) *************************************/ WRITE32_MEMBER(seattle_state::wheel_board_w) { - //logerror("wheel_board_w: data = %08x\n", data); - /* two writes in pairs. flag off first, on second. arg remains the same. */ - bool flag = (data & (1 << 11)); - uint8_t op = (data >> 8) & 0x7; - uint8_t arg = data & 0xff; + //logerror("wheel_board_w: data = %08X\n", data); + uint8_t arg = data & 0xFF; - if (flag) + if (!BIT(m_output_last, 11) && BIT(data, 11)) // output latch { - switch (op) + if (BIT(data, 10)) { - case 0x0: - machine().output().set_value("wheel", arg); // target wheel angle. signed byte. + uint8_t base = BIT(data, 8) << 3; + for (uint8_t bit = 0; bit < 8; bit++) + m_lamps[base | bit] = BIT(arg, bit); + } + else if (BIT(data, 9) || BIT(data, 8)) + { + logerror("%08X:wheel_board_w(%d) = %08X\n", m_maincpu->pc(), offset, data); + } + else + { + output().set_value("wheel", arg); // target wheel angle. signed byte. m_wheel_force = int8_t(arg); - //logerror("wheel_board_w: data = %08x op: %02x arg: %02x\n", data, op, arg); - break; - - case 0x4: - for (uint8_t bit = 0; bit < 8; bit++) - machine().output().set_lamp_value(bit, (arg >> bit) & 0x1); - break; - - case 0x5: - for (uint8_t bit = 0; bit < 8; bit++) - machine().output().set_lamp_value(8 + bit, (arg >> bit) & 0x1); - break; } } + m_output_last = data; } /************************************* @@ -829,61 +831,57 @@ void seattle_state::update_widget_irq() READ32_MEMBER(seattle_state::output_r) { - return m_output; + logerror("%08X:output_r(%d)\n", m_maincpu->pc(), offset); + return 0; } WRITE32_MEMBER(seattle_state::output_w) { - uint8_t op = (data >> 8) & 0xF; uint8_t arg = data & 0xFF; - - switch (op) + + if (!BIT(m_output_last, 11) && BIT(data, 11)) + m_output_mode = arg; + m_output_last = data; + + if (!BIT(data, 10)) { - default: - logerror("Unknown output (%02X) = %02X\n", op, arg); - break; + switch (m_output_mode) + { + default: + logerror("%08X:output_w(%d) = %04X\n", m_maincpu->pc(), m_output_mode, data); + break; - case 0xF: break; // sync/security wrapper commands. arg matches the wrapped command. + case 0x04: + output().set_value("wheel", arg); // wheel motor delta. signed byte. + m_wheel_force = int8_t(~arg); + //logerror("wheel_board_w: data = %08x op: %02x arg: %02x\n", data, op, arg); + break; - case 0x7: - m_output_mode = arg; - break; + case 0x05: + for (uint8_t bit = 0; bit < 8; bit++) + m_lamps[bit] = BIT(arg, bit); + break; - case 0xB: - switch (m_output_mode) - { - default: - logerror("Unknown output with mode (%02X) = %02X\n", m_output_mode, arg); - break; + case 0x06: // Hyperdrive LEDs 0-7 + for (uint8_t bit = 0; bit < 8; bit++) + m_leds[bit] = BIT(arg, bit); + break; - case 0x04: - output().set_value("wheel", arg); // wheel motor delta. signed byte. - m_wheel_force = int8_t(~arg); - //logerror("wheel_board_w: data = %08x op: %02x arg: %02x\n", data, op, arg); - break; + case 0x07: // Hyperdrive LEDs 8-15 + for (uint8_t bit = 0; bit < 8; bit++) + m_leds[8 | bit] = BIT(arg, bit); + break; - case 0x05: - for (uint8_t bit = 0; bit < 8; bit++) - output().set_lamp_value(bit, (arg >> bit) & 0x1); - break; - - case 0x06: // Hyperdrive LEDs 0-7 - for (uint8_t bit = 0; bit < 8; bit++) - output().set_led_value(bit, (arg >> bit) & 0x1); - break; - - case 0x07: // Hyperdrive LEDs 8-15 - for (uint8_t bit = 0; bit < 8; bit++) - output().set_led_value(8 + bit, (arg >> bit) & 0x1); - break; - - case 0x08: // Hyperdrive LEDs 16-23 (Only uses up to 19) - for (uint8_t bit = 0; bit < 8; bit++) - output().set_led_value(16 + bit, (arg >> bit) & 0x1); - break; - } - break; + case 0x08: // Hyperdrive LEDs 16-23 (Only uses up to 19) + for (uint8_t bit = 0; bit < 8; bit++) + m_leds[16 | bit] = BIT(arg, bit); + break; + } + } + else if (!BIT(data, 9) || !BIT(data, 8)) + { + logerror("%08X:output_w = %04X\n", m_maincpu->pc(), data); } } diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h index bc35e2f9091..813f9045422 100644 --- a/src/mame/includes/midvunit.h +++ b/src/mame/includes/midvunit.h @@ -68,7 +68,9 @@ public: m_midway_serial_pic2(*this, "serial_pic2"), m_midway_ioasic(*this, "ioasic"), m_dcs(*this, "dcs"), - m_generic_paletteram_32(*this, "paletteram") { } + m_generic_paletteram_32(*this, "paletteram"), + m_optional_drivers(*this, "lamp%u", 0U), + m_motion(*this, "MOTION") { } optional_shared_ptr m_nvram; required_shared_ptr m_ram_base; @@ -100,7 +102,7 @@ public: const char *m_galil_input; uint8_t m_galil_output_index; char m_galil_output[450]; - uint32_t m_wheel_board_output; + uint8_t m_wheel_board_output; uint32_t m_wheel_board_last; uint32_t m_wheel_board_u8_latch; DECLARE_WRITE32_MEMBER(midvunit_dma_queue_w); @@ -140,6 +142,7 @@ public: DECLARE_READ32_MEMBER(generic_speedup_r); DECLARE_READ32_MEMBER(midvunit_wheel_board_r); DECLARE_WRITE32_MEMBER(midvunit_wheel_board_w); + DECLARE_CUSTOM_INPUT_MEMBER(motion_r); DECLARE_DRIVER_INIT(crusnu40); DECLARE_DRIVER_INIT(crusnu21); DECLARE_DRIVER_INIT(crusnwld); @@ -165,6 +168,8 @@ public: optional_device m_midway_ioasic; required_device m_dcs; required_shared_ptr m_generic_paletteram_32; + output_finder<8> m_optional_drivers; + optional_ioport m_motion; void postload(); void midvcommon(machine_config &config); diff --git a/src/mame/layout/crusnusa.lay b/src/mame/layout/crusnusa.lay index af074cec8c7..19de22b5624 100644 --- a/src/mame/layout/crusnusa.lay +++ b/src/mame/layout/crusnusa.lay @@ -87,40 +87,40 @@ - + - + - - - + + + + + + + - + - + - + - + - + - + - - - - - +