From c7b89485ea5ec9ad1d0c81f31eac188d7d06215a Mon Sep 17 00:00:00 2001 From: 987123879113 <63495610+987123879113@users.noreply.github.com> Date: Fri, 21 May 2021 08:15:02 +0900 Subject: [PATCH] ksys573: Add incomplete support for Dance Dance Revolution Karaoke Mix (#8047) --- scripts/target/mame/arcade.lua | 2 + src/mame/drivers/ksys573.cpp | 67 ++++++++++++- src/mame/machine/k573kara.cpp | 166 +++++++++++++++++++++++++++++++++ src/mame/machine/k573kara.h | 50 ++++++++++ src/mame/mame.lst | 1 + 5 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 src/mame/machine/k573kara.cpp create mode 100644 src/mame/machine/k573kara.h diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 5f98ab40e80..ff079beb04e 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -2554,6 +2554,8 @@ files { MAME_DIR .. "src/mame/machine/k573dio.h", MAME_DIR .. "src/mame/machine/k573fpga.cpp", MAME_DIR .. "src/mame/machine/k573fpga.h", + MAME_DIR .. "src/mame/machine/k573kara.cpp", + MAME_DIR .. "src/mame/machine/k573kara.h", MAME_DIR .. "src/mame/machine/k573mcr.cpp", MAME_DIR .. "src/mame/machine/k573mcr.h", MAME_DIR .. "src/mame/machine/k573msu.cpp", diff --git a/src/mame/drivers/ksys573.cpp b/src/mame/drivers/ksys573.cpp index 1cb21fe004b..c299fb54c8e 100644 --- a/src/mame/drivers/ksys573.cpp +++ b/src/mame/drivers/ksys573.cpp @@ -48,7 +48,7 @@ P Anime Champ 2000.12 GCA07 JA (no CD) P Bass Angler 1998.03 GE765 JA 765 JA A02 P Bass Angler 2 1998.07 GC865 JA 865 JA A02 -P *DAM-DDR Dance Dance Revolution for DAM 1999.11 +P DAM-DDR Dance Dance Revolution for DAM 1999.11 GQ921 JB 921 JB B02 P *DAM-DDR Dance Dance Revolution for DAM 2nd 2000.07 A Dance Dance Revolution 1998.09 GC845 JA 845 JA(missing)/UA A01 / 845 JA A02 A Dance Dance Revolution Internet Ranking ver. 1998.11 GC845 JB 845 JB A01 / 845 JA/UA A02 @@ -359,6 +359,7 @@ G: gun mania only, drives air soft gun (this game uses real BB bullet) #include "machine/k573mcr.h" #include "machine/k573msu.h" #include "machine/k573npu.h" +#include "machine/k573kara.h" #include "machine/mb89371.h" #include "machine/ram.h" #include "machine/timekpr.h" @@ -509,6 +510,7 @@ public: void gtfrk11m(machine_config &config); void gtfrk10mb(machine_config &config); void ddr(machine_config &config); + void ddrk(machine_config &config); void pnchmn(machine_config &config); void gtrfrk7m(machine_config &config); void ddr3m(machine_config &config); @@ -551,6 +553,7 @@ public: void dmx(machine_config &config); void drmn(machine_config &config); void k573d(machine_config &config); + void k573k(machine_config &config); void k573a(machine_config &config); void pccard1_16mb(machine_config &config); void pccard1_32mb(machine_config &config); @@ -666,6 +669,7 @@ private: void konami573_map(address_map &map); void konami573a_map(address_map &map); void konami573d_map(address_map &map); + void konami573k_map(address_map &map); required_ioport m_analog0; required_ioport m_analog1; @@ -789,6 +793,12 @@ void ksys573_state::konami573d_map(address_map &map) map(0x1f640000, 0x1f6400ff).m("k573dio", FUNC(k573dio_device::amap)); } +void ksys573_state::konami573k_map(address_map &map) +{ + konami573_map(map); + map(0x1f640000, 0x1f6400ff).m("k573kara", FUNC(k573kara_device::amap)); +} + void ksys573_state::konami573a_map(address_map &map) { konami573_map(map); @@ -2429,6 +2439,14 @@ void ksys573_state::k573d(machine_config &config) KONAMI_573_DIGITAL_IO_BOARD(config, "k573dio", XTAL(19'660'800)); } +// Variants with additional karaoke I/O board +void ksys573_state::k573k(machine_config &config) +{ + konami573(config); + m_maincpu->set_addrmap(AS_PROGRAM, &ksys573_state::konami573k_map); + KONAMI_573_KARAOKE_IO_BOARD(config, "k573kara", XTAL(36'864'000)); +} + // Variants with additional analogue i/o board void ksys573_state::k573a(machine_config &config) { @@ -2523,6 +2541,12 @@ void ksys573_state::ddr(machine_config &config) cassx(config); } +void ksys573_state::ddrk(machine_config &config) +{ + k573k(config); + cassxi(config); +} + void ksys573_state::ddr2mc2(machine_config &config) { k573a(config); @@ -3094,6 +3118,33 @@ static INPUT_PORTS_START( ddrsolo ) PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNUSED ) /* P2 BUTTON6 */ INPUT_PORTS_END +static INPUT_PORTS_START( ddrkara ) + PORT_INCLUDE( konami573 ) + + PORT_MODIFY("IN1") + PORT_BIT(0x10000000, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("Service/Select") + + PORT_MODIFY("IN2") + PORT_BIT(0xffff6000, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x00000f0f, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(ksys573_state, gn845pwbb_read) + PORT_BIT(0x00000010, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_16WAY PORT_PLAYER(1) PORT_NAME("P1 Down 2") + PORT_BIT(0x00000020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_16WAY PORT_PLAYER(1) PORT_NAME("P1 Left 2") + PORT_BIT(0x00000040, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Telop") + PORT_BIT(0x00000080, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Mode") + PORT_BIT(0x00001000, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Level") + PORT_BIT(0x00008000, IP_ACTIVE_LOW, IPT_START1) PORT_NAME("Start") + + PORT_MODIFY("IN3") + PORT_BIT(0xfffffbff, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_SERVICE_NO_TOGGLE(0x00000400, IP_ACTIVE_LOW) PORT_NAME("Test") + + PORT_START("STAGE") + PORT_BIT(0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_16WAY PORT_PLAYER(1) + PORT_BIT(0x00000200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_16WAY PORT_PLAYER(1) /* multiplexor */ + PORT_BIT(0x00000400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_16WAY PORT_PLAYER(1) /* multiplexor */ + PORT_BIT(0x00000800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_16WAY PORT_PLAYER(1) +INPUT_PORTS_END + static INPUT_PORTS_START( gtrfrks ) PORT_INCLUDE( konami573 ) @@ -3647,6 +3698,19 @@ ROM_START( ddra ) DISK_IMAGE_READONLY( "845aaa02", 0, SHA1(9b786de9b1085009c088de0d40425976c1f8df7b) ) ROM_END +ROM_START( ddrkara ) + SYS573_BIOS_A + + ROM_REGION( 0x0000224, "cassette:game:eeprom", 0 ) + ROM_LOAD( "gq921jbb.u1", 0x000000, 0x000224, BAD_DUMP CRC(4c91aecf) SHA1(4b8318523d6691b2124afceafba78e6bac8ba75f) ) + + ROM_REGION( 0x000008, "cassette:game:id", 0 ) + ROM_LOAD( "gq921jbb.u6", 0x000000, 0x000008, BAD_DUMP CRC(af09e43c) SHA1(d8372f2d6e0ae07061b496a2242a63e5bc2e54dc) ) + + DISK_REGION( "cdrom0" ) + DISK_IMAGE_READONLY( "921jbb02", 0, SHA1(32849007fe5527245a6cc2de38e73d60ae74eff0) ) +ROM_END + ROM_START( ddr2m ) SYS573_BIOS_A @@ -5766,6 +5830,7 @@ GAME( 1998, ddrj, dstage, ddr, ddr, ksys573_state, init_ddr, GAME( 1998, ddrja, dstage, ddr, ddr, ksys573_state, init_ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAA)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) GAME( 1998, ddrjb, dstage, ddr, ddr, ksys573_state, init_ddr, ROT0, "Konami", "Dance Dance Revolution (GC845 VER. JAB)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) GAME( 1999, ddra, dstage, ddr, ddr, ksys573_state, init_ddr, ROT0, "Konami", "Dance Dance Revolution (GN845 VER. AAA)", MACHINE_IMPERFECT_SOUND ) +GAME( 1999, ddrkara, dstage, ddrk, ddrkara, ksys573_state, init_ddr, ROT0, "Konami", "Dance Dance Revolution Karaoke Mix", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) GAME( 1998, fbait2bc, sys573, fbaitbc, fbaitbc, ksys573_state, empty_init, ROT0, "Konami", "Fisherman's Bait 2 - A Bass Challenge (GE865 VER. UAB)", MACHINE_IMPERFECT_SOUND ) GAME( 1998, bassang2, fbait2bc, fbaitbc, fbaitbc, ksys573_state, empty_init, ROT0, "Konami", "Bass Angler 2 (GE865 VER. JAA)", MACHINE_IMPERFECT_SOUND ) GAME( 1998, hyperbbc, sys573, hyperbbc, hyperbbc, ksys573_state, init_hyperbbc, ROT0, "Konami", "Hyper Bishi Bashi Champ (GQ876 VER. EAA)", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/machine/k573kara.cpp b/src/mame/machine/k573kara.cpp new file mode 100644 index 00000000000..b2663f196f3 --- /dev/null +++ b/src/mame/machine/k573kara.cpp @@ -0,0 +1,166 @@ +// license:BSD-3-Clause +// copyright-holders:windyfairy +#include "emu.h" +#include "k573kara.h" + +#include "bus/rs232/rs232.h" + +/* + Karaoke PCB + --------------- + + GX921-PWB(B)(?) (C)1999 KONAMI CO. LTD. + + External plate: + An external plate connects the outside of the machine to the System 573. + From left to right, top to bottom: + - 4 pin mini-DIN port labeled "Expansion" + - 5 pin mini-DIN port labeled "Helper PC" + - 8 pin mini-DIN port labeled "Coin Box" + - DB9 male connector labeled "RS232C" + - DB15 female connector labeled "Control Panel" + + - RCA connector labeled "Video in", internal wiring labeled "1" + - RCA connector labeled "Video out", internal wiring labeled "2" + - RCA connector labeled "Montior 1 out", internal wiring labeled "3" + - RCA connector labeled "Monitor 2 out", internal wiring labeled "4" + - RJ45 jack labeled "Network 1" + - RJ45 jack labeled "Network 2" + - 4 pin dipswitch labeled "DIP" + + About dipswitch: there is a graphic below the dipswitch with the following explanation: + "Dipswitch 3 controls network 1. Lower it when port is not in use." + "Dipswitch 4 controls network 2. Lower it when port is not in use." + + + Internal I/O board notes: + - 36.864 MHz clock + - 2x RJ45(?) ports labeled "MODULAR-BP" + - 4x composite video plugs labeled "1" (Video in), "2" (Video out), "3" (Monitor 1 out), and "4" (Monitor 2 out) + - CXA1645M RGB Encoder + - PC1652D + - LT1381CS RS232 chip + - LS245 + - 2x LVT245S + - Xilinx XC9572 + - Xilinx XC9536 + - CN? Combined RGB + subcarrier signal from main Sys573 board + - CN3 Helper Computer + - CN11 Coin Box + - CN6 Expansion + Lamps(?) + - CN7 Lamps(?) +*/ + +DEFINE_DEVICE_TYPE(KONAMI_573_KARAOKE_IO_BOARD, k573kara_device, "k573kara", "Konami 573 karaoke I/O board") + +void k573kara_device::amap(address_map &map) +{ + // Known addresses I could find that were used in the game's code + // Not a full list + //map(0x10, 0x11) + map(0x90, 0xaf).rw(m_duart_com, FUNC(pc16552_device::read), FUNC(pc16552_device::write)).umask16(0xff); + map(0xb0, 0xb1).rw(FUNC(k573kara_device::io_r), FUNC(k573kara_device::lamp1_w)); + map(0xc0, 0xc1).w(FUNC(k573kara_device::lamp2_w)); + map(0xd0, 0xd1).w(FUNC(k573kara_device::lamp3_w)); + map(0xe0, 0xe1).rw(FUNC(k573kara_device::digital_id_r), FUNC(k573kara_device::digital_id_w)); + map(0xf0, 0xf1).w(FUNC(k573kara_device::video_selector_w)); + map(0xf8, 0xf9).rw(FUNC(k573kara_device::coin_box_r), FUNC(k573kara_device::coin_box_w)); +} + +k573kara_device::k573kara_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, KONAMI_573_KARAOKE_IO_BOARD, tag, owner, clock), + digital_id(*this, "digital_id"), + m_duart_com(*this, "duart_com"), + m_coin_box_val(0) +{ +} + +void k573kara_device::device_start() +{ +} + +void k573kara_device::device_reset() +{ + m_coin_box_val = 0; +} + +ROM_START( k573kara ) + ROM_REGION( 0x000008, "digital_id", 0 ) + ROM_LOAD( "digital-id.bin", 0x000000, 0x000008, CRC(2b977f4d) SHA1(2b108a56653f91cb3351718c45dfcf979bc35ef1) ) +ROM_END + +const tiny_rom_entry *k573kara_device::device_rom_region() const +{ + return ROM_NAME(k573kara); +} + +void k573kara_device::device_add_mconfig(machine_config &config) +{ + DS2401(config, digital_id); + + // The PC Helper RS232 and the PC16552D are right next to each other but they may possibly be separate. + PC16552D(config, m_duart_com, 0); + auto& duart_chan0(NS16550(config, "duart_com:chan0", clock() / 2)); + auto& rs232_chan0(RS232_PORT(config, "rs232_chan0", default_rs232_devices, nullptr)); + rs232_chan0.rxd_handler().set("duart_com:chan0", FUNC(ins8250_uart_device::rx_w)); + rs232_chan0.dcd_handler().set("duart_com:chan0", FUNC(ins8250_uart_device::dcd_w)); + rs232_chan0.dsr_handler().set("duart_com:chan0", FUNC(ins8250_uart_device::dsr_w)); + rs232_chan0.ri_handler().set("duart_com:chan0", FUNC(ins8250_uart_device::ri_w)); + rs232_chan0.cts_handler().set("duart_com:chan0", FUNC(ins8250_uart_device::cts_w)); + duart_chan0.out_tx_callback().set("rs232_chan0", FUNC(rs232_port_device::write_txd)); + duart_chan0.out_dtr_callback().set("rs232_chan0", FUNC(rs232_port_device::write_dtr)); + duart_chan0.out_rts_callback().set("rs232_chan0", FUNC(rs232_port_device::write_rts)); +} + +void k573kara_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ +} + +uint16_t k573kara_device::io_r() +{ + // Stage platforms can be connected through the RJ45 ports and the data returned through here. + // 0x200 must be set for this I/O port to be used. + return 0; +} + +void k573kara_device::lamp1_w(uint16_t data) +{ +} + +void k573kara_device::lamp2_w(uint16_t data) +{ +} + +void k573kara_device::lamp3_w(uint16_t data) +{ +} + +uint16_t k573kara_device::coin_box_r() +{ + // Unsure how the coin box works exactly. It seems to be a toggle instead of a normal coin insert. + // If you release the coin box button it thinks there is no money inserted and will kick you back to the title screen. + // The coin box can be disabled in the user settings menu. + return m_coin_box_val; +} + +void k573kara_device::coin_box_w(uint16_t data) +{ + // Possibly some kind of other I/O unrelated to the coin box + m_coin_box_val = data; +} + +void k573kara_device::video_selector_w(uint16_t data) +{ + // This value gets changed when testing during the video selector menu. + // The IO board seems to have 4 composite video ports so my guess is that it switches connectors. +} + +uint16_t k573kara_device::digital_id_r() +{ + return digital_id->read(); +} + +void k573kara_device::digital_id_w(uint16_t data) +{ + digital_id->write( data & 1 ); +} diff --git a/src/mame/machine/k573kara.h b/src/mame/machine/k573kara.h new file mode 100644 index 00000000000..57e53e16223 --- /dev/null +++ b/src/mame/machine/k573kara.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:windyfairy +#ifndef MAME_MACHINE_K573KARA_H +#define MAME_MACHINE_K573KARA_H + +#pragma once + +#include "machine/ds2401.h" +#include "machine/ins8250.h" + +class k573kara_device : public device_t +{ +public: + k573kara_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + void amap(address_map &map); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + uint16_t uart_r(offs_t offset); + void uart_w(offs_t offset, uint16_t data); + + uint16_t io_r(); + void lamp1_w(uint16_t data); + void lamp2_w(uint16_t data); + void lamp3_w(uint16_t data); + + uint16_t coin_box_r(); + void coin_box_w(uint16_t data); + + void video_selector_w(uint16_t data); + + uint16_t digital_id_r(); + void digital_id_w(uint16_t data); + + required_device digital_id; + required_device m_duart_com; + + uint16_t m_coin_box_val; +}; + +DECLARE_DEVICE_TYPE(KONAMI_573_KARAOKE_IO_BOARD, k573kara_device) + +#endif // MAME_MACHINE_K573KARA_H diff --git a/src/mame/mame.lst b/src/mame/mame.lst index e72c88f356d..0ac2cd3df83 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -19374,6 +19374,7 @@ bassangl // 1998 - Bass Angler (GE765 VER. JAA) cr589fw // 1999 - CR-589 Firmware (700B04) cr589fwa // 1999 - CR-589 Firmware (700A04) darkhleg // 1998 - Dark Horse Legend (GX706 VER. JAA) +ddrkara // 1999 - Dance Dance Revolution Karaoke Mix (GQ921 VER. JBB) ddr2m // 1999 - Dance Dance Revolution 2nd Mix (GN895 VER. JAA) ddr2mc // 1999 - Dance Dance Revolution 2nd Mix with beatmaniaIIDX CLUB VERSiON (GE896 VER. JAA) ddr2mc2 // 1999 - Dance Dance Revolution 2nd Mix with beatmaniaIIDX substream CLUB VERSiON 2 (GE984 VER. JAA)