From 6d7a8954237ca31fa2282041d4b2fa86fe58caed Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 13 Dec 2024 21:14:49 +0100 Subject: New working systems ------------------- Chinese Chess [hap, Sean Riddle] --- src/devices/cpu/m6805/hd6305.cpp | 6 +- src/mame/fidelity/dames.cpp | 23 +- src/mame/funworld/funworld.cpp | 5 +- src/mame/layout/novag_accord.lay | 6 +- src/mame/layout/novag_cnchess.lay | 939 +++++++++++++++++++++++++++++++++++++ src/mame/layout/novag_mentor16.lay | 2 +- src/mame/mame.lst | 3 + src/mame/novag/accord.cpp | 2 +- src/mame/novag/cnchess.cpp | 243 ++++++++++ 9 files changed, 1202 insertions(+), 27 deletions(-) create mode 100644 src/mame/layout/novag_cnchess.lay create mode 100644 src/mame/novag/cnchess.cpp diff --git a/src/devices/cpu/m6805/hd6305.cpp b/src/devices/cpu/m6805/hd6305.cpp index 2758b4af278..b81873be608 100644 --- a/src/devices/cpu/m6805/hd6305.cpp +++ b/src/devices/cpu/m6805/hd6305.cpp @@ -130,6 +130,9 @@ void hd6305_device::port_ddr_w(u8 data) void hd6305_device::timer_update_regs() { + if(machine().side_effects_disabled()) + return; + u32 counter = m_prescaler; u64 tc = machine().time().as_ticks(clock())/4; u32 cycles = tc - m_timer_last_update; @@ -308,7 +311,8 @@ void hd6305_device::sci_ssr_w(u8 data) u8 hd6305_device::sci_data_r() { - logerror("sci data r\n"); + if(!machine().side_effects_disabled()) + logerror("sci data r\n"); return 0x00; } diff --git a/src/mame/fidelity/dames.cpp b/src/mame/fidelity/dames.cpp index 185ee867cd6..578e4d802ec 100644 --- a/src/mame/fidelity/dames.cpp +++ b/src/mame/fidelity/dames.cpp @@ -64,7 +64,6 @@ private: required_ioport_array<2> m_inputs; u8 m_inp_mux = 0; - u8 m_led_select = 0; void main_map(address_map &map) ATTR_COLD; @@ -72,7 +71,6 @@ private: u8 read_board_row(u8 row); // I/O handlers - void update_display(); void control_w(u8 data); void select_w(u8 data); u8 input_r(); @@ -80,9 +78,7 @@ private: void dsc_state::machine_start() { - // register for savestates save_item(NAME(m_inp_mux)); - save_item(NAME(m_led_select)); } @@ -132,27 +128,20 @@ u8 dsc_state::read_board_row(u8 row) I/O *******************************************************************************/ -void dsc_state::update_display() -{ - // 4 7seg leds - m_display->matrix(m_led_select, m_inp_mux); -} - void dsc_state::control_w(u8 data) { // d0-d7: input mux, 7seg data - m_inp_mux = data; - update_display(); + m_inp_mux = ~data; + m_display->write_mx(data); } void dsc_state::select_w(u8 data) { + // d0-d3: digit select + m_display->write_my(data & 0xf); + // d4: speaker out m_dac->write(BIT(~data, 4)); - - // d0-d3: digit select - m_led_select = data & 0xf; - update_display(); } u8 dsc_state::input_r() @@ -161,7 +150,7 @@ u8 dsc_state::input_r() // d0-d7: multiplexed inputs (active low) for (int i = 0; i < 8; i++) - if (BIT(~m_inp_mux, i)) + if (BIT(m_inp_mux, i)) { // read checkerboard data |= read_board_row(i); diff --git a/src/mame/funworld/funworld.cpp b/src/mame/funworld/funworld.cpp index 52a53fda76e..6cb43963af1 100644 --- a/src/mame/funworld/funworld.cpp +++ b/src/mame/funworld/funworld.cpp @@ -144,9 +144,6 @@ * Royal Card (stealth with MSX multigame), bootleg, 1991. - Supported games: 124 - - ********************************************************************************************** The hardware is generally composed by: @@ -9029,7 +9026,7 @@ GAME( 1990, funquizb, 0, funquiz, funquiza, funworld_state, empty_in GAMEL( 1986, novoplay, 0, fw2ndpal, novoplay, funworld_state, empty_init, ROT0, "Admiral / Novomatic", "Novo Play Multi Card / Club Card", 0, layout_novoplay ) GAMEL( 1992, novoplaya, novoplay, intrgmes, novop_ab, intergames_state, init_novop_a, ROT0, "Novo Play International", "Novo Play Club Card (V6.2H)", 0, layout_novoplay ) GAMEL( 1991, novoplayb, novoplay, intrgmes, novop_ab, intergames_state, init_novop_b, ROT0, "Novo Play International", "Novo Play Club Card (V3.3H)", 0, layout_novoplay ) -GAME( 1991, intrgmes, 0, intrgmes, intrgmes, intergames_state, init_intgms, ROT0, "Inter Games", "Joker Card (Inter Games)", 0 ) +GAME( 1991, intrgmes, 0, intrgmes, intrgmes, intergames_state, init_intgms, ROT0, "Inter Games", "Joker Card (Inter Games)", 0 ) GAMEL( 1985, fw_a7_11, 0, fw_brick_2, fw_brick1, funworld_state, empty_init, ROT0, "Fun World", "unknown Fun World A7-11 game 1", MACHINE_NOT_WORKING, layout_jollycrd ) GAMEL( 1985, fw_a7_11a, fw_a7_11, fw_brick_2, fw_brick1, funworld_state, empty_init, ROT0, "Fun World", "unknown Fun World A7-11 game 2", MACHINE_NOT_WORKING, layout_jollycrd ) GAMEL( 1991, fw_a0_1, 0, fw_brick_2, fw_brick1, funworld_state, empty_init, ROT0, "Fun World", "unknown Fun World A0-1 game", MACHINE_NOT_WORKING, layout_jollycrd ) diff --git a/src/mame/layout/novag_accord.lay b/src/mame/layout/novag_accord.lay index 5b5998b9ffd..8c2512b66d6 100644 --- a/src/mame/layout/novag_accord.lay +++ b/src/mame/layout/novag_accord.lay @@ -20,7 +20,7 @@ authors:hap - + @@ -52,7 +52,7 @@ authors:hap - + @@ -71,7 +71,7 @@ authors:hap - + diff --git a/src/mame/layout/novag_cnchess.lay b/src/mame/layout/novag_cnchess.lay new file mode 100644 index 00000000000..1c12bb7cf2a --- /dev/null +++ b/src/mame/layout/novag_cnchess.lay @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/novag_mentor16.lay b/src/mame/layout/novag_mentor16.lay index cb3889d1716..aea588159e7 100644 --- a/src/mame/layout/novag_mentor16.lay +++ b/src/mame/layout/novag_mentor16.lay @@ -389,7 +389,7 @@ authors:hap - + diff --git a/src/mame/mame.lst b/src/mame/mame.lst index db9a321fc80..5ed644f60d5 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -35367,6 +35367,9 @@ cexpert cfortea cforteb +@source:novag/cnchess.cpp +cnchess + @source:novag/const.cpp const const36 diff --git a/src/mame/novag/accord.cpp b/src/mame/novag/accord.cpp index 5865c342a2d..751fd561213 100644 --- a/src/mame/novag/accord.cpp +++ b/src/mame/novag/accord.cpp @@ -189,7 +189,7 @@ INPUT_PORTS_END void accord_state::accord(machine_config &config) { // basic machine hardware - HD6301X0(config, m_maincpu, 8'000'000); + HD6301X0(config, m_maincpu, 8'000'000); // approximation, no XTAL m_maincpu->nvram_enable_backup(true); m_maincpu->standby_cb().set(m_maincpu, FUNC(hd6301v1_cpu_device::nvram_set_battery)); m_maincpu->standby_cb().append([this](int state) { if (state) m_display->clear(); }); diff --git a/src/mame/novag/cnchess.cpp b/src/mame/novag/cnchess.cpp new file mode 100644 index 00000000000..6b9a283e332 --- /dev/null +++ b/src/mame/novag/cnchess.cpp @@ -0,0 +1,243 @@ +// license:BSD-3-Clause +// copyright-holders:hap +// thanks-to:Sean Riddle +/******************************************************************************* + +Novag Chinese Chess (象棋, model 866) + +Novag's first Xiangqi computer, mainly sold in Hong Kong. Model 8710 is the same +as model 866, maybe one was for export. The newer model 9300 (distributed by Yorter) +is also presumed to be the same. + +Hardware notes: +- PCB label: 100054 +- Hitachi HD6305Y0P @ ~8MHz (LC oscillator) +- 8*8 chessboard buttons, 16+4 leds, piezo + +BTANB: +- it uses 馬 and 車 for red horse and chariot instead of 傌 and 俥, newer Novag + Xiangqi computers have this too, so it's a design choice? + +*******************************************************************************/ + +#include "emu.h" + +#include "cpu/m6805/hd6305.h" +#include "machine/sensorboard.h" +#include "sound/dac.h" +#include "video/pwm.h" + +#include "speaker.h" + +// internal artwork +#include "novag_cnchess.lh" + + +namespace { + +class cnchess_state : public driver_device +{ +public: + cnchess_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_display(*this, "display"), + m_dac(*this, "dac"), + m_inputs(*this, "IN.0") + { } + + void cnchess(machine_config &config); + +protected: + virtual void machine_start() override ATTR_COLD; + +private: + // devices/pointers + required_device m_maincpu; + required_device m_board; + required_device m_display; + required_device m_dac; + required_ioport m_inputs; + + u16 m_inp_mux = 0; + + void init_board(u8 data); + + // I/O handlers + u16 input_r(); + u8 input1_r(); + u8 input2_r(); + template void input_w(u8 data); + void control_w(u8 data); +}; + + + +/******************************************************************************* + Initialization +*******************************************************************************/ + +void cnchess_state::machine_start() +{ + save_item(NAME(m_inp_mux)); +} + +void cnchess_state::init_board(u8 data) +{ + // 1st row + m_board->write_piece(0, 0, 3); + m_board->write_piece(0, 8, 3); + m_board->write_piece(0, 1, 4); + m_board->write_piece(0, 7, 4); + m_board->write_piece(0, 2, 5); + m_board->write_piece(0, 6, 5); + m_board->write_piece(0, 3, 6); + m_board->write_piece(0, 5, 6); + m_board->write_piece(0, 4, 7); + + // cannons + m_board->write_piece(2, 1, 2); + m_board->write_piece(2, 7, 2); + + // soldiers + for (int i = 0; i < 5; i++) + m_board->write_piece(3, i * 2, 1); + + // mirrored for black pieces + for (int y = 0; y < 4; y++) + for (int x = 0; x < 9; x++) + { + u8 piece = m_board->read_piece(y, x); + if (piece != 0) + m_board->write_piece(9 - y, x, piece + 7); + } +} + + + +/******************************************************************************* + I/O +*******************************************************************************/ + +u16 cnchess_state::input_r() +{ + u16 data = 0; + const u16 inp_mux = bitswap<10>(m_inp_mux,9,8,7,4,3,5,6,2,1,0); + + // read chessboard + for (int i = 0; i < 10; i++) + if (BIT(inp_mux, i)) + data |= m_board->read_file(i); + + // read buttons + if (inp_mux & m_inputs->read()) + data |= 0x200; + + return data; +} + +u8 cnchess_state::input1_r() +{ + // A0-A7: read inputs low + return bitswap<8>(~input_r(),0,1,2,5,6,4,3,7); +} + +u8 cnchess_state::input2_r() +{ + // B6,B7: read inputs high + return bitswap<2>(~input_r(),8,9) << 6 | 0x3f; +} + +template +void cnchess_state::input_w(u8 data) +{ + // Ex,F0,F1: input mux, led data + const u8 shift = N * 8; + const u16 mask = 0xff << shift; + + m_inp_mux = ((m_inp_mux & ~mask) | (~data << shift & mask)) & 0x3ff; + m_display->write_mx(m_inp_mux); +} + +void cnchess_state::control_w(u8 data) +{ + // G4: speaker out + m_dac->write(BIT(~data, 4)); + + // G5-G7: led select + m_display->write_my(~data >> 5 & 7); +} + + + +/******************************************************************************* + Input Ports +*******************************************************************************/ + +static INPUT_PORTS_START( cnchess ) + PORT_START("IN.0") + PORT_BIT(0x00001, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Go") + PORT_BIT(0x00002, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Change Color") + PORT_BIT(0x00004, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Set Up / Pawn") + PORT_BIT(0x00008, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Verify / Cannon") + PORT_BIT(0x00010, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Rook") + PORT_BIT(0x00020, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Take Back / Knight") + PORT_BIT(0x00040, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Hint / Bishop") + PORT_BIT(0x00080, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Sound / Minister") + PORT_BIT(0x00100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Level / General") + PORT_BIT(0x00200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("New Game / Clear Board") +INPUT_PORTS_END + + + +/******************************************************************************* + Machine Configs +*******************************************************************************/ + +void cnchess_state::cnchess(machine_config &config) +{ + // basic machine hardware + HD6305Y0(config, m_maincpu, 8'000'000); // approximation, no XTAL + m_maincpu->read_porta().set(FUNC(cnchess_state::input1_r)); + m_maincpu->read_portb().set(FUNC(cnchess_state::input2_r)); + m_maincpu->write_porte().set(FUNC(cnchess_state::input_w<0>)); + m_maincpu->write_portf().set(FUNC(cnchess_state::input_w<1>)); + m_maincpu->write_portg().set(FUNC(cnchess_state::control_w)); + + SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS); + m_board->init_cb().set(FUNC(cnchess_state::init_board)); + m_board->set_size(10, 9); // rotated by 90 degrees + m_board->set_spawnpoints(14); + m_board->set_delay(attotime::from_msec(150)); + + // video hardware + PWM_DISPLAY(config, m_display).set_size(3, 10); + config.set_default_layout(layout_novag_cnchess); + + // sound hardware + SPEAKER(config, "speaker").front_center(); + DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.5); +} + + + +/******************************************************************************* + ROM Definitions +*******************************************************************************/ + +ROM_START( cnchess ) + ROM_REGION( 0x1ec0, "maincpu", 0 ) + ROM_LOAD("novag_866_35y0b12p", 0x0000, 0x1ec0, CRC(234ef959) SHA1(9ab7310275017dd4b6b152f205d6cd65014da5a6) ) +ROM_END + +} // anonymous namespace + + + +/******************************************************************************* + Drivers +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1986, cnchess, 0, 0, cnchess, cnchess, cnchess_state, empty_init, "Novag Industries", "Chinese Chess", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3