a few tweaks relating to recent SPG ADC work (nw) (#6826)

* give fordrace some controls (nw)

* move some adc reads to the correct channels (nw)

* stop jak_capb from crashing, plunger no longer works with new code however (nw)

* hook up battery states (nw)
This commit is contained in:
David Haywood 2020-06-13 22:47:16 +01:00 committed by GitHub
parent 0572ca886e
commit 2a95b76ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 89 additions and 22 deletions

View File

@ -65,6 +65,8 @@ void spg110_device::configure_spg_io(spg2xx_io_device* io)
io->portc_out().set(FUNC(spg110_device::portc_w));
io->adc_in<0>().set(FUNC(spg110_device::adc_r<0>));
io->adc_in<1>().set(FUNC(spg110_device::adc_r<1>));
io->adc_in<2>().set(FUNC(spg110_device::adc_r<2>));
io->adc_in<3>().set(FUNC(spg110_device::adc_r<3>));
io->chip_select().set(FUNC(spg110_device::cs_w));
// io->pal_read_callback().set(FUNC(spg110_device::get_pal_r));
// io->write_timer_irq_callback().set(FUNC(spg110_device::timerirq_w));

View File

@ -69,7 +69,7 @@ private:
devcb_read16 m_portb_in;
devcb_read16 m_portc_in;
devcb_read16::array<2> m_adc_in;
devcb_read16::array<4> m_adc_in;
devcb_write8 m_chip_sel;

View File

@ -1655,31 +1655,49 @@ void spg2xx_io_device::check_irqs(const uint16_t changed)
if (changed & 0x0c00) // Timer A, Timer B IRQ
{
LOGMASKED(LOG_TIMERS, "%ssserting IRQ2 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00), changed);
m_timer_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? ASSERT_LINE : CLEAR_LINE);
if (m_timer_irq_cb)
m_timer_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("spg2xx_io_device::check_irqs, attempted to use m_timer_irq_cb without setting it\n");
}
if (changed & 0x6100) // UART, SPI, SIO, I2C, ADC IRQ
{
LOGMASKED(LOG_UART | LOG_SIO | LOG_SPI | LOG_I2C | LOG_ADC, "%ssserting IRQ3 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100), changed);
m_uart_adc_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? ASSERT_LINE : CLEAR_LINE);
if (m_uart_adc_irq_cb)
m_uart_adc_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("spg2xx_io_device::check_irqs, attempted to use m_uart_adc_irq_cb without setting it\n");
}
if (changed & 0x1200) // External IRQ
{
LOGMASKED(LOG_UART, "%ssserting IRQ5 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200), changed);
m_external_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? ASSERT_LINE : CLEAR_LINE);
if (m_external_irq_cb)
m_external_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("spg2xx_io_device::check_irqs, attempted to use m_external_irq_cb without setting it\n");
}
if (changed & 0x0070) // 1024Hz, 2048Hz, 4096Hz IRQ
{
LOGMASKED(LOG_TIMERS, "%ssserting IRQ6 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070), changed); //m_cpu->set_state_unsynced(UNSP_IRQ6_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
m_ffreq_tmr1_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
if (m_ffreq_tmr1_irq_cb)
m_ffreq_tmr1_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("spg2xx_io_device::check_irqs, attempted to use m_ffreq_tmr1_irq_cb without setting it\n");
}
if (changed & 0x008b) // TMB1, TMB2, 4Hz, key change IRQ
{
LOGMASKED(LOG_IRQS, "%ssserting IRQ7 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b), changed);
m_ffreq_tmr2_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? ASSERT_LINE : CLEAR_LINE);
if (m_ffreq_tmr2_irq_cb)
m_ffreq_tmr2_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("spg2xx_io_device::check_irqs, attempted to use m_ffreq_tmr2_irq_cb without setting it\n");
}
}

View File

@ -646,13 +646,35 @@ static INPUT_PORTS_START( fordrace )
PORT_MODIFY("P3")
PORT_START("AD0") // 12-bit port (controls the display of 2 pedals in service mode, always same position, is there another multiplexer for brake, or should more bits be using to select analog port in core?)
PORT_BIT(0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff)
PORT_START("AD0") // 12-bit port, Accelerator
PORT_BIT(0x0fff, 0x0000, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff)
PORT_START("AD1") // 12-bit port (not sure which bits are used and how, shows a position in service mode if you return random values)
PORT_BIT(0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff)
PORT_START("AD1") // 12-bit port, Brake
PORT_BIT(0x0fff, 0x0000, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff)
PORT_START("AD2") // 12-bit port, Wheel is split across 2 ports, value added together?
PORT_BIT( 0x0fff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(spg2xx_game_fordrace_state, wheel2_r)
PORT_START("AD3") // 12-bit port, Wheel (see above)
PORT_BIT( 0x0fff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(spg2xx_game_fordrace_state, wheel_r)
PORT_START("WHEEL_REAL")
PORT_BIT(0x1fff, 0x0000, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x1fff) PORT_NAME("Wheel")
INPUT_PORTS_END
CUSTOM_INPUT_MEMBER(spg2xx_game_fordrace_state::wheel_r)
{
return ioport("WHEEL_REAL")->read() >> 1;
}
CUSTOM_INPUT_MEMBER(spg2xx_game_fordrace_state::wheel2_r)
{
// return 0x0800;
uint16_t dat = ioport("WHEEL_REAL")->read();
return ((dat >> 1) ^ 0xfff) + (dat & 1);
}
static INPUT_PORTS_START( senspeed )
PORT_START("P1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
@ -1016,8 +1038,11 @@ void spg2xx_game_fordrace_state::fordrace(machine_config &config)
m_maincpu->portc_in().set(FUNC(spg2xx_game_fordrace_state::base_portc_r));
// these do something in test mode, but in game the ADC interrupt is never generated?
m_maincpu->adc_in<0>().set_ioport("AD0"); // pedals
m_maincpu->adc_in<1>().set_ioport("AD1"); // steering
m_maincpu->adc_in<0>().set_ioport("AD0"); // pedals1
m_maincpu->adc_in<1>().set_ioport("AD1"); // pedal2
m_maincpu->adc_in<2>().set_ioport("AD2"); // steering
m_maincpu->adc_in<3>().set_ioport("AD3"); // steering
}
uint16_t spg2xx_game_senspeed_state::portb_r()

View File

@ -542,7 +542,7 @@ void jakks_gkr_state::jakks_gkr_wp(machine_config &config)
jakks_gkr(config);
m_maincpu->set_addrmap(AS_PROGRAM, &jakks_gkr_state::mem_map_1m);
m_maincpu->adc_in<0>().set_ioport("JOYX");
m_maincpu->adc_in<1>().set_ioport("JOYY");
m_maincpu->adc_in<2>().set_ioport("JOYY");
//SOFTWARE_LIST(config, "jakks_gamekey_wp").set_original("jakks_gamekey_wp"); // NO KEYS RELEASED
m_maincpu->set_force_no_drc(true); // the Light Tag game seems to hang maybe once every 7 times with the DRC, appears more stable without (could just be chance tho)
@ -553,7 +553,7 @@ void jakks_gkr_state::jakks_gkr_cb(machine_config &config)
jakks_gkr(config);
m_maincpu->set_addrmap(AS_PROGRAM, &jakks_gkr_state::mem_map_1m);
m_maincpu->adc_in<0>().set_ioport("JOYX");
m_maincpu->adc_in<1>().set_ioport("JOYY");
m_maincpu->adc_in<2>().set_ioport("JOYY");
//SOFTWARE_LIST(config, "jakks_gamekey_cb").set_original("jakks_gamekey_cb"); // NO KEYS RELEASED
}

View File

@ -16,6 +16,7 @@ public:
{ }
void zon32bit(machine_config& config);
void zon32bit_bat(machine_config& config);
void mem_map_zon32bit(address_map &map);
@ -36,6 +37,8 @@ protected:
virtual void portb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
virtual void portc_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
uint16_t an3_r();
int m_porta_dat;
int m_portb_dat;
int m_portc_dat;
@ -67,10 +70,8 @@ public:
{ }
void init_oplayer();
void init_m505neo();
protected:
virtual uint16_t porta_r() override;
virtual uint16_t portb_r() override;
@ -87,8 +88,6 @@ public:
void init_denver();
void init_m521neo();
protected:
virtual void machine_reset() override;
@ -99,6 +98,15 @@ protected:
virtual void porta_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override;
};
uint16_t zon32bit_state::an3_r()
{
int status = ioport("BATT")->read();
if (status)
return 0xfff;
else
return 0x000;
}
void zon32bit_state::device_post_load()
{
// load state can change the bank, so we must invalide cache
@ -694,6 +702,11 @@ static INPUT_PORTS_START( oplayer )
PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_START("BATT")
PORT_CONFNAME( 0x0001, 0x0001, "Battery Status" )
PORT_CONFSETTING( 0x0000, "Low" )
PORT_CONFSETTING( 0x0001, "High" )
INPUT_PORTS_END
@ -713,6 +726,12 @@ void zon32bit_state::zon32bit(machine_config &config)
m_maincpu->portc_out().set(FUNC(zon32bit_state::portc_w));
}
void zon32bit_state::zon32bit_bat(machine_config& config)
{
zon32bit(config);
m_maincpu->adc_in<3>().set(FUNC(zon32bit_state::an3_r));
}
ROM_START( mywicodx )
ROM_REGION( 0x4000000, "maincpu", ROMREGION_ERASE00 )
// the first bank contains the Mi Guitar game, the 2nd half of the ROM is where the Menu starts
@ -910,12 +929,12 @@ CONS( 200?, zon32bit, 0, 0, zon32bit, zon32bit, zon32bit_state, empty_init,
CONS( 200?, mywicodx, 0, 0, zon32bit, zon32bit, mywicodx_state, empty_init, "<unknown>", "My Wico Deluxe (Family Sport 85-in-1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
// issues with 'low battery' always showing, but otherwise functional
CONS( 200?, oplayer, 0, 0, zon32bit, oplayer, oplayer_100in1_state, init_oplayer, "OPlayer", "OPlayer Mobile Game Console (MGS03-white) (Family Sport 100-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
CONS( 200?, oplayer, 0, 0, zon32bit_bat, oplayer, oplayer_100in1_state, init_oplayer, "OPlayer", "OPlayer Mobile Game Console (MGS03-white) (Family Sport 100-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
CONS( 2012, m505neo, 0, 0, zon32bit, oplayer, oplayer_100in1_state, init_m505neo, "Millennium 2000 GmbH", "Millennium M505 Arcade Neo Portable Spielkonsole (Family Sport 100-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
CONS( 2012, m505neo, 0, 0, zon32bit_bat, oplayer, oplayer_100in1_state, init_m505neo, "Millennium 2000 GmbH", "Millennium M505 Arcade Neo Portable Spielkonsole (Family Sport 100-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
// a version of this exists with the 'newer' style title screen seen in m505neo
CONS( 2012, m521neo, 0, 0, zon32bit, oplayer, denver_200in1_state, init_m521neo, "Millennium 2000 GmbH", "Millennium M521 Arcade Neo 2.0 (Family Sport 220-in-1) ", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
CONS( 2012, m521neo, 0, 0, zon32bit_bat, oplayer, denver_200in1_state, init_m521neo, "Millennium 2000 GmbH", "Millennium M521 Arcade Neo 2.0 (Family Sport 220-in-1) ", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
/*
DENVER(r)
@ -934,6 +953,6 @@ DENMARK
*/
CONS( 200?, dnv200fs, 0, 0, zon32bit, oplayer, denver_200in1_state, init_denver, "Denver", "Denver (GMP-270CMK2) (Family Sport 200-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
CONS( 200?, dnv200fs, 0, 0, zon32bit_bat, oplayer, denver_200in1_state, init_denver, "Denver", "Denver (GMP-270CMK2) (Family Sport 200-in-1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )

View File

@ -249,6 +249,9 @@ public:
void fordrace(machine_config &config);
DECLARE_CUSTOM_INPUT_MEMBER(wheel_r);
DECLARE_CUSTOM_INPUT_MEMBER(wheel2_r);
private:
};