mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
seattle and vegas: Remove runtime tag lookups and make io member naming consistent. (nw)
This commit is contained in:
parent
10ca4d3913
commit
1d243e752d
@ -281,7 +281,13 @@ public:
|
|||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
m_ethernet(*this, "ethernet"),
|
m_ethernet(*this, "ethernet"),
|
||||||
m_ioasic(*this, "ioasic"),
|
m_ioasic(*this, "ioasic"),
|
||||||
m_io_analog(*this, "AN%u", 0),
|
m_io_analog(*this, "AN%u", 0U),
|
||||||
|
m_io_gun_x(*this, "LIGHT%u_X", 0U),
|
||||||
|
m_io_gun_y(*this, "LIGHT%u_Y", 0U),
|
||||||
|
m_io_fake(*this, "FAKE"),
|
||||||
|
m_io_gearshift(*this, "GEAR"),
|
||||||
|
m_io_system(*this, "SYSTEM"),
|
||||||
|
m_wheel_driver(*this, "wheel"),
|
||||||
m_lamps(*this, "lamp%u", 0U),
|
m_lamps(*this, "lamp%u", 0U),
|
||||||
m_leds(*this, "led%u", 0U)
|
m_leds(*this, "led%u", 0U)
|
||||||
{}
|
{}
|
||||||
@ -294,6 +300,12 @@ public:
|
|||||||
optional_device<smc91c94_device> m_ethernet;
|
optional_device<smc91c94_device> m_ethernet;
|
||||||
required_device<midway_ioasic_device> m_ioasic;
|
required_device<midway_ioasic_device> m_ioasic;
|
||||||
optional_ioport_array<8> m_io_analog;
|
optional_ioport_array<8> m_io_analog;
|
||||||
|
optional_ioport_array<2> m_io_gun_x;
|
||||||
|
optional_ioport_array<2> m_io_gun_y;
|
||||||
|
optional_ioport m_io_fake;
|
||||||
|
optional_ioport m_io_gearshift;
|
||||||
|
optional_ioport m_io_system;
|
||||||
|
output_finder<1> m_wheel_driver;
|
||||||
output_finder<16> m_lamps;
|
output_finder<16> m_lamps;
|
||||||
output_finder<24> m_leds;
|
output_finder<24> m_leds;
|
||||||
|
|
||||||
@ -437,6 +449,7 @@ void seattle_state::machine_start()
|
|||||||
save_item(NAME(m_gear));
|
save_item(NAME(m_gear));
|
||||||
save_item(NAME(m_wheel_calibrated));
|
save_item(NAME(m_wheel_calibrated));
|
||||||
|
|
||||||
|
m_wheel_driver.resolve();
|
||||||
m_lamps.resolve();
|
m_lamps.resolve();
|
||||||
m_leds.resolve();
|
m_leds.resolve();
|
||||||
}
|
}
|
||||||
@ -667,7 +680,7 @@ WRITE32_MEMBER(seattle_state::analog_port_w)
|
|||||||
m_pending_analog_read = currValue;
|
m_pending_analog_read = currValue;
|
||||||
}
|
}
|
||||||
// Declare calibration finished as soon as a SYSTEM button is hit
|
// Declare calibration finished as soon as a SYSTEM button is hit
|
||||||
if (!m_wheel_calibrated && ((~ioport("SYSTEM")->read()) & 0xffff)) {
|
if (!m_wheel_calibrated && ((~m_io_system->read()) & 0xffff)) {
|
||||||
m_wheel_calibrated = true;
|
m_wheel_calibrated = true;
|
||||||
//osd_printf_info("wheel calibration comlete wheel: %02x\n", currValue);
|
//osd_printf_info("wheel calibration comlete wheel: %02x\n", currValue);
|
||||||
}
|
}
|
||||||
@ -697,7 +710,7 @@ WRITE32_MEMBER(seattle_state::wheel_board_w)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output().set_value("wheel", arg); // target wheel angle. signed byte.
|
m_wheel_driver[0] = arg; // target wheel angle. signed byte.
|
||||||
m_wheel_force = int8_t(arg);
|
m_wheel_force = int8_t(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,7 +725,7 @@ WRITE32_MEMBER(seattle_state::wheel_board_w)
|
|||||||
DECLARE_CUSTOM_INPUT_MEMBER(seattle_state::gearshift_r)
|
DECLARE_CUSTOM_INPUT_MEMBER(seattle_state::gearshift_r)
|
||||||
{
|
{
|
||||||
// Check for gear change and save gear selection
|
// Check for gear change and save gear selection
|
||||||
uint32_t gear = ioport("GEAR")->read();
|
uint32_t gear = m_io_gearshift->read();
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (gear & (1 << i))
|
if (gear & (1 << i))
|
||||||
@ -734,39 +747,39 @@ READ32_MEMBER(seattle_state::carnevil_gun_r)
|
|||||||
switch (offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
case 0: /* low 8 bits of X */
|
case 0: /* low 8 bits of X */
|
||||||
result = (ioport("LIGHT0_X")->read() << 4) & 0xff;
|
result = (m_io_gun_x[0]->read() << 4) & 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /* upper 4 bits of X */
|
case 1: /* upper 4 bits of X */
|
||||||
result = (ioport("LIGHT0_X")->read() >> 4) & 0x0f;
|
result = (m_io_gun_x[0]->read() >> 4) & 0x0f;
|
||||||
result |= (ioport("FAKE")->read() & 0x03) << 4;
|
result |= (m_io_fake->read() & 0x03) << 4;
|
||||||
result |= 0x40;
|
result |= 0x40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* low 8 bits of Y */
|
case 2: /* low 8 bits of Y */
|
||||||
result = (ioport("LIGHT0_Y")->read() << 2) & 0xff;
|
result = (m_io_gun_y[0]->read() << 2) & 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /* upper 4 bits of Y */
|
case 3: /* upper 4 bits of Y */
|
||||||
result = (ioport("LIGHT0_Y")->read() >> 6) & 0x03;
|
result = (m_io_gun_y[0]->read() >> 6) & 0x03;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /* low 8 bits of X */
|
case 4: /* low 8 bits of X */
|
||||||
result = (ioport("LIGHT1_X")->read() << 4) & 0xff;
|
result = (m_io_gun_x[1]->read() << 4) & 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: /* upper 4 bits of X */
|
case 5: /* upper 4 bits of X */
|
||||||
result = (ioport("LIGHT1_X")->read() >> 4) & 0x0f;
|
result = (m_io_gun_x[1]->read() >> 4) & 0x0f;
|
||||||
result |= (ioport("FAKE")->read() & 0x30);
|
result |= (m_io_fake->read() & 0x30);
|
||||||
result |= 0x40;
|
result |= 0x40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* low 8 bits of Y */
|
case 6: /* low 8 bits of Y */
|
||||||
result = (ioport("LIGHT1_Y")->read() << 2) & 0xff;
|
result = (m_io_gun_y[1]->read() << 2) & 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: /* upper 4 bits of Y */
|
case 7: /* upper 4 bits of Y */
|
||||||
result = (ioport("LIGHT1_Y")->read() >> 6) & 0x03;
|
result = (m_io_gun_y[1]->read() >> 6) & 0x03;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -329,10 +329,11 @@ public:
|
|||||||
m_uart1(*this, "uart1"),
|
m_uart1(*this, "uart1"),
|
||||||
m_uart2(*this, "uart2"),
|
m_uart2(*this, "uart2"),
|
||||||
m_io_analog(*this, "AN.%u", 0U),
|
m_io_analog(*this, "AN.%u", 0U),
|
||||||
m_49way_x(*this, "49WAYX_P%u", 1U),
|
m_io_49way_x(*this, "49WAYX_P%u", 1U),
|
||||||
m_49way_y(*this, "49WAYY_P%u", 1U),
|
m_io_49way_y(*this, "49WAYY_P%u", 1U),
|
||||||
m_keypad(*this, "KEYPAD"),
|
m_io_keypad(*this, "KEYPAD"),
|
||||||
m_gearshift(*this, "GEAR"),
|
m_io_gearshift(*this, "GEAR"),
|
||||||
|
m_io_system(*this, "SYSTEM"),
|
||||||
m_wheel_driver(*this, "wheel"),
|
m_wheel_driver(*this, "wheel"),
|
||||||
m_lamps(*this, "lamp%u", 0U),
|
m_lamps(*this, "lamp%u", 0U),
|
||||||
m_a2d_shift(0)
|
m_a2d_shift(0)
|
||||||
@ -349,10 +350,11 @@ public:
|
|||||||
optional_device<ns16550_device> m_uart1;
|
optional_device<ns16550_device> m_uart1;
|
||||||
optional_device<ns16550_device> m_uart2;
|
optional_device<ns16550_device> m_uart2;
|
||||||
optional_ioport_array<8> m_io_analog;
|
optional_ioport_array<8> m_io_analog;
|
||||||
optional_ioport_array<4> m_49way_x;
|
optional_ioport_array<4> m_io_49way_x;
|
||||||
optional_ioport_array<4> m_49way_y;
|
optional_ioport_array<4> m_io_49way_y;
|
||||||
optional_ioport m_keypad;
|
optional_ioport m_io_keypad;
|
||||||
optional_ioport m_gearshift;
|
optional_ioport m_io_gearshift;
|
||||||
|
optional_ioport m_io_system;
|
||||||
output_finder<1> m_wheel_driver;
|
output_finder<1> m_wheel_driver;
|
||||||
output_finder<16> m_lamps;
|
output_finder<16> m_lamps;
|
||||||
|
|
||||||
@ -950,7 +952,7 @@ WRITE32_MEMBER( vegas_state::analog_port_w )
|
|||||||
m_pending_analog_read = currValue;
|
m_pending_analog_read = currValue;
|
||||||
}
|
}
|
||||||
// Declare calibration finished as soon as a SYSTEM button is hit
|
// Declare calibration finished as soon as a SYSTEM button is hit
|
||||||
if (!m_wheel_calibrated && ((~ioport("SYSTEM")->read()) & 0xffff)) {
|
if (!m_wheel_calibrated && ((~m_io_system->read()) & 0xffff)) {
|
||||||
m_wheel_calibrated = true;
|
m_wheel_calibrated = true;
|
||||||
//osd_printf_info("wheel calibration comlete wheel: %02x\n", currValue);
|
//osd_printf_info("wheel calibration comlete wheel: %02x\n", currValue);
|
||||||
}
|
}
|
||||||
@ -1050,28 +1052,28 @@ CUSTOM_INPUT_MEMBER(vegas_state::i40_r)
|
|||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
data = translate49[m_49way_x[0]->read() >> 4];
|
data = translate49[m_io_49way_x[0]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
data = translate49[m_49way_y[0]->read() >> 4];
|
data = translate49[m_io_49way_y[0]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
data = translate49[m_49way_x[1]->read() >> 4];
|
data = translate49[m_io_49way_x[1]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
data = translate49[m_49way_y[1]->read() >> 4];
|
data = translate49[m_io_49way_y[1]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
data = translate49[m_49way_x[2]->read() >> 4];
|
data = translate49[m_io_49way_x[2]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
data = translate49[m_49way_y[2]->read() >> 4];
|
data = translate49[m_io_49way_y[2]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
data = translate49[m_49way_x[3]->read() >> 4];
|
data = translate49[m_io_49way_x[3]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
data = translate49[m_49way_y[3]->read() >> 4];
|
data = translate49[m_io_49way_y[3]->read() >> 4];
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
case 11:
|
case 11:
|
||||||
@ -1107,7 +1109,7 @@ WRITE32_MEMBER(vegas_state::wheel_board_w)
|
|||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case 0x0:
|
case 0x0:
|
||||||
machine().output().set_value("wheel", arg); // target wheel angle. signed byte.
|
m_wheel_driver[0] = arg;
|
||||||
m_wheel_force = int8_t(~arg);
|
m_wheel_force = int8_t(~arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1135,7 +1137,7 @@ CUSTOM_INPUT_MEMBER(vegas_state::keypad_r)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (row_sel <= 3) {
|
if (row_sel <= 3) {
|
||||||
uint32_t bits = m_keypad->read();
|
uint32_t bits = m_io_keypad->read();
|
||||||
bits >>= row_sel * 3;
|
bits >>= row_sel * 3;
|
||||||
return bits & 0x7;
|
return bits & 0x7;
|
||||||
}
|
}
|
||||||
@ -1151,7 +1153,7 @@ CUSTOM_INPUT_MEMBER(vegas_state::keypad_r)
|
|||||||
DECLARE_CUSTOM_INPUT_MEMBER(vegas_state::gearshift_r)
|
DECLARE_CUSTOM_INPUT_MEMBER(vegas_state::gearshift_r)
|
||||||
{
|
{
|
||||||
// Check for gear change and save gear selection
|
// Check for gear change and save gear selection
|
||||||
uint32_t gear = m_gearshift->read();
|
uint32_t gear = m_io_gearshift->read();
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (gear & (1 << i))
|
if (gear & (1 << i))
|
||||||
|
Loading…
Reference in New Issue
Block a user