From cbcef6af48af317808c30a3e05c0b654893dab50 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Mon, 28 Jan 2019 18:08:30 +0100 Subject: New working machines -------------------- Star Wars - Revenge of the Sith (JAKKS Pacific TV Game, Game-Key Ready) [Sean Riddle, Peter Wilhelmsen] -vii: Mapped jak_sith controls. [Ryan Holtz] -spg2xx: Added polled ADC mode, and 2-channel ADC support. [Ryan Holtz] --- src/devices/machine/spg2xx.cpp | 11 ++++++++--- src/devices/machine/spg2xx.h | 4 ++-- src/mame/drivers/clickstart.cpp | 2 +- src/mame/drivers/vii.cpp | 33 ++++++++++++++++++++++++++------- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp index 19bc7151b3b..f8782ed0db7 100644 --- a/src/devices/machine/spg2xx.cpp +++ b/src/devices/machine/spg2xx.cpp @@ -73,7 +73,7 @@ spg2xx_device::spg2xx_device(const machine_config &mconfig, device_type type, co , m_porta_in(*this) , m_portb_in(*this) , m_portc_in(*this) - , m_adc_in(*this) + , m_adc_in{{*this}, {*this}} , m_eeprom_w(*this) , m_eeprom_r(*this) , m_uart_tx(*this) @@ -125,7 +125,8 @@ void spg2xx_device::device_start() m_porta_in.resolve_safe(0); m_portb_in.resolve_safe(0); m_portc_in.resolve_safe(0); - m_adc_in.resolve_safe(0x0fff); + m_adc_in[0].resolve_safe(0); + m_adc_in[1].resolve_safe(0); m_eeprom_w.resolve_safe(); m_eeprom_r.resolve_safe(0); m_uart_tx.resolve_safe(); @@ -1634,9 +1635,13 @@ WRITE16_MEMBER(spg2xx_device::io_w) { LOGMASKED(LOG_IO_WRITES, "%s: io_w: ADC Control = %04x\n", machine().describe_context(), data); m_io_regs[offset] = data & ~0x1000; + if (BIT(data, 0)) + { + m_io_regs[0x27] = 0x8000 | (m_adc_in[BIT(data, 5)]() & 0x7fff); + m_io_regs[0x25] |= 0x2000; + } if (BIT(data, 12) && !BIT(m_io_regs[offset], 1)) { - m_io_regs[0x27] = 0x8000 | (m_adc_in() & 0x7fff); const uint16_t old = IO_IRQ_STATUS; IO_IRQ_STATUS |= 0x2000; const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE); diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h index 78532a5d60e..e8a006dc273 100644 --- a/src/devices/machine/spg2xx.h +++ b/src/devices/machine/spg2xx.h @@ -54,7 +54,7 @@ public: auto portb_in() { return m_portb_in.bind(); } auto portc_in() { return m_portc_in.bind(); } - auto adc_in() { return m_adc_in.bind(); } + template auto adc_in() { return m_adc_in[Line].bind(); } auto eeprom_w() { return m_eeprom_w.bind(); } auto eeprom_r() { return m_eeprom_r.bind(); } @@ -506,7 +506,7 @@ protected: devcb_read16 m_portb_in; devcb_read16 m_portc_in; - devcb_read16 m_adc_in; + devcb_read16 m_adc_in[2]; devcb_write8 m_eeprom_w; devcb_read8 m_eeprom_r; diff --git a/src/mame/drivers/clickstart.cpp b/src/mame/drivers/clickstart.cpp index c03fb706eea..69d1fb1235e 100644 --- a/src/mame/drivers/clickstart.cpp +++ b/src/mame/drivers/clickstart.cpp @@ -420,7 +420,7 @@ void clickstart_state::clickstart(machine_config &config) m_spg->porta_in().set(FUNC(clickstart_state::porta_r)); m_spg->portb_in().set(FUNC(clickstart_state::portb_r)); m_spg->portc_in().set(FUNC(clickstart_state::portc_r)); - m_spg->adc_in().set_constant(0x0fff); + m_spg->adc_in<0>().set_constant(0x0fff); m_spg->chip_select().set(FUNC(clickstart_state::chip_sel_w)); m_spg->add_route(ALL_OUTPUTS, "lspeaker", 0.5); m_spg->add_route(ALL_OUTPUTS, "rspeaker", 0.5); diff --git a/src/mame/drivers/vii.cpp b/src/mame/drivers/vii.cpp index 6d8b82f31c2..51087d9feef 100644 --- a/src/mame/drivers/vii.cpp +++ b/src/mame/drivers/vii.cpp @@ -448,6 +448,23 @@ static INPUT_PORTS_START( walle ) PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END +static INPUT_PORTS_START( jak_sith ) + PORT_START("P1") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON2 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON3 ) + PORT_BIT( 0xf3df, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("P3") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, spg2xx_game_state,i2c_r, nullptr) + PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("JOYX") + PORT_BIT(0x0fff, 0x0000, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff) + + PORT_START("JOYY") + PORT_BIT(0x0fff, 0x0000, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x00,0x0fff) +INPUT_PORTS_END static INPUT_PORTS_START( jak_gkr ) PORT_START("P1") @@ -968,6 +985,8 @@ void jakks_gkr_state::jakks_gkr_sw(machine_config &config) { jakks_gkr(config); m_maincpu->set_addrmap(AS_PROGRAM, &jakks_gkr_state::mem_map_1m); + m_spg->adc_in<0>().set_ioport("JOYX"); + m_spg->adc_in<1>().set_ioport("JOYY"); SOFTWARE_LIST(config, "jakks_gamekey_sw").set_original("jakks_gamekey_sw"); } @@ -1273,13 +1292,13 @@ CONS( 2004, jak_batm, 0, 0, jakks, batman, spg2xx_game_state, empty_init, "JAKKS CONS( 2008, jak_wall, 0, 0, walle, walle, spg2xx_game_state, empty_init, "JAKKS Pacific Inc / HotGen Ltd", "Wall-E (JAKKS Pacific TV Game)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // 'Game-Key Ready' JAKKS games (these can also take per-game specific expansion cartridges, although not all games had them released) Some of these were available in versions without Game-Key ports, it is unconfirmed if code was the same unless otherwise stated -CONS( 2005, jak_wwe, 0, 0, jakks_gkr_1m, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / HotGen Ltd", "WWE (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // WW (no game-keys released) -CONS( 2005, jak_fan4, 0, 0, jakks_gkr_1m, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Digital Eclipse", "Fantastic Four (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // F4 (no game-keys released) -CONS( 2005, jak_just, 0, 0, jakks_gkr_1m, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Taniko", "Justice League (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // DC (no game-keys released) -CONS( 2005, jak_dora, 0, 0, jakks_gkr_nk, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Handheld Games", "Dora the Explorer - Race To Play Park (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses NK keys (same as Nicktoons & Spongebob) (3+ released) -CONS( 2005, jak_sdoo, 0, 0, jakks_gkr_2m, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Jolliford Management","Scooby-Doo! and the Mystery of the Castle (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // SD (no game-keys released) -CONS( 2005, jak_disf, 0, 0, jakks_gkr_dy, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / HotGen Ltd", "Disney Friends (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses DY keys (3 released) -CONS( 2005, jak_sith, 0, 0, jakks_gkr_sw, jak_gkr,jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Griptonite Games", "Star Wars - Revenge of the Sith (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses SW keys (1 released) +CONS( 2005, jak_wwe, 0, 0, jakks_gkr_1m, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / HotGen Ltd", "WWE (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // WW (no game-keys released) +CONS( 2005, jak_fan4, 0, 0, jakks_gkr_1m, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Digital Eclipse", "Fantastic Four (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // F4 (no game-keys released) +CONS( 2005, jak_just, 0, 0, jakks_gkr_1m, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Taniko", "Justice League (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // DC (no game-keys released) +CONS( 2005, jak_dora, 0, 0, jakks_gkr_nk, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Handheld Games", "Dora the Explorer - Race To Play Park (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses NK keys (same as Nicktoons & Spongebob) (3+ released) +CONS( 2005, jak_sdoo, 0, 0, jakks_gkr_2m, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Jolliford Management","Scooby-Doo! and the Mystery of the Castle (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // SD (no game-keys released) +CONS( 2005, jak_disf, 0, 0, jakks_gkr_dy, jak_gkr, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / HotGen Ltd", "Disney Friends (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses DY keys (3 released) +CONS( 2005, jak_sith, 0, 0, jakks_gkr_sw, jak_sith, jakks_gkr_state, empty_init, "JAKKS Pacific Inc / Griptonite Games", "Star Wars - Revenge of the Sith (JAKKS Pacific TV Game, Game-Key Ready)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // uses SW keys (1 released) // Nicktoons NK (3? keys available) (same keys as Dora the Explorer) // SpongeBob SquarePants: The Fry Cook Games NK (3? keys available) ^^ -- cgit v1.2.3