From a3fdd3256cb1ce59431f09afcc319a76c2fb7bc8 Mon Sep 17 00:00:00 2001 From: Ariane Fugmann Date: Thu, 12 Jan 2017 19:47:40 +0100 Subject: [PATCH 1/2] polyplay: added newer ZRE-PP based polyplay version - documented differences in hardware - added newer ZRE-PP board (SIO not yet hooked up) - added a check export version with the new menu - fixed undocumented Z80 CTC 'on-the-fly' mode switch; internal timer didn't stop. --- src/devices/machine/z80ctc.cpp | 6 + src/mame/audio/polyplay.cpp | 61 +----- src/mame/drivers/polyplay.cpp | 381 ++++++++++++++++++--------------- src/mame/includes/polyplay.h | 75 ++++--- src/mame/mame.lst | 1 + src/mame/video/polyplay.cpp | 10 +- 6 files changed, 270 insertions(+), 264 deletions(-) diff --git a/src/devices/machine/z80ctc.cpp b/src/devices/machine/z80ctc.cpp index b4e072654cc..d70afe55281 100644 --- a/src/devices/machine/z80ctc.cpp +++ b/src/devices/machine/z80ctc.cpp @@ -430,6 +430,12 @@ void z80ctc_device::ctc_channel::write(uint8_t data) // this must be a control word else if ((data & CONTROL) == CONTROL_WORD) { + // (mode change without reset?) + if ((m_mode & MODE) == MODE_TIMER && (data & MODE) == MODE_COUNTER && (data & RESET) == 0) + { + m_timer->adjust(attotime::never); + } + // set the new mode m_mode = data; VPRINTF_CHANNEL(("CTC ch.%d mode = %02x\n", m_index, data)); diff --git a/src/mame/audio/polyplay.cpp b/src/mame/audio/polyplay.cpp index 94340359c90..7a32b4c1cbe 100644 --- a/src/mame/audio/polyplay.cpp +++ b/src/mame/audio/polyplay.cpp @@ -12,61 +12,22 @@ ***************************************************************************/ #include "emu.h" -#include "sound/samples.h" #include "includes/polyplay.h" -#define LFO_VOLUME 25 -#define SAMPLE_AMPLITUDE 0x4000 - - - -SAMPLES_START_CB_MEMBER(polyplay_state::sh_start) +WRITE_LINE_MEMBER(polyplay_state::ctc_zc0_w) { - int i; - - for (i = 0; i < SAMPLE_LENGTH / 2; i++) { - m_backgroundwave[i] = + SAMPLE_AMPLITUDE; - } - for (i = SAMPLE_LENGTH / 2; i < SAMPLE_LENGTH; i++) { - m_backgroundwave[i] = - SAMPLE_AMPLITUDE; - } - m_freq1 = m_freq2 = 110; - m_channel_playing1 = 0; - m_channel_playing2 = 0; -} - -void polyplay_state::set_channel1(int active) -{ - m_channel_playing1 = active; -} - -void polyplay_state::set_channel2(int active) -{ - m_channel_playing2 = active; -} - -void polyplay_state::play_channel1(int data) -{ - if (data) { - m_freq1 = 2457600 / 16 / data / 8; - m_samples->set_volume(0, m_channel_playing1 * 1.0); - m_samples->start_raw(0, m_backgroundwave, ARRAY_LENGTH(m_backgroundwave), sizeof(m_backgroundwave)*m_freq1,true); - } - else { - m_samples->stop(0); - m_samples->stop(1); + if (state) + { + m_flipflop1 = ~m_flipflop1; + m_speaker1->level_w(m_flipflop1); } } -void polyplay_state::play_channel2(int data) +WRITE_LINE_MEMBER(polyplay_state::ctc_zc1_w) { - if (data) { - m_freq2 = 2457600 / 16 / data / 8; - m_samples->set_volume(1, m_channel_playing2 * 1.0); - m_samples->start_raw(1, m_backgroundwave, ARRAY_LENGTH(m_backgroundwave), sizeof(m_backgroundwave)*m_freq2,true); + if (state) + { + m_flipflop2 = ~m_flipflop2; + m_speaker2->level_w(m_flipflop2); } - else { - m_samples->stop(0); - m_samples->stop(1); - } -} +} \ No newline at end of file diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 1ff225d896b..1586afe5429 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Martin Buchholz +// thanks-to:James Wallace, Martin Buchholz, Juergen Oppermann, Volker Hann, Jan-Ole Christian /*************************************************************************** Poly-Play @@ -15,58 +16,99 @@ one of the last existing Poly-Play arcade automatons. He also provided me with schematics and service manuals. +NOTES: + The hardware is based on the K1520 PC system, with video output coming through a standard Colormat TV. + + There are at least two revisions: + + - Revision 1 - + 2319-84-01 FAZ Graphics card (Color and Sound Logic) + 2319-84-02 ABS Graphics card (1KiB ROM for Charset) + 012-7100 ZRE CPU-Board K2521 (3KiB ROM, 1KiB RAM) + 012-7040 PFS-1 ROM Board K3820 #1 - Games 1 to 4 (16KiB ROM) + 012-7040 PFS-2 ROM Board K3820 #2 - Games 5 to 8 (16KiB ROM) + + - Revision 2 - + 2319-84-01 FAZ Graphics card (Color and Sound Logic) + 2319-84-02 ABS Graphics card (1KiB ROM for Charset) + 02 899-0101 ZRE-PP CPU-Board (56KiB ROM, 64KiB* RAM) + + Basically revision 2 combines the ZRE, PFS-1 and PFS-2 onto a single board. + memory map: + - Revision 1 - + 0000 - 0fff ZRE OS ROM (0000 - 03ff) + Game ROM used for Abfahrtslauf (0400 - 07ff) + Menu Screen ROM (0800 - 0cff) + Work RAM (0d00 - 0fff) -0000 - 03ff OS ROM -0400 - 07ff Game ROM (used for Abfahrtslauf) -0800 - 0cff Menu Screen ROM + 1000 - 4fff PFS-1 Abfahrtslauf (1000 - 1bff) + Hirschjagd (1c00 - 27ff) + Hase und Wolf (2800 - 3fff) + Schmetterlingsfang (4000 - 4fff) + + 5000 - 8fff PFS-2 Schiessbude (5000 - 5fff) + Autorennen (6000 - 73ff) + opto-akust. Merkspiel (7400 - 7fff) + Wasserrohrbruch (8000 - 8fff) -0d00 - 0fff work RAM + e800 - ebff ABS Character ROM (chr 00..7f) 1 bit per pixel + ec00 - f7ff ABS Character RAM (chr 80..ff) 3 bit per pixel + f800 - ffff FAZ Video RAM -1000 - 4fff GAME ROM (pcb 2 - Abfahrtslauf (1000 - 1bff) - Hirschjagd (1c00 - 27ff) - Hase und Wolf (2800 - 3fff) - Schmetterlingsfang (4000 - 4fff) -5000 - 8fff GAME ROM (pcb 1 - Schiessbude (5000 - 5fff) - Autorennen (6000 - 73ff) - opto-akust. Merkspiel (7400 - 7fff) - Wasserrohrbruch (8000 - 8fff) + - Revision 2 - + 0000 - 0fff ZRE-PP OS and Menu ROM (0000 - 1fff) + Game ROM #1 (2000 - 3fff) + Game ROM #2 (4000 - 5fff) + Game ROM #3 (6000 - 7fff) + Game ROM #4 (8000 - 9fff) + Game ROM #5 (a000 - bfff) + Game ROM #6 (c000 - dfff) -e800 - ebff character ROM (chr 00..7f) 1 bit per pixel -ec00 - f7ff character RAM (chr 80..ff) 3 bit per pixel -f800 - ffff video RAM + e800 - ebff ABS Character ROM (chr 00..7f) 1 bit per pixel + ec00 - f7ff ABS Character RAM (chr 80..ff) 3 bit per pixel + f800 - ffff FAZ Video RAM -I/O ports: -read: +i/o ports: + - Revision 1 - + 80 - 83 ZRE UB857D (Z80 CTC) + 84 - 87 ZRE UB855D (Z80 PIO) -83 IN1 - used as hardware random number generator + - Revision 2 - + 80 - 83 ZRE-PP UB857D (Z80 CTC) + 84 - 87 ZRE-PP UB855D (Z80 PIO) + ?? - ?? ZRE-PP UB8560D (Z80 SIO) + + read: + 83 CTC COUNT 3 (IN1) + used as hardware random number generator -84 IN0 - bit 0 = fire button - bit 1 = right - bit 2 = left - bit 3 = up - bit 4 = down - bit 5 = unused - bit 6 = Summe Spiele - bit 7 = coinage (+IRQ to make the game acknowledge it) + 84 PIO PORT A (IN0) + bit 0 = fire button + bit 1 = right + bit 2 = left + bit 3 = up + bit 4 = down + bit 5 = unused* + bit 6 = bookkeeping (Summe Spiele) + bit 7 = coin sensor (+IRQ to make the game acknowledge it) -85 bit 0-4 = light organ (unemulated :)) ) - bit 5-7 = sound parameter (unemulated, it's very difficult to - figure out how those work) + 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) -86 ??? + 86 PIO CTRL A -87 PIO Control register + 87 PIO CTRL B -write: -80 Sound Channel 1 -81 Sound Channel 2 -82 generates 40 Hz timer for timeout in game title screens -83 generates main 75 Hz timer interrupt + write: + 80 CTC COUNT 1 - Sound Channel 1 + 81 CTC COUNT 2 - Sound Channel 2 + 82 CTC COUNT 3 - generates 40 Hz timer for timeout in game title screens + 83 CTC COUNT 4 - generates main 75 Hz timer interrupt The Poly-Play has a simple bookmarking system which can be activated setting Bit 6 of PORTA (Summe Spiele) to low. It reads a double word @@ -83,54 +125,66 @@ this.) #include "emu.h" #include "cpu/z80/z80.h" -#include "sound/samples.h" +#include "cpu/z80/z80daisy.h" #include "includes/polyplay.h" +static const z80_daisy_config daisy_chain_zre[] = +{ + { Z80CTC_TAG }, + { Z80PIO_TAG }, + { nullptr } +}; + +static const z80_daisy_config daisy_chain_zrepp[] = +{ + { Z80CTC_TAG }, + { Z80PIO_TAG }, + { Z80SIO_TAG }, + { nullptr } +}; /* I/O Port handling */ - - -/* timer handling */ - - -void polyplay_state::machine_reset() +WRITE_LINE_MEMBER(polyplay_state::ctc_zc2_w) { - m_channel1_active = 0; - m_channel1_const = 0; - m_channel2_active = 0; - m_channel2_const = 0; - - set_channel1(0); - play_channel1(0); - set_channel2(0); - play_channel2(0); - - m_timer = machine().device("timer"); + //osd_printf_verbose("ctc_z2_w: %02x\n", state); } - -INTERRUPT_GEN_MEMBER(polyplay_state::periodic_interrupt) +READ8_MEMBER(polyplay_state::pio_porta_r) { - device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x4e); + return m_in0_port->read(); } - -INTERRUPT_GEN_MEMBER(polyplay_state::coin_interrupt) +WRITE8_MEMBER(polyplay_state::pio_porta_w) { - if (ioport("INPUT")->read() & 0x80) - m_last = 0; - else - { - if (m_last == 0) /* coin inserted */ - device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x50); - - m_last = 1; - } + osd_printf_verbose("pio_porta_w: %02x\n", data); } +READ8_MEMBER(polyplay_state::pio_portb_r) +{ + uint8_t result = 0x00; + osd_printf_verbose("pio_portb_r: %02x\n", result); + return result; +} + +WRITE8_MEMBER(polyplay_state::pio_portb_w) +{ + /* ZRE +pio_portb_w: 78 + */ + + /* ZRE-PP +pio_portb_w: f8 + */ + osd_printf_verbose("pio_portb_w: %02x\n", data); +} + +INPUT_CHANGED_MEMBER(polyplay_state::input_changed) +{ + m_z80pio->port_a_write(m_in0_port->read()); +} /* memory mapping */ -static ADDRESS_MAP_START( polyplay_map, AS_PROGRAM, 8, polyplay_state ) +static ADDRESS_MAP_START( polyplay_mem_zre, AS_PROGRAM, 8, polyplay_state ) AM_RANGE(0x0000, 0x0bff) AM_ROM AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_RANGE(0x1000, 0x8fff) AM_ROM @@ -139,92 +193,43 @@ static ADDRESS_MAP_START( polyplay_map, AS_PROGRAM, 8, polyplay_state ) AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") ADDRESS_MAP_END +static ADDRESS_MAP_START( polyplay_mem_zrepp, AS_PROGRAM, 8, polyplay_state ) + AM_RANGE(0x0000, 0xbfff) AM_ROM + + AM_RANGE(0xc000, 0xcfff) AM_RAM + + AM_RANGE(0xd000, 0xd7ff) AM_ROM AM_REGION("gfx1", 0) + + AM_RANGE(0xea00, 0xebff) AM_RAM + AM_RANGE(0xec00, 0xf7ff) AM_RAM_WRITE(polyplay_characterram_w) AM_SHARE("characterram") -/* port mapping */ -static ADDRESS_MAP_START( polyplay_io_map, AS_IO, 8, polyplay_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x81) AM_WRITE(polyplay_sound_channel) - AM_RANGE(0x82, 0x82) AM_WRITE(polyplay_start_timer2) - AM_RANGE(0x83, 0x83) AM_READ(polyplay_random_read) - AM_RANGE(0x84, 0x84) AM_READ_PORT("INPUT") + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") ADDRESS_MAP_END +/* port mapping */ +static ADDRESS_MAP_START( polyplay_io_zre, AS_IO, 8, polyplay_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( polyplay_io_zrepp, AS_IO, 8, polyplay_state ) + AM_IMPORT_FROM(polyplay_io_zre) + // TODO: add SIO ports here +ADDRESS_MAP_END static INPUT_PORTS_START( polyplay ) - PORT_START("INPUT") /* IN0 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bookkeeping Info") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) PORT_NAME("Bookkeeping Info") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, polyplay_state, input_changed, 0) INPUT_PORTS_END - -WRITE8_MEMBER(polyplay_state::polyplay_sound_channel) -{ - switch(offset) { - case 0x00: - if (m_channel1_const) { - if (data <= 1) { - set_channel1(0); - } - m_channel1_const = 0; - play_channel1(data*m_prescale1); - - } - else { - m_prescale1 = (data & 0x20) ? 16 : 1; - if (data & 0x04) { - set_channel1(1); - m_channel1_const = 1; - } - if ((data == 0x41) || (data == 0x65) || (data == 0x45)) { - set_channel1(0); - play_channel1(0); - } - } - break; - case 0x01: - if (m_channel2_const) { - if (data <= 1) { - set_channel2(0); - } - m_channel2_const = 0; - play_channel2(data*m_prescale2); - - } - else { - m_prescale2 = (data & 0x20) ? 16 : 1; - if (data & 0x04) { - set_channel2(1); - m_channel2_const = 1; - } - if ((data == 0x41) || (data == 0x65) || (data == 0x45)) { - set_channel2(0); - play_channel2(0); - } - } - break; - } -} - -WRITE8_MEMBER(polyplay_state::polyplay_start_timer2) -{ - if (data == 0x03) - m_timer->reset(); - - if (data == 0xb5) - m_timer->adjust(attotime::from_hz(40), 0, attotime::from_hz(40)); -} - -READ8_MEMBER(polyplay_state::polyplay_random_read) -{ - return machine().rand() & 0xff; -} - /* graphic structures */ static const gfx_layout charlayout_1_bit = { @@ -249,26 +254,33 @@ static const gfx_layout charlayout_3_bit = }; static GFXDECODE_START( polyplay ) - GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout_1_bit, 0, 1 ) - GFXDECODE_ENTRY( nullptr, 0xec00, charlayout_3_bit, 2, 1 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout_1_bit, 0, 1 ) + GFXDECODE_ENTRY( nullptr, 0xec00, charlayout_3_bit, 2, 1 ) GFXDECODE_END /* the machine driver */ - -static MACHINE_CONFIG_START( polyplay, polyplay_state ) - +static MACHINE_CONFIG_START( polyplay_zre, polyplay_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 9830400/4) - MCFG_CPU_PROGRAM_MAP(polyplay_map) - MCFG_CPU_IO_MAP(polyplay_io_map) - MCFG_CPU_PERIODIC_INT_DRIVER(polyplay_state, periodic_interrupt, 75) - MCFG_CPU_VBLANK_INT_DRIVER("screen", polyplay_state, coin_interrupt) - - - MCFG_TIMER_DRIVER_ADD("timer", polyplay_state, polyplay_timer_callback) - + MCFG_CPU_ADD(Z80CPU_TAG, Z80, POLYPLAY_MAIN_CLOCK / 4) /* UB880D */ + MCFG_Z80_DAISY_CHAIN(daisy_chain_zre) + MCFG_CPU_PROGRAM_MAP(polyplay_mem_zre) + MCFG_CPU_IO_MAP(polyplay_io_zre) + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, POLYPLAY_MAIN_CLOCK / 4) /* UB857D */ + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80CPU_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(polyplay_state, ctc_zc0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(polyplay_state, ctc_zc1_w)) + //MCFG_Z80CTC_ZC2_CB(WRITELINE(polyplay_state, ctc_zc2_w)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, POLYPLAY_MAIN_CLOCK / 4) /* UB855D */ + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80CPU_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(polyplay_state, pio_porta_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(polyplay_state, pio_porta_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(polyplay_state, pio_portb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(polyplay_state, pio_portb_w)) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) @@ -283,17 +295,30 @@ static MACHINE_CONFIG_START( polyplay, polyplay_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker1", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + MCFG_SOUND_ADD("speaker2", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) +MACHINE_CONFIG_END - MCFG_SOUND_ADD("samples", SAMPLES, 0) - MCFG_SAMPLES_CHANNELS(2) - MCFG_SAMPLES_START_CB(polyplay_state, sh_start) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +static MACHINE_CONFIG_START( polyplay_zrepp, polyplay_state ) + MCFG_FRAGMENT_ADD( polyplay_zre ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY(Z80CPU_TAG) /* UB880D */ + MCFG_Z80_DAISY_CHAIN(daisy_chain_zrepp) + MCFG_CPU_PROGRAM_MAP(polyplay_mem_zrepp) + MCFG_CPU_IO_MAP(polyplay_io_zrepp) + + /* devices */ + MCFG_Z80SIO_ADD(Z80SIO_TAG, POLYPLAY_MAIN_CLOCK / 4, 0, 0, 0, 0) /* UB8560D */ + MCFG_Z80SIO_OUT_INT_CB(INPUTLINE(Z80CPU_TAG, INPUT_LINE_IRQ0)) MACHINE_CONFIG_END /* ROM loading and mapping */ ROM_START( polyplay ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x10000, Z80CPU_TAG, 0 ) ROM_LOAD( "cpu_0000.37", 0x0000, 0x0400, CRC(87884c5f) SHA1(849c6b3f40496c694a123d6eec268a7128c037f0) ) ROM_LOAD( "cpu_0400.36", 0x0400, 0x0400, CRC(d5c84829) SHA1(baa8790e77db66e1e543b3a0e5390cc71256de2f) ) ROM_LOAD( "cpu_0800.35", 0x0800, 0x0400, CRC(5f36d08e) SHA1(08ecf8143e818a9844b4f168e68629d6d4481a8a) ) @@ -334,11 +359,19 @@ ROM_START( polyplay ) ROM_LOAD( "char.1", 0x0000, 0x0400, CRC(5242dd6b) SHA1(ba8f317df62fe4360757333215ce3c8223c68c4e) ) ROM_END +ROM_START( polyplay2 ) + ROM_REGION( 0x10000, Z80CPU_TAG, 0 ) + ROM_LOAD( "2_1.bin", 0x0000, 0x2000, CRC(bf22f44f) SHA1(dd412b45f49ceffe336d905043c7af2447c577a0) ) + + ROM_LOAD( "2_2.bin", 0x2000, 0x2000, CRC(e54b8be8) SHA1(23037102eab60fd03c349ad154b2498139e84dd4) ) + ROM_LOAD( "2_3.bin", 0x4000, 0x2000, CRC(ac43ec6b) SHA1(1662e10d80d47c1e3c54d4ef232c0d671fecce96) ) + ROM_LOAD( "2_4.bin", 0x6000, 0x2000, CRC(703f3d46) SHA1(5ab571cb63ffdbce86b6e452988402e5c1098009) ) + ROM_LOAD( "2_5.bin", 0x8000, 0x2000, CRC(d5ef6ed8) SHA1(317f251dc85b412b1390651d39a95ce57dd92999) ) -TIMER_DEVICE_CALLBACK_MEMBER(polyplay_state::polyplay_timer_callback) -{ - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0x4c); -} + ROM_REGION( 0x800, "gfx1", 0 ) + ROM_LOAD( "1_1.bin", 0x0000, 0x0800, CRC(4f028af9) SHA1(319537234069b43cfffafe567cc599ae05f24e23) ) +ROM_END /* game driver */ -GAME( 1986, polyplay, 0, polyplay, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play", 0 ) +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 - Czech)", 0 ) diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h index 983f98c8098..93852b1c409 100644 --- a/src/mame/includes/polyplay.h +++ b/src/mame/includes/polyplay.h @@ -1,8 +1,18 @@ // license:BSD-3-Clause // copyright-holders:Martin Buchholz -#include "sound/samples.h" +// thanks-to:James Wallace, Martin Buchholz, Juergen Oppermann, Volker Hann, Jan-Ole Christian -#define SAMPLE_LENGTH 32 +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80sio.h" +#include "sound/speaker.h" + +#define POLYPLAY_MAIN_CLOCK XTAL_9_8304MHz + +#define Z80CPU_TAG "maincpu" +#define Z80CTC_TAG "z80ctc" +#define Z80PIO_TAG "z80pio" +#define Z80SIO_TAG "z80sio" class polyplay_state : public driver_device { @@ -11,47 +21,48 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_characterram(*this, "characterram"), - m_maincpu(*this, "maincpu"), - m_samples(*this, "samples"), + m_maincpu(*this, Z80CPU_TAG), + m_z80ctc(*this, Z80CTC_TAG), + m_z80pio(*this, Z80PIO_TAG), + m_z80sio(*this, Z80SIO_TAG), + m_in0_port(*this, "IN0"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_speaker1(*this, "speaker1"), + m_speaker2(*this, "speaker2") { } required_shared_ptr m_videoram; required_shared_ptr m_characterram; required_device m_maincpu; - required_device m_samples; + required_device m_z80ctc; + required_device m_z80pio; + optional_device m_z80sio; + required_ioport m_in0_port; required_device m_gfxdecode; required_device m_palette; - int m_freq1; - int m_freq2; - int m_channel_playing1; - int m_channel_playing2; - int16_t m_backgroundwave[SAMPLE_LENGTH]; - int m_prescale1; - int m_prescale2; - int m_channel1_active; - int m_channel1_const; - int m_channel2_active; - int m_channel2_const; - timer_device* m_timer; - int m_last; + /* devices */ + DECLARE_WRITE_LINE_MEMBER(ctc_zc0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_zc1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_zc2_w); - DECLARE_WRITE8_MEMBER(polyplay_sound_channel); - DECLARE_WRITE8_MEMBER(polyplay_start_timer2); - DECLARE_READ8_MEMBER(polyplay_random_read); - DECLARE_WRITE8_MEMBER(polyplay_characterram_w); - SAMPLES_START_CB_MEMBER(sh_start); - void set_channel1(int active); - void set_channel2(int active); - void play_channel1(int data); - void play_channel2(int data); - virtual void machine_reset() override; + DECLARE_READ8_MEMBER(pio_porta_r); + DECLARE_WRITE8_MEMBER(pio_porta_w); + DECLARE_READ8_MEMBER(pio_portb_r); + DECLARE_WRITE8_MEMBER(pio_portb_w); + + DECLARE_INPUT_CHANGED_MEMBER(input_changed); + + /* audio */ + uint8_t m_flipflop1; + uint8_t m_flipflop2; + required_device m_speaker1; + required_device m_speaker2; + + /* video */ virtual void video_start() override; + DECLARE_WRITE8_MEMBER(polyplay_characterram_w); DECLARE_PALETTE_INIT(polyplay); uint32_t screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(periodic_interrupt); - INTERRUPT_GEN_MEMBER(coin_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback); }; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 75b9b80f0a6..3476eda8325 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -31000,6 +31000,7 @@ poly880 // @source:polyplay.cpp polyplay // +polyplay2 // @source:pong.cpp breakout // (c) 1976 Atari diff --git a/src/mame/video/polyplay.cpp b/src/mame/video/polyplay.cpp index e27081b433f..e34e3acd98c 100644 --- a/src/mame/video/polyplay.cpp +++ b/src/mame/video/polyplay.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Martin Buchholz +// thanks-to:James Wallace, Martin Buchholz, Juergen Oppermann, Volker Hann, Jan-Ole Christian /*************************************************************************** Poly-Play @@ -14,12 +15,10 @@ #include "emu.h" #include "includes/polyplay.h" - PALETTE_INIT_MEMBER(polyplay_state, polyplay) { palette.set_pen_color(0,rgb_t(0x00,0x00,0x00)); palette.set_pen_color(1,rgb_t(0xff,0xff,0xff)); - palette.set_pen_color(2,rgb_t(0x00,0x00,0x00)); palette.set_pen_color(3,rgb_t(0xff,0x00,0x00)); palette.set_pen_color(4,rgb_t(0x00,0xff,0x00)); @@ -30,13 +29,11 @@ PALETTE_INIT_MEMBER(polyplay_state, polyplay) palette.set_pen_color(9,rgb_t(0xff,0xff,0xff)); } - WRITE8_MEMBER(polyplay_state::polyplay_characterram_w) { if (m_characterram[offset] != data) { m_gfxdecode->gfx(1)->mark_dirty((offset >> 3) & 0x7f); - m_characterram[offset] = data; } } @@ -46,21 +43,18 @@ void polyplay_state::video_start() m_gfxdecode->gfx(1)->set_source(m_characterram); } - uint32_t polyplay_state::screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint8_t *videoram = m_videoram; offs_t offs; - for (offs = 0; offs < 0x800; offs++) { int sx = (offs & 0x3f) << 3; int sy = offs >> 6 << 3; uint8_t code = videoram[offs]; - m_gfxdecode->gfx((code >> 7) & 0x01)->opaque(bitmap,cliprect, - code, 0, 0, 0, sx, sy); + m_gfxdecode->gfx((code >> 7) & 0x01)->opaque(bitmap, cliprect, code, 0, 0, 0, sx, sy); } return 0; From f6ae24241acbaab0044d29ded1081d87bb75ad58 Mon Sep 17 00:00:00 2001 From: Ariane Fugmann Date: Thu, 12 Jan 2017 20:32:29 +0100 Subject: [PATCH 2/2] polyplay: less talking, more documentation (nw) --- src/mame/drivers/polyplay.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 1586afe5429..90d5c11b305 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -16,6 +16,14 @@ one of the last existing Poly-Play arcade automatons. He also provided me with schematics and service manuals. + +TODO: + - check PIO PortB wiring in real machines + - write some own code for the ZRE-PP to find the SIO in address space and then do something cool with it :) + - get other rom versions and games + - document the light-organ related stuff + + NOTES: The hardware is based on the K1520 PC system, with video output coming through a standard Colormat TV. @@ -156,13 +164,13 @@ READ8_MEMBER(polyplay_state::pio_porta_r) WRITE8_MEMBER(polyplay_state::pio_porta_w) { - osd_printf_verbose("pio_porta_w: %02x\n", data); + //osd_printf_verbose("pio_porta_w: %02x\n", data); } READ8_MEMBER(polyplay_state::pio_portb_r) { uint8_t result = 0x00; - osd_printf_verbose("pio_portb_r: %02x\n", result); + //osd_printf_verbose("pio_portb_r: %02x\n", result); return result; }