From 5970379b7ca52afc2689eebb78f3c2e887900284 Mon Sep 17 00:00:00 2001 From: Ariane Fugmann Date: Sun, 22 Jan 2017 19:22:26 +0100 Subject: [PATCH 1/2] polyplay: add light organ + layout traced the lines on the board to figure out how the lightorgan worked. a zero cross detector triggers NMI on the cpu, which then operates the light organ. --- src/mame/drivers/polyplay.cpp | 66 ++++++++++++++++---- src/mame/includes/polyplay.h | 2 + src/mame/layout/polyplay.lay | 112 ++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 13 deletions(-) create mode 100644 src/mame/layout/polyplay.lay diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 546d64efbc3..21b9b290775 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -104,9 +104,9 @@ i/o ports: bit 7 = coin sensor (+IRQ to make the game acknowledge it) 85 PIO PORT B - bit 0-4 = light organ (unemulated :)) ) - bit 5-7 = sound parameter (unemulated, it's very difficult to - figure out how those work) + bit 0-2 = light organ + bit 3-4 = control panel (not connected) + bit 5-7 = sound parameter (not used on production units?) 86 PIO CTRL A @@ -135,6 +135,7 @@ this.) #include "cpu/z80/z80.h" #include "cpu/z80/z80daisy.h" #include "includes/polyplay.h" +#include "polyplay.lh" static const z80_daisy_config daisy_chain_zre[] = { @@ -151,6 +152,11 @@ static const z80_daisy_config daisy_chain_zrepp[] = { nullptr } }; +INTERRUPT_GEN_MEMBER(polyplay_state::nmi_handler) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + /* I/O Port handling */ WRITE_LINE_MEMBER(polyplay_state::ctc_zc2_w) { @@ -176,14 +182,47 @@ READ8_MEMBER(polyplay_state::pio_portb_r) WRITE8_MEMBER(polyplay_state::pio_portb_w) { - /* ZRE -pio_portb_w: 78 - */ + uint8_t lightState = data & 0x07; + //uint8_t soundState = data & 0xe0; - /* ZRE-PP -pio_portb_w: f8 - */ - osd_printf_verbose("pio_portb_w: %02x\n", data); + // there is a DS8205D attached to bit 0 and 1 + switch (lightState) + { + case 0: + output().set_lamp_value(1, 1); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + + case 1: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 1); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + + case 2: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 1); + output().set_lamp_value(4, 0); + break; + + case 3: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 1); + break; + + default: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + } } INPUT_CHANGED_MEMBER(polyplay_state::input_changed) @@ -274,6 +313,7 @@ static MACHINE_CONFIG_START( polyplay_zre, polyplay_state ) MCFG_Z80_DAISY_CHAIN(daisy_chain_zre) MCFG_CPU_PROGRAM_MAP(polyplay_mem_zre) MCFG_CPU_IO_MAP(polyplay_io_zre) + MCFG_CPU_PERIODIC_INT_DRIVER(polyplay_state, nmi_handler, 100) /* A302 - zero cross detection from AC (50Hz) */ /* devices */ MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, POLYPLAY_MAIN_CLOCK / 4) /* UB857D */ @@ -393,6 +433,6 @@ ROM_START( polyplay2c ) ROM_END /* game driver */ -GAME( 1986, polyplay, 0, polyplay_zre, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE)", 0 ) -GAME( 1989, polyplay2, 0, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP)", 0 ) -GAME( 1989, polyplay2c, polyplay2, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP - Czech)", 0 ) +GAMEL( 1986, polyplay, 0, polyplay_zre, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE)", 0, layout_polyplay ) +GAMEL( 1989, polyplay2, 0, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP)", 0, layout_polyplay ) +GAMEL( 1989, polyplay2c, polyplay2, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP - Czech)", 0, layout_polyplay ) diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h index 1e54ae627d1..4f66519b51d 100644 --- a/src/mame/includes/polyplay.h +++ b/src/mame/includes/polyplay.h @@ -42,6 +42,8 @@ public: required_device m_gfxdecode; required_device m_palette; + INTERRUPT_GEN_MEMBER(nmi_handler); + /* devices */ DECLARE_WRITE_LINE_MEMBER(ctc_zc0_w); DECLARE_WRITE_LINE_MEMBER(ctc_zc1_w); diff --git a/src/mame/layout/polyplay.lay b/src/mame/layout/polyplay.lay new file mode 100644 index 00000000000..e9473865cb3 --- /dev/null +++ b/src/mame/layout/polyplay.lay @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4e5f922341d962577d19a62ee4ed21c7de1fc8f0 Mon Sep 17 00:00:00 2001 From: Ariane Fugmann Date: Thu, 26 Jan 2017 19:55:19 +0100 Subject: [PATCH 2/2] polyplay: add light organ logic + optional layout file (nw) --- src/mame/layout/polyplay.lay | 121 ++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 58 deletions(-) diff --git a/src/mame/layout/polyplay.lay b/src/mame/layout/polyplay.lay index e9473865cb3..ef1ce3a1dff 100644 --- a/src/mame/layout/polyplay.lay +++ b/src/mame/layout/polyplay.lay @@ -1,112 +1,117 @@ - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + \ No newline at end of file