diff --git a/src/mame/drivers/laz_aftrshok.cpp b/src/mame/drivers/laz_aftrshok.cpp index ac70499d7ac..9662d6b9917 100644 --- a/src/mame/drivers/laz_aftrshok.cpp +++ b/src/mame/drivers/laz_aftrshok.cpp @@ -30,6 +30,7 @@ https://www.youtube.com/watch?v=9DIhuOEVwf4 */ #include "emu.h" +#include "cpu/mcs51/mcs51.h" #include "sound/okim6295.h" #include "speaker.h" @@ -39,46 +40,139 @@ class aftrshok_state : public driver_device public: aftrshok_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - // ,m_maincpu(*this, "maincpu") + , m_maincpu(*this, "maincpu") + , m_oki(*this, "oki") { } void aftrshok(machine_config &config); private: + void sound_data_w(u8 data); + void mcu_p3_w(u8 data); + + void prog_map(address_map &map); + void ext_map(address_map &map); + virtual void machine_start() override; virtual void machine_reset() override; -// required_device m_maincpu; + required_device m_maincpu; + required_device m_oki; + + u8 m_sound_data; }; static INPUT_PORTS_START( aftrshok ) + PORT_START("IN0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("IN4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) INPUT_PORTS_END void aftrshok_state::machine_start() { + save_item(NAME(m_sound_data)); } void aftrshok_state::machine_reset() { + m_sound_data = 0; +} + +void aftrshok_state::sound_data_w(u8 data) +{ + m_sound_data = data; +} + +void aftrshok_state::mcu_p3_w(u8 data) +{ + if (!BIT(data, 1) && !BIT(data, 2)) + m_oki->write(machine().dummy_space(), 0, m_sound_data); +} + +void aftrshok_state::prog_map(address_map &map) +{ + map(0x0000, 0xffff).rom().region("maincpu", 0); +} + +void aftrshok_state::ext_map(address_map &map) +{ + map(0x0700, 0x0700).nopw(); + map(0x0800, 0x0800).nopw(); + map(0x1000, 0x1000).w(FUNC(aftrshok_state::sound_data_w)); + map(0x1800, 0x1800).nopw(); + map(0x2000, 0x2000).nopw(); + map(0x2800, 0x2800).nopw(); + map(0x4000, 0x4000).portr("IN0"); + map(0x4800, 0x4800).portr("IN1"); + map(0x5000, 0x5000).portr("IN2"); + map(0x5800, 0x5800).portr("IN3"); + map(0x6000, 0x6000).portr("IN4"); + map(0x8000, 0x9fff).ram(); } -MACHINE_CONFIG_START(aftrshok_state::aftrshok) - +void aftrshok_state::aftrshok(machine_config &config) +{ /* basic machine hardware */ -// MCFG_DEVICE_ADD("maincpu", ??, 8000000) // unknown -// MCFG_DEVICE_PROGRAM_MAP(aftrshok_map) -// MCFG_DEVICE_IO_MAP(aftrshok_io) -// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", aftrshok_state, irq0_line_hold) + I8031(config, m_maincpu, 12_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &aftrshok_state::prog_map); + m_maincpu->set_addrmap(AS_IO, &aftrshok_state::ext_map); + m_maincpu->port_out_cb<3>().set(FUNC(aftrshok_state::mcu_p3_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("oki", OKIM6295, 1000000, okim6295_device::PIN7_HIGH) // maybe - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) -MACHINE_CONFIG_END + OKIM6295(config, m_oki, 2.097152_MHz_XTAL, okim6295_device::PIN7_HIGH); + m_oki->add_route(ALL_OUTPUTS, "mono", 1.0); +} @@ -103,5 +197,5 @@ ROM_START( aftrshoka ) ROM_END -GAME( 19??, aftrshok, 0, aftrshok, aftrshok, aftrshok_state, empty_init, ROT0, "Lazer-tron", "After Shock (Lazer-tron, set 1)", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 19??, aftrshoka, aftrshok, aftrshok, aftrshok, aftrshok_state, empty_init, ROT0, "Lazer-tron", "After Shock (Lazer-tron, set 2)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 19??, aftrshok, 0, aftrshok, aftrshok, aftrshok_state, empty_init, ROT0, "Lazer-tron", "After Shock (Lazer-tron, set 1)", MACHINE_NOT_WORKING | MACHINE_IS_MECHANICAL ) +GAME( 19??, aftrshoka, aftrshok, aftrshok, aftrshok, aftrshok_state, empty_init, ROT0, "Lazer-tron", "After Shock (Lazer-tron, set 2)", MACHINE_NOT_WORKING | MACHINE_IS_MECHANICAL )