diff --git a/src/mame/drivers/cedar_magnet.cpp b/src/mame/drivers/cedar_magnet.cpp index 225569312f4..049a6bc958a 100644 --- a/src/mame/drivers/cedar_magnet.cpp +++ b/src/mame/drivers/cedar_magnet.cpp @@ -791,6 +791,6 @@ DRIVER_INIT_MEMBER(cedar_magnet_state, mag_exzi) GAME( 1987, cedmag, 0, cedar_magnet, cedar_magnet, driver_device, 0, ROT0, "EFO SA / Cedar", "Magnet System (prototype)", MACHINE_IS_BIOS_ROOT ) -GAME( 1987, mag_time, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_time, ROT90, "EFO SA / Cedar", "Time Scanner (TS 2.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND ) // original game was by Sega -GAME( 1987, mag_exzi, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_exzi, ROT0, "EFO SA / Cedar", "Exzisus (EX 1.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND ) // original game was by Taito -GAME( 1987, mag_xain, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_xain, ROT0, "EFO SA / Cedar", "Xain'd Sleena (SC 3.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND ) // original game was by Technos +GAME( 1987, mag_time, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_time, ROT90, "EFO SA / Cedar", "Time Scanner (TS 2.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // original game was by Sega +GAME( 1987, mag_exzi, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_exzi, ROT0, "EFO SA / Cedar", "Exzisus (EX 1.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // original game was by Taito +GAME( 1987, mag_xain, cedmag, cedar_magnet, cedar_magnet, cedar_magnet_state, mag_xain, ROT0, "EFO SA / Cedar", "Xain'd Sleena (SC 3.0, Magnet System, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // original game was by Technos diff --git a/src/mame/drivers/cedar_magnet_board.h b/src/mame/drivers/cedar_magnet_board.h index f66121ecb99..1ffbcef1c05 100644 --- a/src/mame/drivers/cedar_magnet_board.h +++ b/src/mame/drivers/cedar_magnet_board.h @@ -22,15 +22,16 @@ public: uint8_t* m_ram; z80_device* m_cpu; - + virtual uint8_t read_cpu_bus(int offset); virtual void write_cpu_bus(int offset, uint8_t data); TIMER_CALLBACK_MEMBER(halt_assert_callback); TIMER_CALLBACK_MEMBER(halt_clear_callback); - TIMER_CALLBACK_MEMBER(reset_assert_callback); + virtual TIMER_CALLBACK_MEMBER(reset_assert_callback); TIMER_CALLBACK_MEMBER(reset_clear_callback); + void halt_assert(void); void halt_clear(void); void reset_assert(void); @@ -39,7 +40,6 @@ public: bool m_is_running; INTERRUPT_GEN_MEMBER(irq); - protected: virtual void device_start() override; virtual void device_reset() override; diff --git a/src/mame/drivers/cedar_magnet_sound.cpp b/src/mame/drivers/cedar_magnet_sound.cpp index 1133962a042..bc17672db81 100644 --- a/src/mame/drivers/cedar_magnet_sound.cpp +++ b/src/mame/drivers/cedar_magnet_sound.cpp @@ -2,7 +2,21 @@ // copyright-holders:David Haywood /* - THIS IMPLEMENTATION IS ENTIRELY INCORRECT AND SHOULD NOT BE TRUSTED! + how should the ctcs hook up properly? + + irq vectors + + 0xe6 - from ctc0? (would need vector of e0?) probably used to drive MSM5205 + 0xee - from ctc0? (would need vector of e8?) ^^ + 0xf6 - drive AY (once per frame?) triggered by ctc1 channel 3? (sets vector to f0, f6 = channel3?) + 0xff - read sound latch (triggered by write from master board) + + any attempts made to hook up the ctcs end up resulting in it taking an interrupt + with vector 0xf0, which points to 0x0000 and resets the cpu?! + + does the device here also need to add daisychain functions in order for the 0xff vector to be used + with the soundlatch writes? + */ #include "emu.h" @@ -20,20 +34,20 @@ cedar_magnet_sound_device::cedar_magnet_sound_device(const machine_config &mconf } -READ8_MEMBER(cedar_magnet_sound_device::top_port14_r) +READ8_MEMBER(cedar_magnet_sound_device::soundlatch_r) { -// uint8_t ret = m_command; -// m_command = 0; - return rand(); + return m_command; } void cedar_magnet_sound_device::write_command(uint8_t data) { m_command = data; - m_cpu->set_input_line(0, HOLD_LINE); + // this interrupt causes it to read the soundlatch at 0x14 + m_cpu->set_input_line_and_vector(0, HOLD_LINE,0xff); } + static ADDRESS_MAP_START( cedar_magnet_sound_map, AS_PROGRAM, 8, cedar_magnet_sound_device ) AM_RANGE(0x0000, 0xffff) AM_RAM AM_SHARE("ram") ADDRESS_MAP_END @@ -44,25 +58,38 @@ static ADDRESS_MAP_START( cedar_magnet_sound_io, AS_IO, 8, cedar_magnet_sound_de AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ctc0", z80ctc_device, read, write) AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ctc1", z80ctc_device, read, write) + AM_RANGE(0x08, 0x08) AM_WRITE(adpcm_latch_w) + AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd0", ay8910_device, address_w) AM_RANGE(0x0d, 0x0d) AM_DEVWRITE("aysnd0", ay8910_device, data_w) - + AM_RANGE(0x10, 0x10) AM_DEVWRITE("aysnd1", ay8910_device, address_w) AM_RANGE(0x11, 0x11) AM_DEVWRITE("aysnd1", ay8910_device, data_w) - - AM_RANGE(0x14, 0x14) AM_READ(top_port14_r) + + AM_RANGE(0x14, 0x14) AM_READ(soundlatch_r) ADDRESS_MAP_END +WRITE8_MEMBER(cedar_magnet_sound_device::adpcm_latch_w) +{ + // it writes 8-bits of sample data here, to be fed to the msm 4-bits at a time + // probably via other triggers + m_adpcm_data = data; +} + +WRITE8_MEMBER(cedar_magnet_sound_device::ay1_porta_w) +{ + // unknown but used +} WRITE_LINE_MEMBER(cedar_magnet_sound_device::ctc0_z0_w) { -// printf("USED ctc0_z0_w %d\n", state); +// printf("USED ctc0_z0_w %d\n", state); } WRITE_LINE_MEMBER(cedar_magnet_sound_device::ctc0_z1_w) { -// printf("USED ctc0_z1_w %d\n", state); +// printf("USED ctc0_z1_w %d\n", state); } @@ -95,17 +122,7 @@ WRITE_LINE_MEMBER(cedar_magnet_sound_device::ctc0_int_w) WRITE_LINE_MEMBER(cedar_magnet_sound_device::ctc1_int_w) { -/* - switch (rand()&0x1) - { - case 0x00: - m_ctc0->trg0(rand()&1); - break; - case 0x01: - m_ctc0->trg1(rand()&1); - break; - } -*/ + } #if 0 @@ -113,25 +130,50 @@ static const z80_daisy_config daisy_chain[] = { { "ctc1" }, { "ctc0" }, +// soundlatch from main CPU needs to be able to generate a vector too? { nullptr } }; #endif +TIMER_CALLBACK_MEMBER(cedar_magnet_sound_device::reset_assert_callback) +{ + cedar_magnet_board_device::reset_assert_callback(ptr,param); + // reset lines go to the ctc as well? + m_ctc0->reset(); + m_ctc1->reset(); +} + + + +INTERRUPT_GEN_MEMBER(cedar_magnet_sound_device::fake_irq) +{ + // these should be coming from the CTC... +// if (m_fake_counter==0) m_cpu->set_input_line_and_vector(0, HOLD_LINE,0xe6); +// if (m_fake_counter==1) m_cpu->set_input_line_and_vector(0, HOLD_LINE,0xee); + if (m_fake_counter==2) m_cpu->set_input_line_and_vector(0, HOLD_LINE,0xf6); // drives the AY, should be from ctc1 4th counter? + + m_fake_counter++; + + if (m_fake_counter == 4) m_fake_counter = 0; +} + static MACHINE_CONFIG_FRAGMENT( cedar_magnet_sound ) MCFG_CPU_ADD("topcpu", Z80,4000000) MCFG_CPU_PROGRAM_MAP(cedar_magnet_sound_map) MCFG_CPU_IO_MAP(cedar_magnet_sound_io) -// MCFG_Z80_DAISY_CHAIN(daisy_chain) +// MCFG_Z80_DAISY_CHAIN(daisy_chain) + MCFG_CPU_PERIODIC_INT_DRIVER(cedar_magnet_sound_device, fake_irq, 4*60) MCFG_DEVICE_ADD("ctc0", Z80CTC, 4000000/8 ) +// MCFG_Z80CTC_INTR_CB(INPUTLINE("topcpu", INPUT_LINE_IRQ0)) MCFG_Z80CTC_INTR_CB(WRITELINE(cedar_magnet_sound_device, ctc0_int_w)) MCFG_Z80CTC_ZC0_CB(WRITELINE(cedar_magnet_sound_device, ctc0_z0_w)) MCFG_Z80CTC_ZC1_CB(WRITELINE(cedar_magnet_sound_device, ctc0_z1_w)) MCFG_Z80CTC_ZC2_CB(WRITELINE(cedar_magnet_sound_device, ctc0_z2_w)) MCFG_DEVICE_ADD("ctc1", Z80CTC, 4000000/8 ) - MCFG_Z80CTC_INTR_CB(INPUTLINE("topcpu", INPUT_LINE_IRQ0)) -// MCFG_Z80CTC_INTR_CB(DEVWRITELINE("ctc0", z80ctc_device, trg0)) +// MCFG_Z80CTC_INTR_CB(INPUTLINE("topcpu", INPUT_LINE_IRQ0)) +// MCFG_Z80CTC_INTR_CB(DEVWRITELINE("ctc0", z80ctc_device, trg0)) MCFG_Z80CTC_INTR_CB(WRITELINE(cedar_magnet_sound_device, ctc1_int_w)) MCFG_Z80CTC_ZC0_CB(WRITELINE(cedar_magnet_sound_device, ctc1_z0_w)) MCFG_Z80CTC_ZC1_CB(WRITELINE(cedar_magnet_sound_device, ctc1_z1_w)) @@ -143,6 +185,7 @@ static MACHINE_CONFIG_FRAGMENT( cedar_magnet_sound ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MCFG_SOUND_ADD("aysnd1", AY8910, 4000000/2) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(cedar_magnet_sound_device, ay1_porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MCFG_SOUND_ADD("adpcm", MSM5205, 4000000/16) @@ -164,5 +207,6 @@ void cedar_magnet_sound_device::device_start() void cedar_magnet_sound_device::device_reset() { m_command = 0; + m_fake_counter = 0; cedar_magnet_board_device::device_reset(); } diff --git a/src/mame/drivers/cedar_magnet_sound.h b/src/mame/drivers/cedar_magnet_sound.h index 2b6f93180eb..34bac840f55 100644 --- a/src/mame/drivers/cedar_magnet_sound.h +++ b/src/mame/drivers/cedar_magnet_sound.h @@ -24,15 +24,19 @@ class cedar_magnet_sound_device : public cedar_magnet_board_device public: // construction/destruction cedar_magnet_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - + required_device m_ctc0; required_device m_ctc1; - DECLARE_READ8_MEMBER(top_port14_r); + DECLARE_READ8_MEMBER(soundlatch_r); + DECLARE_WRITE8_MEMBER(adpcm_latch_w); + DECLARE_WRITE8_MEMBER(ay1_porta_w); + + uint8_t m_adpcm_data; void write_command(uint8_t data); uint8_t m_command; - + DECLARE_WRITE_LINE_MEMBER(ctc1_z0_w); DECLARE_WRITE_LINE_MEMBER(ctc1_z1_w); DECLARE_WRITE_LINE_MEMBER(ctc1_z2_w); @@ -42,6 +46,11 @@ public: DECLARE_WRITE_LINE_MEMBER(ctc0_int_w); DECLARE_WRITE_LINE_MEMBER(ctc1_int_w); + TIMER_CALLBACK_MEMBER(reset_assert_callback) override; + + int m_fake_counter; + INTERRUPT_GEN_MEMBER(fake_irq); + protected: virtual machine_config_constructor device_mconfig_additions() const override; virtual void device_start() override; diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp index 186754c8fc7..c06d9f3ad17 100644 --- a/src/mame/drivers/segaybd.cpp +++ b/src/mame/drivers/segaybd.cpp @@ -2809,7 +2809,8 @@ GAMEL(1988, pdrift, 0, yboard, pdrift, segaybd_state, pdrift, GAMEL(1988, pdrifta, pdrift, yboard, pdrift, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World)", MACHINE_SUPPORTS_SAVE, layout_pdrift ) GAMEL(1988, pdrifte, pdrift, yboard, pdrifte, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World, Earlier)", MACHINE_SUPPORTS_SAVE, layout_pdrift ) GAMEL(1988, pdriftj, pdrift, yboard, pdriftj, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (Japan)", MACHINE_SUPPORTS_SAVE, layout_pdrift ) -GAMEL(1988, pdriftl, pdrift, yboard_link, pdriftl, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (Japan, Link Version)", MACHINE_SUPPORTS_SAVE, layout_pdrift) + +GAMEL(1988, pdriftl, 0, yboard_link, pdriftl, segaybd_state, pdrift, ROT0, "Sega", "Power Drift - Link Version (Japan, Rev A)", MACHINE_SUPPORTS_SAVE, layout_pdrift) GAME( 1991, rchase, 0, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (World)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, rchasej, rchase, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp index ede385886e4..b33963c7871 100644 --- a/src/mame/drivers/snowbros.cpp +++ b/src/mame/drivers/snowbros.cpp @@ -2948,5 +2948,5 @@ GAME( 1996, multi96, twinadv, twinadv, twinadv, driver_device, 0, ROT0, "Bar // these use an MCU to drive the sound GAME( 2002, snowbro3, 0, snowbro3, snowbroj, snowbros_state, snowbro3, ROT0, "Syrmex", "Snow Brothers 3 - Magical Adventure", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // hacked from SnowBros code but released as an original game GAME( 2003, ballboy, snowbro3, snowbro3, snowbroj, snowbros_state, snowbro3, ROT0, "bootleg", "Ball Boy", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) - -GAME( 1999, yutnori, 0, yutnori, yutnori, snowbros_state, yutnori, ROT0, "Nunal", "Puzzle Yutnori (Korea)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // Nunal is apparently Korean slang for Eyeball, hence the logo. Some places report 'JCC Soft' as the manufacturer +// protection appears to handle the sound, should check if it's just a block of code that is conditionally executed like some of the Semicom titles. +GAME( 1999, yutnori, 0, yutnori, yutnori, snowbros_state, yutnori, ROT0, "Nunal", "Puzzle Yutnori (Korea)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // Nunal is apparently Korean slang for Eyeball, hence the logo. Some places report 'JCC Soft' as the manufacturer