From 4130a7c57d0304ffa85e3032a2f37f97295d9300 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 19 Dec 2024 16:38:09 +0100 Subject: New working systems ------------------- Sphinx Junior [hap, Sean Riddle] --- src/mame/cxg/junior.cpp | 246 ++++++++++++++++++ src/mame/cxg/royal.cpp | 2 +- src/mame/layout/cxg_junior.lay | 480 ++++++++++++++++++++++++++++++++++++ src/mame/layout/novag_cnchess.lay | 56 ++--- src/mame/layout/tascr30.lay | 2 +- src/mame/mame.lst | 3 + src/mame/misc/cvs.cpp | 22 +- src/mame/sunelectronics/route16.cpp | 24 +- 8 files changed, 782 insertions(+), 53 deletions(-) create mode 100644 src/mame/cxg/junior.cpp create mode 100644 src/mame/layout/cxg_junior.lay diff --git a/src/mame/cxg/junior.cpp b/src/mame/cxg/junior.cpp new file mode 100644 index 00000000000..d28706a7ebf --- /dev/null +++ b/src/mame/cxg/junior.cpp @@ -0,0 +1,246 @@ +// license:BSD-3-Clause +// copyright-holders:hap +// thanks-to:Sean Riddle +/******************************************************************************* + +CXG Sphinx Junior + +NOTE: Before exiting MAME, press the OFF button to turn the power off. Otherwise, +NVRAM won't save properly. + +Together with CXG Sphinx Chess Card (and not counting the 1992 rereleases of the +Sphinx Granada family), this is probably the last chess computer with Intelligent +Chess Software's involvement. + +TODO: +- verify sound pitch, it's twice higher on a Fidelity MCC, or maybe that one + was designed for 4MHz? (on CXG Sphinx Chess Card, sound pitch matches MAME) + +Hardware notes: + +Sphinx Junior: +- PCB label: CXG 237 600-002 +- Hitachi HD614140H, 8MHz XTAL +- LCD with 4 7segs and custom segments (same as the one in CXG Pocket Chess) +- embedded non-electronic chessboard, piezo + +Fidelity Micro Chess Challenger (16 buttons): +- PCB label: CXG 249 600-001 +- rest is similar to Sphinx Junior + +Fidelity MCC 12-button version has a HD44820 MCU instead. + +HD614140HA27 MCU is used in: +- CXG Sphinx Junior +- Fidelity Chess Pal Challenger (Fidelity brand Sphinx Junior) +- Fidelity Micro Chess Challenger (16 buttons) + +*******************************************************************************/ + +#include "emu.h" + +#include "cpu/hmcs400/hmcs400.h" +#include "machine/sensorboard.h" +#include "sound/dac.h" +#include "video/pwm.h" + +#include "screen.h" +#include "speaker.h" + +// internal artwork +#include "cxg_junior.lh" + + +namespace { + +class junior_state : public driver_device +{ +public: + junior_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_board(*this, "board"), + m_lcd_pwm(*this, "lcd_pwm"), + m_dac(*this, "dac"), + m_inputs(*this, "IN.0") + { } + + void junior(machine_config &config); + + DECLARE_INPUT_CHANGED_MEMBER(on_button); + +protected: + virtual void machine_start() override ATTR_COLD; + +private: + // devices/pointers + required_device m_maincpu; + required_device m_board; + required_device m_lcd_pwm; + required_device m_dac; + required_ioport m_inputs; + + u32 m_lcd_segs = 0; + u8 m_lcd_com = 0; + + // I/O handlers + void update_lcd(); + template void lcd_segs_w(u8 data); + void control_w(u16 data); + u16 input_r(); +}; + +void junior_state::machine_start() +{ + // register for savestates + save_item(NAME(m_lcd_segs)); + save_item(NAME(m_lcd_com)); +} + + + +/******************************************************************************* + I/O +*******************************************************************************/ + +INPUT_CHANGED_MEMBER(junior_state::on_button) +{ + if (newval && m_maincpu->stop_mode()) + m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); +} + +void junior_state::update_lcd() +{ + m_lcd_pwm->write_row(0, m_lcd_com ? ~m_lcd_segs : m_lcd_segs); +} + +template +void junior_state::lcd_segs_w(u8 data) +{ + // R0x-R4x: LCD segment data, input mux + const u8 shift = N * 4 + 10; + m_lcd_segs = (m_lcd_segs & ~(0xf << shift)) | (data << shift); + update_lcd(); +} + +void junior_state::control_w(u16 data) +{ + // D0: LCD common + m_lcd_com = data & 1; + + // D4-D13: LCD segment data + m_lcd_segs = (m_lcd_segs & ~0x3ff) | (data >> 4 & 0x3ff); + update_lcd(); + + // D14: speaker out + m_dac->write(BIT(data, 14)); +} + +u16 junior_state::input_r() +{ + u16 data = 0; + + // D1: read buttons from R03-R43 + if ((m_lcd_segs >> 13 & 0x1ffff) & m_inputs->read()) + data |= 2; + + // D2: R30 (freq sel) + data |= BIT(m_lcd_segs, 23) << 2; + return data | 9; +} + + + +/******************************************************************************* + Input Ports +*******************************************************************************/ + +static INPUT_PORTS_START( junior ) + PORT_START("IN.0") + PORT_BIT(0x00001, IP_ACTIVE_HIGH, IPT_POWER_OFF) + PORT_BIT(0x00002, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("D / 4 / Rook") + PORT_BIT(0x00004, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("C / 3 / Bishop") + PORT_BIT(0x00008, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("B / 2 / Knight") + PORT_BIT(0x00010, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("A / 1 / Pawn") + PORT_BIT(0x00020, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("H / 8 / Black") + PORT_BIT(0x00040, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("G / 7 / White") + PORT_BIT(0x00080, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("F / 6 / King") + PORT_BIT(0x00100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("E / 5 / Queen") + PORT_BIT(0x00200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Setup Position") + PORT_BIT(0x00400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Verify Position") + PORT_BIT(0x00800, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Entry") + PORT_BIT(0x01000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") + PORT_BIT(0x02000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_O) PORT_NAME("Sound") + PORT_BIT(0x04000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") + PORT_BIT(0x08000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move") + PORT_BIT(0x10000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("Level") + + PORT_START("RESET") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_POWER_ON) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(junior_state::on_button), 0) +INPUT_PORTS_END + + + +/******************************************************************************* + Machine Configs +*******************************************************************************/ + +void junior_state::junior(machine_config &config) +{ + // basic machine hardware + HD614140(config, m_maincpu, 8_MHz_XTAL); + m_maincpu->nvram_enable_backup(true); + m_maincpu->stop_cb().set(m_maincpu, FUNC(hmcs400_cpu_device::nvram_set_battery)); + m_maincpu->stop_cb().append([this](int state) { if (state) m_lcd_pwm->clear(); }); + m_maincpu->write_r<0x0>().set(FUNC(junior_state::lcd_segs_w<0>)); + m_maincpu->write_r<0x1>().set(FUNC(junior_state::lcd_segs_w<1>)); + m_maincpu->write_r<0x2>().set(FUNC(junior_state::lcd_segs_w<2>)); + m_maincpu->write_r<0x3>().set(FUNC(junior_state::lcd_segs_w<3>)); + m_maincpu->write_r<0x4>().set(FUNC(junior_state::lcd_segs_w<4>)); + m_maincpu->write_d().set(FUNC(junior_state::control_w)); + m_maincpu->read_d().set(FUNC(junior_state::input_r)); + + SENSORBOARD(config, m_board).set_type(sensorboard_device::NOSENSORS); + m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess)); + m_board->set_nvram_enable(true); + + // video hardware + PWM_DISPLAY(config, m_lcd_pwm).set_size(1, 30); + m_lcd_pwm->set_bri_levels(0.25); + + config.set_default_layout(layout_cxg_junior); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG)); + screen.set_refresh_hz(60); + screen.set_size(1920/5, 914/5); + screen.set_visarea_full(); + + // sound hardware + SPEAKER(config, "speaker").front_center(); + DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); +} + + + +/******************************************************************************* + ROM Definitions +*******************************************************************************/ + +ROM_START( sjunior ) + ROM_REGION( 0x2000, "maincpu", 0 ) + ROM_LOAD("1988_newcrest_614140ha27", 0x0000, 0x2000, CRC(9eb77d94) SHA1(84306ee39986847f9ae82a1117dc6fb8bd309bab) ) + + ROM_REGION( 57384, "screen", 0 ) + ROM_LOAD("sjunior.svg", 0, 57384, CRC(1b3d450f) SHA1(1b55bb2fe23d2e719258be196663ea117158cd35) ) +ROM_END + +} // anonymous namespace + + + +/******************************************************************************* + Drivers +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1988, sjunior, 0, 0, junior, junior, junior_state, empty_init, "CXG Systems / Newcrest Technology / Intelligent Chess Software", "Sphinx Junior", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/cxg/royal.cpp b/src/mame/cxg/royal.cpp index c806057ab99..d69d900aeb8 100644 --- a/src/mame/cxg/royal.cpp +++ b/src/mame/cxg/royal.cpp @@ -13,7 +13,7 @@ TODO: - if/when MAME supports an exit callback, hook up power-off switch/button to that Hardware notes: -- HD614042S, 4MHz XTAL +- Hitachi HD614042S, 4MHz XTAL - optional LCD panel(s), see below - chessboard buttons, 16+4 LEDs, piezo diff --git a/src/mame/layout/cxg_junior.lay b/src/mame/layout/cxg_junior.lay new file mode 100644 index 00000000000..929812b2e15 --- /dev/null +++ b/src/mame/layout/cxg_junior.lay @@ -0,0 +1,480 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/novag_cnchess.lay b/src/mame/layout/novag_cnchess.lay index 1c12bb7cf2a..125b5e6937f 100644 --- a/src/mame/layout/novag_cnchess.lay +++ b/src/mame/layout/novag_cnchess.lay @@ -150,7 +150,7 @@ authors:hap - + @@ -163,7 +163,7 @@ authors:hap - + @@ -176,7 +176,7 @@ authors:hap - + @@ -189,7 +189,7 @@ authors:hap - + @@ -202,7 +202,7 @@ authors:hap - + @@ -215,7 +215,7 @@ authors:hap - + @@ -228,7 +228,7 @@ authors:hap - + @@ -242,7 +242,7 @@ authors:hap - + @@ -255,7 +255,7 @@ authors:hap - + @@ -268,7 +268,7 @@ authors:hap - + @@ -281,7 +281,7 @@ authors:hap - + @@ -294,7 +294,7 @@ authors:hap - + @@ -307,7 +307,7 @@ authors:hap - + @@ -320,7 +320,7 @@ authors:hap - + @@ -339,7 +339,7 @@ authors:hap - + @@ -352,7 +352,7 @@ authors:hap - + @@ -365,7 +365,7 @@ authors:hap - + @@ -378,7 +378,7 @@ authors:hap - + @@ -391,7 +391,7 @@ authors:hap - + @@ -404,7 +404,7 @@ authors:hap - + @@ -417,7 +417,7 @@ authors:hap - + @@ -431,7 +431,7 @@ authors:hap - + @@ -444,7 +444,7 @@ authors:hap - + @@ -457,7 +457,7 @@ authors:hap - + @@ -470,7 +470,7 @@ authors:hap - + @@ -483,7 +483,7 @@ authors:hap - + @@ -496,7 +496,7 @@ authors:hap - + @@ -509,7 +509,7 @@ authors:hap - + diff --git a/src/mame/layout/tascr30.lay b/src/mame/layout/tascr30.lay index df2f57cce2d..836130472fa 100644 --- a/src/mame/layout/tascr30.lay +++ b/src/mame/layout/tascr30.lay @@ -520,7 +520,7 @@ authors:Sandro Ronco, hap - + diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 65f91eec676..122afdd8ec6 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -16704,6 +16704,9 @@ supra senterp senterpc +@source:cxg/junior.cpp +sjunior + @source:cxg/sphinx40.cpp sphinx40 diff --git a/src/mame/misc/cvs.cpp b/src/mame/misc/cvs.cpp index b598ac3799c..5783a7f8b05 100644 --- a/src/mame/misc/cvs.cpp +++ b/src/mame/misc/cvs.cpp @@ -16,10 +16,8 @@ TODO: This worked fine in an older version of MAME since maincpu was twice slower. - diggerc loses speech sound effects (walking, digging) after killing an enemy. - Emulate protection properly in later games (reads area 0x73fx). -- The board has discrete sound circuits, see sh_trigger_w: 0x1884 enables an - 8038CCJD, 0x1885 connects to it too. 0x1886 produces a high-pitched whistle, - and 0x1887 produces a low thud sound. The current implementation with the - beeper devices is wrong, but better than nothing. +- The board has discrete sound circuits, see sh_trigger_w, current implementation + with the beeper devices is wrong, but better than nothing. - Improve starfield: density, blink rate, x repeat of 240, and the checkerboard pattern (fast forward MAME to see) are all correct, the RNG is not right? @@ -677,12 +675,13 @@ void cvs_state::_4_bit_dac_data_w(offs_t offset, u8 data) void cvs_state::sh_trigger_w(offs_t offset, u8 data) { - // offset 0 is used in darkwar, spacefrt, logger, dazzler, wallst, raiders - // offset 1 is used in logger, wallst - // offset 2 is used in darkwar, spacefrt, 8ball, dazzler, superbik, raiders - // offset 3 is used in cosmos, darkwar, superbik, raiders + /* Discrete sound hardware triggers: + + offset 0 is used in darkwar, spacefrt, logger, dazzler, wallst, raiders + offset 1 is used in logger, wallst + offset 2 is used in darkwar, spacefrt, 8ball, dazzler, superbik, raiders + offset 3 is used in cosmos, darkwar, superbik, raiders - /********** Additional notes from poking the CVS sound hardware with an In Circuit Emulator from PrSwan (Paul Swan). I have recordings available. @@ -695,11 +694,10 @@ void cvs_state::sh_trigger_w(offs_t offset, u8 data) 0x55,0xAA,0xFF - increasing value has higher frequency - 0x1885 - A scope showed this halving the XP8038 amplitude with a little decay. Causes 4016 pin 11 to rise (on) and decay-fall (off) - - 0x1886 - Mikes comment above about a high pitched whistle didn't match my PCBs. His was faulty? - Outputs a complete Galaxia-style ship fire sound, with attack-to-on and decay-to-off. + - 0x1886 - Outputs a complete Galaxia-style ship fire sound, with attack-to-on and decay-to-off. - 0x1887 - Reflected on an LM380. Causes an envelope-like operation on the XP8038 tone with attack (on) and decay (off). - ***********/ + */ data &= 1; diff --git a/src/mame/sunelectronics/route16.cpp b/src/mame/sunelectronics/route16.cpp index bf126aeef57..9f3cc9c9fd5 100644 --- a/src/mame/sunelectronics/route16.cpp +++ b/src/mame/sunelectronics/route16.cpp @@ -4,8 +4,8 @@ Driver by Zsolt Vasvari -Notes ------ +Notes / TODO: +------------- Route 16: - Route 16 doesn't have the SN76477 chip. There is space on the PCB @@ -27,6 +27,14 @@ Stratovox: pots on the PCB. One for music, one for speech and a master volume. Space Echo: +- Speech doesn't work at all, is it an old regression? + +- Interrupts per frame for cpu2 is a best guess based on how stratvox uses the DAC, + writing up to 195 times per frame with each byte from the ROM written 4 times. + spacecho writes one byte per interrupt so 195/4 or 48 is used. a lower number + increases the chance of a sound interrupting itself, which for most sounds + is buggy and causes the game to freeze until the first sound completes. + - When all astronauts are taken the game over tune ends with 5 bad notes, this appears to be a bug in the ROM from a changed instruction at 2EB3. @@ -38,12 +46,6 @@ Space Echo: rather than patching out the test. code for the same test is in stratvox but isn't called, speakres has a very similar test but doesn't care about the result. -- Interrupts per frame for cpu1 is a best guess based on how stratvox uses the DAC, - writing up to 195 times per frame with each byte from the ROM written 4 times. - spacecho writes one byte per interrupt so 195/4 or 48 is used. a lower number - increases the chance of a sound interrupting itself, which for most sounds - is buggy and causes the game to freeze until the first sound completes. - vscompmj: - Stuck notes (constant tone) in-game after the mahjong tiles are laid down. @@ -1681,10 +1683,10 @@ GAME( 1980, speakresb, speakres, speakres, speakres, speakres_state, empty_init, GAME( 1980, stratvox, speakres, stratvox, stratvox, speakres_state, empty_init, ROT270, "Sun Electronics (Taito license)", "Stratovox (set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1980, stratvoxa, speakres, stratvox, stratvox, speakres_state, empty_init, ROT270, "Sun Electronics (Taito license)", "Stratovox (set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1980, stratvoxb, speakres, stratvox, stratvox, speakres_state, empty_init, ROT270, "bootleg", "Stratovox (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, spacecho, speakres, spacecho, spacecho, speakres_state, empty_init, ROT270, "bootleg (Gayton Games)", "Space Echo (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, spacecho2, speakres, spacecho, spacecho, speakres_state, empty_init, ROT270, "bootleg (Gayton Games)", "Space Echo (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, spacecho, speakres, spacecho, spacecho, speakres_state, empty_init, ROT270, "bootleg (Gayton Games)", "Space Echo (set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1980, spacecho2, speakres, spacecho, spacecho, speakres_state, empty_init, ROT270, "bootleg (Gayton Games)", "Space Echo (set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) GAME( 1980, speakhlp, speakres, spacecho, spacecho, speakres_state, empty_init, ROT270, "bootleg", "Speak & Help", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1981, jongpute, 0, jongpute, jongpute, jongpute_state, empty_init, ROT0, "Alpha Denshi Co.", "Jongputer", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING ) // sampling voice is not emulated, bug with colors makes tile recognition difficult +GAME( 1981, jongpute, 0, jongpute, jongpute, jongpute_state, empty_init, ROT0, "Alpha Denshi Co.", "Jongputer", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING ) // sampling voice is not emulated, bug with colors makes tile recognition difficult GAME( 1981, ttmahjng, jongpute, jongpute, jongpute, jongpute_state, empty_init, ROT0, "Alpha Denshi Co. (Taito license)", "T.T Mahjong", MACHINE_SUPPORTS_SAVE ) GAME( 1981, vscompmj, jongpute, vscompmj, jongpute, jongpute_state, init_vscompmj, ROT0, "Nichibutsu", "VS Computer Mahjong", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING ) // decryption might be incomplete (attract resets), inputs seem read differently -- cgit v1.2.3