From 7a9a815a83def0b4a9984f737ffe536c0cbab8fd Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 3 Sep 2023 10:37:25 +0200 Subject: [PATCH] fphantom,robotadv: small refactor to picking up piece --- src/mame/fidelity/phantom.cpp | 14 ++++++++------ src/mame/misc/tugboat.cpp | 2 ++ src/mame/novag/robotadv.cpp | 18 ++++++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mame/fidelity/phantom.cpp b/src/mame/fidelity/phantom.cpp index 06f6823fdee..d9038c65c0a 100644 --- a/src/mame/fidelity/phantom.cpp +++ b/src/mame/fidelity/phantom.cpp @@ -265,21 +265,23 @@ void phantom_state::update_pieces_position(int state) x += 12; // check if the magnet is in the center of a square - bool valid_pos = ((m_hmotor_pos & 0x0f) > 0 && (m_hmotor_pos & 0x0f) <= 7) && ((m_vmotor_pos & 0x0f) > 8 && (m_vmotor_pos & 0x0f) <= 0xf); + const bool valid_pos = ((m_hmotor_pos & 0x0f) > 0 && (m_hmotor_pos & 0x0f) <= 7) && ((m_vmotor_pos & 0x0f) > 8 && (m_vmotor_pos & 0x0f) <= 0xf); if (state) { if (valid_pos) { // pick up piece, unless it was picked up by the user - int pos = (y << 4 & 0xf0) | (x & 0x0f); + const int pos = (y << 4 & 0xf0) | (x & 0x0f); if (pos != m_board->get_handpos()) + { m_piece_hand = m_board->read_piece(x, y); - if (m_piece_hand != 0) - { - m_board->write_piece(x, y, 0); - m_board->refresh(); + if (m_piece_hand != 0) + { + m_board->write_piece(x, y, 0); + m_board->refresh(); + } } } else diff --git a/src/mame/misc/tugboat.cpp b/src/mame/misc/tugboat.cpp index b94823e3bdf..c1842a97a9e 100644 --- a/src/mame/misc/tugboat.cpp +++ b/src/mame/misc/tugboat.cpp @@ -20,6 +20,8 @@ noticeable on the 2nd level. -------------------------------------------------------------------------------- +PCB notes: + Bottom board: What appeared to be a cpu socket was a passthru to the top board. 4 other smaller chip sockets also passed thru to the top. diff --git a/src/mame/novag/robotadv.cpp b/src/mame/novag/robotadv.cpp index 16b51f49b9a..9e118c6bdfb 100644 --- a/src/mame/novag/robotadv.cpp +++ b/src/mame/novag/robotadv.cpp @@ -6,7 +6,7 @@ Novag Chess Robot Adversary, chess computer with robotic arm. The chess engine is MyChess by David Kittinger, just like the one in Novag Savant. Hardware notes: -- PCB label: PACIFIC MICROELECTRONICS GROUP, 743-279A/280A/281A +- PCB label: GOODNIGHT DESIGN, PACIFIC MICROELECTRONICS GROUP, 743-279A/280A/281A - Zilog Z8400B PS, 6 MHz XTAL - 40KB ROM (4*2764 or equivalent, 4*MSM2716AS) + 1 socket for expansion - 5KB RAM (8*TMM314APL-1, 2*TC5514AP-8 battery-backed) @@ -278,14 +278,16 @@ void robotadv_state::update_piece(double x, double y) return; // pick up piece, unless it was picked up by the user - int pos = (by << 4 & 0xf0) | (bx & 0x0f); + const int pos = (by << 4 & 0xf0) | (bx & 0x0f); if (pos != m_board->get_handpos()) + { m_piece_hand = m_board->read_piece(bx, by); - if (m_piece_hand != 0) - { - m_board->write_piece(bx, by, 0); - m_board->refresh(); + if (m_piece_hand != 0) + { + m_board->write_piece(bx, by, 0); + m_board->refresh(); + } } } } @@ -309,8 +311,8 @@ void robotadv_state::refresh() // output claw position const int open = (m_limits & 1) ? 0x800 : 0; // put open state on x bit 11 - m_out_pos[0] = int((x + 15.0) * 50.0) | open; - m_out_pos[1] = int((y + 15.0) * 50.0); + m_out_pos[0] = int((x + 15.0) * 50.0 + 0.5) | open; + m_out_pos[1] = int((y + 15.0) * 50.0 + 0.5); }