fphantom: do more checks when grabbing piece with magnet

New working systems
-------------------
Chess Robot Adversary [hap, anonymous]
This commit is contained in:
hap 2023-08-28 16:54:57 +02:00
parent ea97755054
commit aad4559ed4
8 changed files with 1408 additions and 77 deletions

View File

@ -7,6 +7,10 @@ Like most other chess computers by ACI, it was also distributed by Chafitz.
The chess engine is Morphy, which in turn is based on Sargon 2.5.
Not counting The Mate, a chess game with chessboard peripheral for the Apple II,
this is the only known Destiny series chesscomputer. ACI also announced Destiny
Laser Chess, but it was never released.
********************************************************************************
PCB notes:

View File

@ -76,9 +76,9 @@ public:
m_display(*this, "display"),
m_inputs(*this, "IN.%u", 0),
m_piece_hand(*this, "cpu_hand"),
m_out_motor(*this, "motor.%u", 0U),
m_out_motorx(*this, "motorx%u", 0U),
m_out_motory(*this, "motory")
m_out_motor(*this, "motor%u", 0U),
m_out_magnetx(*this, "magnetx%u", 0U),
m_out_magnety(*this, "magnety")
{ }
void phantom(machine_config &config);
@ -97,18 +97,13 @@ protected:
optional_ioport_array<2> m_inputs;
output_finder<> m_piece_hand;
output_finder<5> m_out_motor;
output_finder<2> m_out_motorx;
output_finder<> m_out_motory;
output_finder<2> m_out_magnetx;
output_finder<> m_out_magnety;
// address maps
virtual void main_map(address_map &map);
// I/O handlers
void init_motors();
void check_rotation();
TIMER_DEVICE_CALLBACK_MEMBER(motors_timer);
void update_pieces_position(int state);
void update_lcd(u8 select);
virtual void control_w(offs_t offset, u8 data);
void lcd_w(offs_t offset, u8 data);
@ -119,26 +114,35 @@ protected:
u8 hmotor_ff_clear_r();
u8 vmotor_ff_clear_r();
void check_rotation();
TIMER_DEVICE_CALLBACK_MEMBER(motors_timer);
void update_pieces_position(int state);
void output_magnet_pos();
u8 m_mux = 0;
u8 m_select = 0;
u32 m_lcd_data = 0;
u8 m_motors_ctrl;
int m_hmotor_pos;
int m_vmotor_pos;
bool m_vmotor_sensor0_ff;
bool m_vmotor_sensor1_ff;
bool m_hmotor_sensor0_ff;
bool m_hmotor_sensor1_ff;
u8 m_pieces_map[0x40][0x40];
u8 m_motors_ctrl = 0;
int m_hmotor_pos = 0;
int m_vmotor_pos = 0;
bool m_vmotor_sensor0_ff = false;
bool m_vmotor_sensor1_ff = false;
bool m_hmotor_sensor0_ff = false;
bool m_hmotor_sensor1_ff = false;
u8 m_pieces_map[0x80][0x80] = { };
};
void phantom_state::machine_start()
{
m_hmotor_pos = 0x23;
m_vmotor_pos = 0x0e;
// resolve outputs
m_piece_hand.resolve();
m_out_motor.resolve();
m_out_motorx.resolve();
m_out_motory.resolve();
m_out_magnetx.resolve();
m_out_magnety.resolve();
// register for savestates
save_item(NAME(m_mux));
@ -156,8 +160,11 @@ void phantom_state::machine_start()
void phantom_state::machine_reset()
{
init_motors();
m_rombank->set_entry(0);
memset(m_pieces_map, 0, sizeof(m_pieces_map));
m_piece_hand = 0;
output_magnet_pos();
}
void phantom_state::init_phantom()
@ -212,19 +219,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(chessterp_state::nmi_timer)
Motor Sim
*******************************************************************************/
void phantom_state::init_motors()
{
m_motors_ctrl = 0;
m_hmotor_pos = 0x23;
m_vmotor_pos = 0x0e;
m_vmotor_sensor0_ff = false;
m_vmotor_sensor1_ff = false;
m_hmotor_sensor0_ff = false;
m_hmotor_sensor1_ff = false;
memset(m_pieces_map, 0, sizeof(m_pieces_map));
m_piece_hand = 0;
}
void phantom_state::check_rotation()
{
if (m_vmotor_pos != 0 && m_vmotor_pos != 0x88)
@ -239,6 +233,14 @@ void phantom_state::check_rotation()
}
}
void phantom_state::output_magnet_pos()
{
int on = BIT(m_motors_ctrl, 4);
m_out_magnetx[on ^ 1] = 0xd0; // hide
m_out_magnetx[on] = m_hmotor_pos;
m_out_magnety = m_vmotor_pos;
}
TIMER_DEVICE_CALLBACK_MEMBER(phantom_state::motors_timer)
{
check_rotation();
@ -250,16 +252,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(phantom_state::motors_timer)
if ((m_motors_ctrl & 0x08) && m_hmotor_pos < 0xc0) m_hmotor_pos++;
check_rotation();
// output motor position
int magnet = BIT(m_motors_ctrl, 4);
m_out_motorx[magnet ^ 1] = 0xd0; // hide
m_out_motorx[magnet] = m_hmotor_pos;
m_out_motory = m_vmotor_pos;
output_magnet_pos();
}
void phantom_state::update_pieces_position(int state)
{
int mx = m_hmotor_pos / 3;
int my = m_vmotor_pos / 3;
// convert motors position into board coordinates
int x = m_hmotor_pos / 16 - 2;
int y = m_vmotor_pos / 16;
@ -274,38 +274,60 @@ void phantom_state::update_pieces_position(int state)
{
if (valid_pos)
{
// check if piece was picked up by user
// pick up piece, unless it was picked up by the user
int pos = (y << 4 & 0xf0) | (x & 0x0f);
if (pos == m_board->get_handpos())
m_piece_hand = 0;
else
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();
}
}
else
m_piece_hand = m_pieces_map[m_vmotor_pos / 4][m_hmotor_pos / 4];
{
int count = 0;
m_pieces_map[m_vmotor_pos / 4][m_hmotor_pos / 4] = 0;
// check surrounding area for piece
for (int sy = my - 1; sy <= my + 1; sy++)
for (int sx = mx - 1; sx <= mx + 1; sx++)
if (sy >= 0 && sx >= 0 && m_pieces_map[sy][sx] != 0)
{
m_piece_hand = m_pieces_map[sy][sx];
m_pieces_map[sy][sx] = 0;
count++;
}
// more than one piece found (shouldn't happen)
if (count > 1)
popmessage("Internal collision!");
}
}
else if (m_piece_hand != 0)
{
// check for pieces collisions
if (valid_pos && m_board->read_piece(x, y) != 0)
if (valid_pos)
{
valid_pos = false;
logerror("Chesspiece collision at %C%d\n", x + 'A', y + 1);
// collision with piece on board (user interference)
if (m_board->read_piece(x, y) != 0)
popmessage("Collision at %c%d!", x + 'A', y + 1);
else
{
m_board->write_piece(x, y, m_piece_hand);
m_board->refresh();
}
}
else
{
// collision with internal pieces map (shouldn't happen)
if (m_pieces_map[my][mx] != 0)
popmessage("Internal collision!");
else
m_pieces_map[my][mx] = m_piece_hand;
}
if (valid_pos)
m_board->write_piece(x, y, m_piece_hand);
m_pieces_map[m_vmotor_pos / 4][m_hmotor_pos / 4] = m_piece_hand;
m_piece_hand = 0;
}
m_board->refresh();
}
@ -547,7 +569,7 @@ static INPUT_PORTS_START( cphantom )
PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Hint / Yes")
PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move / No/Stop")
PORT_START("IN.1") // motion sensor is inverted here, eg. hold down key to pretend noone's there
PORT_START("IN.1") // motion sensor is inverted here, eg. hold down key to pretend that nobody's there
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_NAME("Motion Sensor")
INPUT_PORTS_END
@ -569,7 +591,7 @@ void phantom_state::phantom(machine_config &config)
TIMER(config, "motors_timer").configure_periodic(FUNC(phantom_state::motors_timer), irq_period * 9);
SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS);
m_board->set_size(12, 8);
m_board->set_size(8+4, 8);
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(100));
@ -633,6 +655,6 @@ ROM_END
*******************************************************************************/
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS
SYST( 1988, fphantom, 0, 0, phantom, phantom, phantom_state, init_phantom, "Fidelity Electronics", "Phantom (Fidelity)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL )
SYST( 1988, fphantom, 0, 0, phantom, phantom, phantom_state, init_phantom, "Fidelity Electronics", "Phantom (Fidelity)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL | MACHINE_IMPERFECT_CONTROLS )
SYST( 1991, cphantom, 0, 0, cphantom, cphantom, chessterp_state, init_phantom, "Fidelity Electronics", "Chesster Phantom (model 6126)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL )
SYST( 1991, cphantom, 0, 0, cphantom, cphantom, chessterp_state, init_phantom, "Fidelity Electronics", "Chesster Phantom (model 6126)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL | MACHINE_IMPERFECT_CONTROLS )

View File

@ -57,7 +57,7 @@ license:CC0-1.0
<disk>
<bounds state="0" x="0" y="0" width="2" height="2" />
<bounds state="240" x="240" y="0" width="2" height="2" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.85" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.9" />
</disk>
</element>
@ -699,13 +699,13 @@ license:CC0-1.0
<element name="eye_led" ref="led"><bounds x="20" y="100" width="1.5" height="1.5" /></element>
<element name="eye_led" ref="led"><bounds x="58.5" y="100" width="1.5" height="1.5" /></element>
<!-- optional motor position overlay -->
<collection name="Motor Position">
<!-- optional magnet position overlay -->
<collection name="Magnet Position">
<repeat count="2">
<param name="i" start="0" increment="1" />
<element name="motorx~i~" ref="mpos~i~">
<animate name="motory" />
<element name="magnetx~i~" ref="mpos~i~">
<animate name="magnety" />
<bounds state="4" x="-17.5" y="84.0" width="160" height="1.25" />
<bounds state="136" x="-17.5" y="1.5" width="160" height="1.25" />
</element>

View File

@ -57,7 +57,7 @@ license:CC0-1.0
<disk>
<bounds state="0" x="0" y="0" width="2" height="2" />
<bounds state="240" x="240" y="0" width="2" height="2" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.85" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.9" />
</disk>
</element>
@ -696,13 +696,13 @@ license:CC0-1.0
<group ref="sb_ui"><bounds x="-33" y="3" width="10" height="80" /></group>
<group ref="panel"><bounds x="-21" y="85" width="122" height="17" /></group>
<!-- optional motor position overlay -->
<collection name="Motor Position">
<!-- optional magnet position overlay -->
<collection name="Magnet Position">
<repeat count="2">
<param name="i" start="0" increment="1" />
<element name="motorx~i~" ref="mpos~i~">
<animate name="motory" />
<element name="magnetx~i~" ref="mpos~i~">
<animate name="magnety" />
<bounds state="4" x="-17.5" y="84.0" width="160" height="1.25" />
<bounds state="136" x="-17.5" y="1.5" width="160" height="1.25" />
</element>

View File

@ -0,0 +1,752 @@
<?xml version="1.0"?>
<!--
license:CC0-1.0
-->
<mamelayout version="2">
<!-- define elements -->
<element name="disk_black"><disk><color red="0.15" green="0.15" blue="0.15" /></disk></element>
<element name="blackb"><rect><color red="0" green="0" blue="0" /></rect></element>
<element name="darkred"><rect><color red="0.17" green="0.015" blue="0.02" /></rect></element>
<element name="rmask"><rect><color red="0.69" green="0.845" blue="0.84" /></rect></element>
<element name="border1">
<rect>
<bounds xc="0" yc="0" width="84.15" height="84.15" />
<color red="0.185" green="0.188" blue="0.19" />
</rect>
<rect>
<bounds xc="0" yc="0" width="83.85" height="83.85" />
<color red="1" green="1" blue="1" />
</rect>
</element>
<element name="border2">
<rect>
<bounds xc="0" yc="0" width="20.15" height="80.15" />
<color red="0.185" green="0.188" blue="0.19" />
</rect>
<rect>
<bounds xc="0" yc="0" width="19.85" height="79.85" />
<color red="1" green="1" blue="1" />
</rect>
</element>
<element name="but" defstate="0">
<rect>
<bounds xc="0" yc="0" width="5" height="1.7" />
<color red="0.15" green="0.15" blue="0.15" />
</rect>
<rect state="0">
<bounds xc="0" yc="0" width="4.7" height="1.4" />
<color red="0.41" green="0.4" blue="0.39" />
</rect>
<rect state="1">
<bounds xc="0" yc="0" width="4.7" height="1.4" />
<color red="0.31" green="0.3" blue="0.29" />
</rect>
</element>
<element name="led" defstate="0">
<rect state="1"><color red="1.0" green="0.1" blue="0.15" /></rect>
</element>
<element name="clawpos0" defstate="0">
<rect>
<bounds x="0" y="0" width="1600" height="6.25" />
<color alpha="0" />
</rect>
<disk>
<bounds state="0" x="0" y="0" width="6.25" height="6.25" />
<bounds state="1500" x="1500" y="0" width="6.25" height="6.25" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.35" />
</disk>
</element>
<element name="clawpos1" defstate="0">
<rect>
<bounds x="0" y="0" width="1600" height="6.25" />
<color alpha="0" />
</rect>
<disk>
<bounds state="0" x="0" y="0" width="6.25" height="6.25" />
<bounds state="1500" x="1500" y="0" width="6.25" height="6.25" />
<color red="0.9" green="0.0" blue="0.6" alpha="0.9" />
</disk>
</element>
<element name="text_1"><rect><color red="1" green="1" blue="1" /></rect><text string="1"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_2"><rect><color red="1" green="1" blue="1" /></rect><text string="2"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_3"><rect><color red="1" green="1" blue="1" /></rect><text string="3"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_4"><rect><color red="1" green="1" blue="1" /></rect><text string="4"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_5"><rect><color red="1" green="1" blue="1" /></rect><text string="5"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_6"><rect><color red="1" green="1" blue="1" /></rect><text string="6"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_7"><rect><color red="1" green="1" blue="1" /></rect><text string="7"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_8"><rect><color red="1" green="1" blue="1" /></rect><text string="8"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_a"><rect><color red="1" green="1" blue="1" /></rect><text string="A"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_b"><rect><color red="1" green="1" blue="1" /></rect><text string="B"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_c"><rect><color red="1" green="1" blue="1" /></rect><text string="C"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_d"><rect><color red="1" green="1" blue="1" /></rect><text string="D"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_e"><rect><color red="1" green="1" blue="1" /></rect><text string="E"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_f"><rect><color red="1" green="1" blue="1" /></rect><text string="F"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_g"><rect><color red="1" green="1" blue="1" /></rect><text string="G"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<element name="text_h"><rect><color red="1" green="1" blue="1" /></rect><text string="H"><color red="0.185" green="0.188" blue="0.19" /></text></element>
<!-- sb board -->
<element name="cblack"><rect><color red="0.41" green="0.4" blue="0.39" /></rect></element>
<element name="cwhite"><rect><color red="0.81" green="0.8" blue="0.79" /></rect></element>
<element name="hlbb" defstate="0">
<text string=" "><bounds x="0" y="0" width="1" height="1" /></text>
<disk state="1">
<bounds x="0.12" y="0.12" width="0.76" height="0.76" />
<color red="0" green="0" blue="0" />
</disk>
</element>
<element name="piece" defstate="0">
<image file="chess/wp.svg" state="1"/>
<image file="chess/wn.svg" state="2"/>
<image file="chess/wb.svg" state="3"/>
<image file="chess/wr.svg" state="4"/>
<image file="chess/wq.svg" state="5"/>
<image file="chess/wk.svg" state="6"/>
<image file="chess/bp.svg" state="7"/>
<image file="chess/bn.svg" state="8"/>
<image file="chess/bb.svg" state="9"/>
<image file="chess/br.svg" state="10"/>
<image file="chess/bq.svg" state="11"/>
<image file="chess/bk.svg" state="12"/>
<!-- selected pieces -->
<image file="chess/wp.svg" state="13"><color alpha="0.5" /></image>
<image file="chess/wn.svg" state="14"><color alpha="0.5" /></image>
<image file="chess/wb.svg" state="15"><color alpha="0.5" /></image>
<image file="chess/wr.svg" state="16"><color alpha="0.5" /></image>
<image file="chess/wq.svg" state="17"><color alpha="0.5" /></image>
<image file="chess/wk.svg" state="18"><color alpha="0.5" /></image>
<image file="chess/bp.svg" state="19"><color alpha="0.5" /></image>
<image file="chess/bn.svg" state="20"><color alpha="0.5" /></image>
<image file="chess/bb.svg" state="21"><color alpha="0.5" /></image>
<image file="chess/br.svg" state="22"><color alpha="0.5" /></image>
<image file="chess/bq.svg" state="23"><color alpha="0.5" /></image>
<image file="chess/bk.svg" state="24"><color alpha="0.5" /></image>
</element>
<group name="sb_board">
<bounds x="0" y="0" width="80" height="80" />
<!-- squares (avoid seams) -->
<element ref="cwhite"><bounds x="0" y="0" width="11" height="11" /></element>
<element ref="cblack"><bounds x="10" y="0" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="20" y="0" width="11" height="11" /></element>
<element ref="cblack"><bounds x="30" y="0" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="40" y="0" width="11" height="11" /></element>
<element ref="cblack"><bounds x="50" y="0" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="60" y="0" width="11" height="11" /></element>
<element ref="cblack"><bounds x="70" y="0" width="10" height="11" /></element>
<element ref="cblack"><bounds x="0" y="10" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="10" y="10" width="11" height="11" /></element>
<element ref="cblack"><bounds x="20" y="10" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="30" y="10" width="11" height="11" /></element>
<element ref="cblack"><bounds x="40" y="10" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="50" y="10" width="11" height="11" /></element>
<element ref="cblack"><bounds x="60" y="10" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="70" y="10" width="10" height="11" /></element>
<element ref="cwhite"><bounds x="0" y="20" width="11" height="11" /></element>
<element ref="cblack"><bounds x="10" y="20" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="20" y="20" width="11" height="11" /></element>
<element ref="cblack"><bounds x="30" y="20" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="40" y="20" width="11" height="11" /></element>
<element ref="cblack"><bounds x="50" y="20" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="60" y="20" width="11" height="11" /></element>
<element ref="cblack"><bounds x="70" y="20" width="10" height="11" /></element>
<element ref="cblack"><bounds x="0" y="30" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="10" y="30" width="11" height="11" /></element>
<element ref="cblack"><bounds x="20" y="30" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="30" y="30" width="11" height="11" /></element>
<element ref="cblack"><bounds x="40" y="30" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="50" y="30" width="11" height="11" /></element>
<element ref="cblack"><bounds x="60" y="30" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="70" y="30" width="10" height="11" /></element>
<element ref="cwhite"><bounds x="0" y="40" width="11" height="11" /></element>
<element ref="cblack"><bounds x="10" y="40" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="20" y="40" width="11" height="11" /></element>
<element ref="cblack"><bounds x="30" y="40" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="40" y="40" width="11" height="11" /></element>
<element ref="cblack"><bounds x="50" y="40" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="60" y="40" width="11" height="11" /></element>
<element ref="cblack"><bounds x="70" y="40" width="10" height="11" /></element>
<element ref="cblack"><bounds x="0" y="50" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="10" y="50" width="11" height="11" /></element>
<element ref="cblack"><bounds x="20" y="50" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="30" y="50" width="11" height="11" /></element>
<element ref="cblack"><bounds x="40" y="50" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="50" y="50" width="11" height="11" /></element>
<element ref="cblack"><bounds x="60" y="50" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="70" y="50" width="10" height="11" /></element>
<element ref="cwhite"><bounds x="0" y="60" width="11" height="11" /></element>
<element ref="cblack"><bounds x="10" y="60" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="20" y="60" width="11" height="11" /></element>
<element ref="cblack"><bounds x="30" y="60" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="40" y="60" width="11" height="11" /></element>
<element ref="cblack"><bounds x="50" y="60" width="11" height="11" /></element>
<element ref="cwhite"><bounds x="60" y="60" width="11" height="11" /></element>
<element ref="cblack"><bounds x="70" y="60" width="10" height="11" /></element>
<element ref="cblack"><bounds x="0" y="70" width="11" height="10" /></element>
<element ref="cwhite"><bounds x="10" y="70" width="11" height="10" /></element>
<element ref="cblack"><bounds x="20" y="70" width="11" height="10" /></element>
<element ref="cwhite"><bounds x="30" y="70" width="11" height="10" /></element>
<element ref="cblack"><bounds x="40" y="70" width="11" height="10" /></element>
<element ref="cwhite"><bounds x="50" y="70" width="11" height="10" /></element>
<element ref="cblack"><bounds x="60" y="70" width="11" height="10" /></element>
<element ref="cwhite"><bounds x="70" y="70" width="10" height="10" /></element>
<!-- sensors, pieces -->
<repeat count="8">
<param name="y" start="0" increment="10" />
<param name="i" start="8" increment="-1" />
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x01"><bounds x="0" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x02"><bounds x="10" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x04"><bounds x="20" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x08"><bounds x="30" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x10"><bounds x="40" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x20"><bounds x="50" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x40"><bounds x="60" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x80"><bounds x="70" y="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element name="piece_a~i~" ref="piece"><bounds x="0" y="~y~" width="10" height="10" /></element>
<element name="piece_b~i~" ref="piece"><bounds x="10" y="~y~" width="10" height="10" /></element>
<element name="piece_c~i~" ref="piece"><bounds x="20" y="~y~" width="10" height="10" /></element>
<element name="piece_d~i~" ref="piece"><bounds x="30" y="~y~" width="10" height="10" /></element>
<element name="piece_e~i~" ref="piece"><bounds x="40" y="~y~" width="10" height="10" /></element>
<element name="piece_f~i~" ref="piece"><bounds x="50" y="~y~" width="10" height="10" /></element>
<element name="piece_g~i~" ref="piece"><bounds x="60" y="~y~" width="10" height="10" /></element>
<element name="piece_h~i~" ref="piece"><bounds x="70" y="~y~" width="10" height="10" /></element>
</repeat>
</group>
<!-- sb ui -->
<element name="hlub" defstate="0">
<rect state="1"><color red="0" green="0" blue="0" /></rect>
</element>
<element name="text_uit1"><text string="S.BOARD"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uit2"><text string="INTERFACE"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uib1"><text string="BOARD:"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uib2">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="RESET"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uib3">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="CLEAR"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uis1"><text string="SPAWN:"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uih1"><text string="HAND:"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uih2">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="REMOVE"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uiu1"><text string="UNDO:"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uiu2a">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string=" &lt;&lt;"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uiu2b">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string=" &lt; "><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uiu2c">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string=" &gt;"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uiu2d">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string=" &gt;&gt;"><color red="0.01" green="0.01" blue="0.01" /></text>
</element>
<element name="text_uiu3a" defstate="0">
<simplecounter maxstate="999" digits="1" align="2">
<color red="0.81" green="0.8" blue="0.79" />
</simplecounter>
</element>
<element name="text_uiu3b"><text string="/"><color red="0.81" green="0.8" blue="0.79" /></text></element>
<element name="text_uiu3c" defstate="0">
<simplecounter maxstate="999" digits="1" align="1">
<color red="0.81" green="0.8" blue="0.79" />
</simplecounter>
</element>
<group name="sb_ui">
<bounds x="0" y="0" width="10" height="80" />
<element ref="cblack"><bounds x="0" y="0" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="7" width="10" height="1" /></element>
<element ref="cblack"><bounds x="0" y="79" width="10" height="1" /></element>
<element ref="text_uit1"><bounds x="0" y="2" width="10" height="2" /></element>
<element ref="text_uit2"><bounds x="0" y="4" width="10" height="2" /></element>
<!-- board -->
<element ref="text_uib1"><bounds x="0" y="9" width="10" height="2" /></element>
<element ref="cwhite"><bounds x="1" y="11.5" width="8" height="2.5" /></element>
<element ref="cwhite"><bounds x="1" y="15" width="8" height="2.5" /></element>
<element ref="text_uib2"><bounds x="1.5" y="11.75" width="7" height="2" /></element>
<element ref="text_uib3"><bounds x="1.5" y="15.25" width="7" height="2" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x200"><bounds x="1" y="11.5" width="8" height="2.5" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x100"><bounds x="1" y="15" width="8" height="2.5" /><color alpha="0.25" /></element>
<!-- spawn -->
<element ref="text_uis1"><bounds x="0" y="20.5" width="10" height="2" /></element>
<element ref="cwhite"><bounds x="1" y="23" width="8" height="12" /></element>
<element ref="cwhite"><bounds x="1" y="36" width="8" height="12" /></element>
<element name="piece_ui1" ref="piece"><bounds x="1" y="23" width="4" height="4" /></element>
<element name="piece_ui2" ref="piece"><bounds x="1" y="27" width="4" height="4" /></element>
<element name="piece_ui3" ref="piece"><bounds x="1" y="31" width="4" height="4" /></element>
<element name="piece_ui4" ref="piece"><bounds x="5" y="23" width="4" height="4" /></element>
<element name="piece_ui5" ref="piece"><bounds x="5" y="27" width="4" height="4" /></element>
<element name="piece_ui6" ref="piece"><bounds x="5" y="31" width="4" height="4" /></element>
<element name="piece_ui7" ref="piece"><bounds x="1" y="36" width="4" height="4" /></element>
<element name="piece_ui8" ref="piece"><bounds x="1" y="40" width="4" height="4" /></element>
<element name="piece_ui9" ref="piece"><bounds x="1" y="44" width="4" height="4" /></element>
<element name="piece_ui10" ref="piece"><bounds x="5" y="36" width="4" height="4" /></element>
<element name="piece_ui11" ref="piece"><bounds x="5" y="40" width="4" height="4" /></element>
<element name="piece_ui12" ref="piece"><bounds x="5" y="44" width="4" height="4" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0001"><bounds x="1" y="23" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0002"><bounds x="1" y="27" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0004"><bounds x="1" y="31" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0008"><bounds x="5" y="23" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0010"><bounds x="5" y="27" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0020"><bounds x="5" y="31" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0040"><bounds x="1" y="36" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0080"><bounds x="1" y="40" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0100"><bounds x="1" y="44" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0200"><bounds x="5" y="36" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0400"><bounds x="5" y="40" width="4" height="4" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:SPAWN" inputmask="0x0800"><bounds x="5" y="44" width="4" height="4" /><color alpha="0.25" /></element>
<!-- hand -->
<element ref="text_uih1"><bounds x="0" y="51" width="10" height="2" /></element>
<element ref="cblack"><bounds x="1" y="53.5" width="8" height="6" /></element>
<element name="piece_ui0" ref="piece"><bounds x="2" y="53.5" width="6" height="6" /></element>
<element name="cpu_hand" ref="piece"><bounds x="2" y="53.5" width="6" height="6" /><color alpha="0.5" /></element>
<element ref="cwhite"><bounds x="1" y="60.5" width="8" height="2.5" /></element>
<element ref="text_uih2"><bounds x="1.5" y="60.75" width="7" height="2" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x08"><bounds x="1" y="60.5" width="8" height="2.5" /><color alpha="0.25" /></element>
<!-- undo -->
<element ref="text_uiu1"><bounds x="0" y="66" width="10" height="2" /></element>
<element ref="cwhite"><bounds x="1" y="68.5" width="1.7" height="6" /></element>
<element ref="cwhite"><bounds x="3.1" y="68.5" width="1.7" height="6" /></element>
<element ref="cwhite"><bounds x="5.2" y="68.5" width="1.7" height="6" /></element>
<element ref="cwhite"><bounds x="7.3" y="68.5" width="1.7" height="6" /></element>
<element ref="text_uiu2a"><bounds x="1" y="69.5" width="1.7" height="4" /></element>
<element ref="text_uiu2b"><bounds x="3.1" y="69.5" width="1.7" height="4" /></element>
<element ref="text_uiu2c"><bounds x="5.2" y="69.5" width="1.7" height="4" /></element>
<element ref="text_uiu2d"><bounds x="7.3" y="69.5" width="1.7" height="4" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x10"><bounds x="1" y="68.5" width="1.7" height="6" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x20"><bounds x="3.1" y="68.5" width="1.7" height="6" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x40"><bounds x="5.2" y="68.5" width="1.7" height="6" /><color alpha="0.25" /></element>
<element ref="hlub" inputtag="board:UI" inputmask="0x80"><bounds x="7.3" y="68.5" width="1.7" height="6" /><color alpha="0.25" /></element>
<element name="count_ui0" ref="text_uiu3a"><bounds x="0" y="75" width="4" height="2" /></element>
<element name="count_ui1" ref="text_uiu3c"><bounds x="6" y="75" width="4" height="2" /></element>
<element ref="text_uiu3b"><bounds x="4" y="75" width="2" height="2" /></element>
</group>
<!-- left/right edges -->
<element name="disk_bw">
<disk>
<bounds xc="0" yc="0" width="10" height="10" />
<color red="0.15" green="0.15" blue="0.15" />
</disk>
<disk>
<bounds xc="0" yc="0" width="7.5" height="7.5" />
<color red="0.81" green="0.8" blue="0.79" />
</disk>
</element>
<element name="text_pw1"><image file="chess/wk.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pw2"><image file="chess/wq.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pw3"><image file="chess/wb.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pw4"><image file="chess/wn.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pw5"><image file="chess/wr.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pw6"><image file="chess/wp.svg" /><rect><color red="0" green="0" blue="0" alpha="0.35" /></rect></element>
<element name="text_pr1"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bk.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<element name="text_pr2"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bq.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<element name="text_pr3"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bb.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<element name="text_pr4"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bn.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<element name="text_pr5"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/br.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<element name="text_pr6"><rect><color red="1" green="1" blue="1" /></rect><image file="chess/bp.svg" /><rect><color red="1" green="1" blue="1" alpha="0.1875" /></rect></element>
<group name="left">
<element ref="cwhite"><bounds x="0" y="0" width="20" height="80" /></element>
<repeat count="8">
<param name="y" start="5" increment="10" />
<param name="yp" start="4.9" increment="10" />
<element ref="disk_black"><bounds xc="5" yc="~y~" width="6" height="6" /></element>
<element ref="disk_black"><bounds xc="15" yc="~y~" width="6" height="6" /></element>
<element ref="text_pw6" blend="add"><bounds xc="15" yc="~yp~" width="3.9" height="3.9" /></element>
</repeat>
<element ref="text_pw1" blend="add"><bounds xc="5" yc="4.9" width="3.9" height="3.9" /></element>
<element ref="text_pw2" blend="add"><bounds xc="5" yc="14.9" width="3.9" height="3.9" /></element>
<element ref="text_pw3" blend="add"><bounds xc="5" yc="24.9" width="3.9" height="3.9" /></element>
<element ref="text_pw3" blend="add"><bounds xc="5" yc="34.9" width="3.9" height="3.9" /></element>
<element ref="text_pw4" blend="add"><bounds xc="5" yc="44.9" width="3.9" height="3.9" /></element>
<element ref="text_pw4" blend="add"><bounds xc="5" yc="54.9" width="3.9" height="3.9" /></element>
<element ref="text_pw5" blend="add"><bounds xc="5" yc="64.9" width="3.9" height="3.9" /></element>
<element ref="text_pw5" blend="add"><bounds xc="5" yc="74.9" width="3.9" height="3.9" /></element>
<repeat count="8">
<param name="y" start="5" increment="10" />
<param name="i" start="8" increment="-1" />
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x100"><bounds xc="5" yc="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x200"><bounds xc="15" yc="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element name="piece_i~i~" ref="piece"><bounds xc="5" yc="~y~" width="10" height="10" /></element>
<element name="piece_j~i~" ref="piece"><bounds xc="15" yc="~y~" width="10" height="10" /></element>
</repeat>
</group>
<group name="right">
<element ref="cwhite"><bounds x="0" y="0" width="20" height="80" /></element>
<repeat count="8">
<param name="y" start="5" increment="10" />
<param name="yp" start="4.9" increment="10" />
<element ref="disk_bw"><bounds xc="5" yc="~y~" width="6" height="6" /></element>
<element ref="disk_bw"><bounds xc="15" yc="~y~" width="6" height="6" /></element>
<element ref="text_pr6" blend="multiply"><bounds xc="5" yc="~yp~" width="3.9" height="3.9" /></element>
</repeat>
<element ref="text_pr1" blend="multiply"><bounds xc="15" yc="4.9" width="3.9" height="3.9" /></element>
<element ref="text_pr2" blend="multiply"><bounds xc="15" yc="14.9" width="3.9" height="3.9" /></element>
<element ref="text_pr3" blend="multiply"><bounds xc="15" yc="24.9" width="3.9" height="3.9" /></element>
<element ref="text_pr3" blend="multiply"><bounds xc="15" yc="34.9" width="3.9" height="3.9" /></element>
<element ref="text_pr4" blend="multiply"><bounds xc="15" yc="44.9" width="3.9" height="3.9" /></element>
<element ref="text_pr4" blend="multiply"><bounds xc="15" yc="54.9" width="3.9" height="3.9" /></element>
<element ref="text_pr5" blend="multiply"><bounds xc="15" yc="64.9" width="3.9" height="3.9" /></element>
<element ref="text_pr5" blend="multiply"><bounds xc="15" yc="74.9" width="3.9" height="3.9" /></element>
<repeat count="8">
<param name="y" start="5" increment="10" />
<param name="i" start="8" increment="-1" />
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x400"><bounds xc="5" yc="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element ref="hlbb" inputtag="board:RANK.~i~" inputmask="0x800"><bounds xc="15" yc="~y~" width="10" height="10" /><color alpha="0.04" /></element>
<element name="piece_k~i~" ref="piece"><bounds xc="5" yc="~y~" width="10" height="10" /></element>
<element name="piece_l~i~" ref="piece"><bounds xc="15" yc="~y~" width="10" height="10" /></element>
</repeat>
</group>
<!-- button panel -->
<element name="text_ba1">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="New Game"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba2">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Auto Play"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba3">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Classic Game"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba4">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Emotions"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba5">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Sound"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba6">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Solve Mate"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba7">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Promote"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba8">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Set Up"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba9">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Verify"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba10">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Change Color"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba11">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Hint"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_ba12">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Level"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb1">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Demo Program"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb2">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Test"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb3">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Form Size"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb4">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Print Moves"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb5">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Print List"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb6">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Print Board"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb7">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Best Move"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb8">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Trace Back"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb9">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Trace Forward"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb10">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Review"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb11">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="Return"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bb12">
<rect><color red="0.81" green="0.8" blue="0.79" /></rect>
<text string="GO"><color red="0.15" green="0.15" blue="0.15" /></text>
</element>
<group name="buttons">
<element ref="cwhite"><bounds x="0" y="0" width="130" height="9.5" /></element>
<repeat count="12">
<param name="x" start="10" increment="10" />
<param name="i" start="1" increment="1" />
<element ref="text_ba~i~"><bounds xc="~x~" y="0" width="10" height="1.7" /></element>
<element ref="text_bb~i~"><bounds xc="~x~" y="5.15" width="10" height="1.7" /></element>
</repeat>
<element ref="but" inputtag="IN.2" inputmask="0x02"><bounds xc="10" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x04"><bounds xc="20" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x20"><bounds xc="30" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x40"><bounds xc="40" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x02"><bounds xc="50" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x04"><bounds xc="60" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x20"><bounds xc="70" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x40"><bounds xc="80" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x02"><bounds xc="90" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x04"><bounds xc="100" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x20"><bounds xc="110" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x40"><bounds xc="120" y="2.2" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x01"><bounds xc="10" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x08"><bounds xc="20" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x10"><bounds xc="30" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.2" inputmask="0x80"><bounds xc="40" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x01"><bounds xc="50" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x08"><bounds xc="60" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x10"><bounds xc="70" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.1" inputmask="0x80"><bounds xc="80" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x01"><bounds xc="90" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x08"><bounds xc="100" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x10"><bounds xc="110" y="7.35" width="5" height="1.7" /></element>
<element ref="but" inputtag="IN.0" inputmask="0x80"><bounds xc="120" y="7.35" width="5" height="1.7" /></element>
</group>
<!-- bottom leds -->
<element name="text_l1"><text string="Demo Program"></text></element>
<element name="text_l2"><text string="Auto Play"></text></element>
<element name="text_l3"><text string="Trace Mode"></text></element>
<element name="text_l4"><text string="Emotions"></text></element>
<element name="text_l5"><text string="Sound"></text></element>
<element name="text_l6"><text string="Piece Discrepancy"></text></element>
<element name="text_l7"><text string="Illegal"></text></element>
<element name="text_l8"><text string="Set Up"></text></element>
<element name="text_l9"><text string="Verify"></text></element>
<element name="text_l10"><text string="Black/White"></text></element>
<element name="text_l11"><text string="Human"></text></element>
<element name="text_l12"><text string="Robot"></text></element>
<element name="text_pl1"><image file="chess/wk.svg" /></element>
<element name="text_pl2"><image file="chess/wq.svg" /></element>
<element name="text_pl3"><image file="chess/wb.svg" /></element>
<element name="text_pl4"><image file="chess/wn.svg" /></element>
<element name="text_pl5"><image file="chess/wr.svg" /></element>
<element name="text_pl6"><image file="chess/wp.svg" /></element>
<group name="leds1a">
<bounds x="0" y="0" width="140" height="10" />
<repeat count="12">
<param name="x" start="15" increment="10" />
<param name="i" start="1" increment="1" />
<element ref="text_l~i~"><bounds xc="~x~" y="0" width="20" height="1.7" /></element>
</repeat>
<repeat count="6">
<param name="x" start="25" increment="10" />
<param name="i" start="6" increment="-1" />
<element ref="text_pl~i~"><bounds xc="~x~" y="3.2" width="2.3" height="2.3" /></element>
</repeat>
</group>
<group name="leds1b">
<bounds x="0" y="0" width="140" height="10" />
<element name="2.0" ref="led"><bounds xc="15" y="2.0" width="2" height="0.9" /></element>
<element name="2.1" ref="led"><bounds xc="25" y="2.0" width="2" height="0.9" /></element>
<element name="2.2" ref="led"><bounds xc="35" y="2.0" width="2" height="0.9" /></element>
<element name="2.3" ref="led"><bounds xc="45" y="2.0" width="2" height="0.9" /></element>
<element name="2.4" ref="led"><bounds xc="55" y="2.0" width="2" height="0.9" /></element>
<element name="2.5" ref="led"><bounds xc="65" y="2.0" width="2" height="0.9" /></element>
<element name="2.6" ref="led"><bounds xc="75" y="2.0" width="2" height="0.9" /></element>
<element name="2.7" ref="led"><bounds xc="85" y="2.0" width="2" height="0.9" /></element>
<element name="1.0" ref="led"><bounds xc="95" y="2.0" width="2" height="0.9" /></element>
<element name="1.1" ref="led"><bounds xc="105" y="2.0" width="2" height="0.9" /></element>
<element name="1.2" ref="led"><bounds xc="115" y="2.0" width="2" height="0.9" /></element>
<element name="1.3" ref="led"><bounds xc="125" y="2.0" width="2" height="0.9" /></element>
</group>
<!-- top leds (squashed to save vertical space) -->
<group name="leds2">
<bounds x="0" y="0" width="40" height="10" />
<element name="0.0" ref="led"><bounds x="0" y="0" width="2" height="0.9" /></element>
<element name="0.1" ref="led"><bounds x="6" y="0" width="2" height="0.9" /></element>
<element name="0.2" ref="led"><bounds x="12" y="0" width="2" height="0.9" /></element>
<element name="0.3" ref="led"><bounds x="18" y="0" width="2" height="0.9" /></element>
<element name="0.4" ref="led"><bounds x="0" y="1.8" width="2" height="0.9" /></element>
<element name="0.5" ref="led"><bounds x="6" y="1.8" width="2" height="0.9" /></element>
<element name="0.6" ref="led"><bounds x="12" y="1.8" width="2" height="0.9" /></element>
<element name="0.7" ref="led"><bounds x="18" y="1.8" width="2" height="0.9" /></element>
<element name="1.4" ref="led"><bounds x="0" y="3.6" width="2" height="0.9" /></element>
<element name="1.5" ref="led"><bounds x="6" y="3.6" width="2" height="0.9" /></element>
<element name="1.6" ref="led"><bounds x="12" y="3.6" width="2" height="0.9" /></element>
<element name="1.7" ref="led"><bounds x="18" y="3.6" width="2" height="0.9" /></element>
</group>
<!-- build screen -->
<view name="Internal Layout">
<bounds left="-38" right="112" top="-16" bottom="107" />
<group ref="leds1a"><bounds x="-26" y="88.25" width="140" height="10" /></group>
<element ref="rmask" blend="multiply"><bounds x="-24" y="80" width="136" height="20" /></element>
<element ref="darkred" blend="add"><bounds x="-24" y="80" width="136" height="20" /></element>
<group ref="leds1b"><bounds x="-26" y="88.5" width="140" height="10" /></group>
<element ref="darkred"><bounds x="-24" y="-16" width="136" height="20" /></element>
<group ref="leds2"><bounds x="88" y="-14.75" width="40" height="10" /></group>
<element ref="cwhite"><bounds x="-24" y="-9" width="136" height="96" /></element>
<element ref="cwhite"><bounds x="-24" y="95" width="136" height="12" /></element>
<group ref="buttons"><bounds x="-21" y="96.2" width="130" height="9.5" /></group>
<group ref="sb_board"><bounds x="4" y="3" width="80" height="80" /></group>
<group ref="sb_ui"><bounds x="-36" y="3" width="10" height="80" /></group>
<group ref="left"><bounds x="-20" y="-7" width="20" height="80" /></group>
<group ref="right"><bounds x="88" y="-7" width="20" height="80" /></group>
<element ref="border1" blend="multiply"><bounds x="1.925" y="0.925" width="84.15" height="84.15" /></element>
<element ref="border2" blend="multiply"><bounds x="-20.075" y="-7.075" width="20.15" height="80.15" /></element>
<element ref="border2" blend="multiply"><bounds x="87.925" y="-7.075" width="20.15" height="80.15" /></element>
<!-- chessboard coords -->
<element ref="text_8" blend="multiply"><bounds xc="3" yc="8" width="2" height="1.7" /></element>
<element ref="text_7" blend="multiply"><bounds xc="3" yc="18" width="2" height="1.7" /></element>
<element ref="text_6" blend="multiply"><bounds xc="3" yc="28" width="2" height="1.7" /></element>
<element ref="text_5" blend="multiply"><bounds xc="3" yc="38" width="2" height="1.7" /></element>
<element ref="text_4" blend="multiply"><bounds xc="3" yc="48" width="2" height="1.7" /></element>
<element ref="text_3" blend="multiply"><bounds xc="3" yc="58" width="2" height="1.7" /></element>
<element ref="text_2" blend="multiply"><bounds xc="3" yc="68" width="2" height="1.7" /></element>
<element ref="text_1" blend="multiply"><bounds xc="3" yc="78" width="2" height="1.7" /></element>
<element ref="text_a" blend="multiply"><bounds xc="9" y="83.1" width="2" height="1.7" /></element>
<element ref="text_b" blend="multiply"><bounds xc="19" y="83.1" width="2" height="1.7" /></element>
<element ref="text_c" blend="multiply"><bounds xc="29" y="83.1" width="2" height="1.7" /></element>
<element ref="text_d" blend="multiply"><bounds xc="39" y="83.1" width="2" height="1.7" /></element>
<element ref="text_e" blend="multiply"><bounds xc="49" y="83.1" width="2" height="1.7" /></element>
<element ref="text_f" blend="multiply"><bounds xc="59" y="83.1" width="2" height="1.7" /></element>
<element ref="text_g" blend="multiply"><bounds xc="69" y="83.1" width="2" height="1.7" /></element>
<element ref="text_h" blend="multiply"><bounds xc="79" y="83.1" width="2" height="1.7" /></element>
<!-- optional claw position overlay -->
<collection name="Claw Position">
<repeat count="2">
<param name="i" start="0" increment="1" />
<element name="clawx~i~" ref="clawpos~i~">
<animate name="clawy" />
<bounds state="0" x="-106.625" y="-168.625" width="320" height="1.25" />
<bounds state="1500" x="-106.625" y="131.375" width="320" height="1.25" />
</element>
</repeat>
<element ref="blackb"><bounds x="189" y="-200" width="10" height="400" /></element>
</collection>
</view>
</mamelayout>

View File

@ -34620,6 +34620,9 @@ nmicro
@source:novag/micro2.cpp
nmicro2
@source:novag/robotadv.cpp
robotadv
@source:novag/savant.cpp
savant //
savant2 //

548
src/mame/novag/robotadv.cpp Normal file
View File

@ -0,0 +1,548 @@
// license:BSD-3-Clause
// copyright-holders:hap
/*******************************************************************************
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, ROM PCB: 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)
- SN76489AN
- robot arm with 4 DC motors
- 12+12 leds, 8*8 magnet sensors, printer port
See patent US4398720 for a more detailed description of the hardware.
Newer versions sold in West Germany were marketed as 7.5MHz, but it's not known
if it's really an overclock, or maybe they just removed waitstates.
On the left and right of the chessboard are designated spots for captured pieces,
no magnet sensors underneath. The user is not required to place pieces there, but
the chesscomputer will give an error when it tries to take a piece from there
(eg. with trace back, review, or when it cleans up after the game has finished).
In MAME, the claw position is shown with a small dot, opaque means it's open.
After the CPU's move, wait until the claw is closed before inputting new move.
TODO:
- it becomes unresponsive when pressing certain keys right after the user lost,
like Trace Back, possibly BTANB?
- Z80 waitstates according to patent
*******************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/clock.h"
#include "machine/nvram.h"
#include "machine/sensorboard.h"
#include "machine/timer.h"
#include "sound/sn76496.h"
#include "video/pwm.h"
#include "speaker.h"
// internal artwork
#include "novag_robotadv.lh"
namespace {
class robotadv_state : public driver_device
{
public:
robotadv_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_display(*this, "display"),
m_board(*this, "board"),
m_sn(*this, "sn"),
m_inputs(*this, "IN.%u", 0),
m_piece_hand(*this, "cpu_hand"),
m_out_motor(*this, "motor%u", 0U),
m_out_clawx(*this, "clawx%u", 0U),
m_out_clawy(*this, "clawy")
{ }
void robotadv(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
required_device<cpu_device> m_maincpu;
required_device<pwm_display_device> m_display;
required_device<sensorboard_device> m_board;
required_device<sn76489a_device> m_sn;
required_ioport_array<3> m_inputs;
output_finder<> m_piece_hand;
output_finder<6> m_out_motor;
output_finder<2> m_out_clawx;
output_finder<> m_out_clawy;
void main_map(address_map &map);
void io_map(address_map &map);
void control1_w(u8 data);
void control2_w(u8 data);
void latch_w(u8 data);
u8 limits_r();
u8 input_r();
u8 counters_r();
TIMER_DEVICE_CALLBACK_MEMBER(refresh_timer) { refresh(); }
void refresh();
void update_counters();
void update_limits();
void update_clawpos(double *x, double *y);
void update_piece(double x, double y);
u8 m_control1 = 0;
u8 m_control2 = 0;
u8 m_latch = 0;
u8 m_motor_on = 0;
u8 m_motor_dir = 0;
u8 m_limits = 0;
s32 m_counter[4] = { };
attotime m_pwm_accum[4];
attotime m_pwm_last;
};
void robotadv_state::machine_start()
{
// resolve outputs
m_piece_hand.resolve();
m_out_motor.resolve();
m_out_clawx.resolve();
m_out_clawy.resolve();
// register for savestates
save_item(NAME(m_control1));
save_item(NAME(m_control2));
save_item(NAME(m_latch));
save_item(NAME(m_motor_on));
save_item(NAME(m_motor_dir));
save_item(NAME(m_limits));
save_item(NAME(m_counter));
save_item(NAME(m_pwm_accum));
save_item(NAME(m_pwm_last));
}
void robotadv_state::machine_reset()
{
m_piece_hand = 0;
refresh();
}
/*******************************************************************************
Motor Sim
*******************************************************************************/
void robotadv_state::update_counters()
{
attotime now = machine().time();
attotime delta = now - m_pwm_last;
m_pwm_last = now;
for (int i = 0; i < 4; i++)
{
if (BIT(m_motor_on, i))
{
m_pwm_accum[i] += delta;
// increment counters per 1us
const u32 freq = 1'000'000;
u64 ticks = m_pwm_accum[i].as_ticks(freq);
m_pwm_accum[i] -= attotime::from_ticks(ticks, freq);
if (BIT(m_motor_dir, i))
m_counter[i] -= ticks;
else
m_counter[i] += ticks;
}
}
}
void robotadv_state::update_limits()
{
m_limits = 0;
// claw and forearm lever
const u32 range[2] = { 300'000, 2'000'000 };
for (int i = 0; i < 2; i++)
{
m_counter[i] %= range[i];
if (m_counter[i] > range[i] / 2)
m_limits |= 1 << i;
}
// forearm rotation
if (m_counter[2] <= 0)
{
m_counter[2] = 0;
m_limits |= 4;
}
// upper arm rotation
if (m_counter[3] >= 0)
m_limits |= 8;
}
void robotadv_state::update_clawpos(double *x, double *y)
{
double r, d, a;
// upper arm
r = 5.43;
d = m_counter[3] / 12670.0;
a = d * (M_PI / 180.0) + M_PI;
*x = r * cos(a);
*y = r * sin(a);
// elbow (home position is at a slight angle)
r = 1.07;
d = m_counter[2] / 14730.0 + 8.8;
a += d * (M_PI / 180.0) + (1.5 * M_PI);
*x += r * cos(a);
*y += r * sin(a);
// forearm is perpendicular to elbow
r = 5.62;
a += 1.5 * M_PI;
*x += r * cos(a);
*y += r * sin(a);
}
void robotadv_state::update_piece(double x, double y)
{
// convert claw x/y to sensorboard x/y (1.0 = 1 square)
int bx = -1, by = 0;
// chessboard
x += 4.0;
y -= 2.1;
if (x >= 0.0 && x < 8.0 && y >= 0.0 && y < 8.0)
{
bx = x;
by = y;
}
// left edge
x += 2.4;
y += 1.0;
if (x >= 0.0 && x < 2.0 && y >= 0.0 && y < 8.0)
{
bx = x + 8;
by = y;
}
// right edge
x -= 10.8;
if (x >= 0.0 && x < 2.0 && y >= 0.0 && y < 8.0)
{
bx = x + 10;
by = y;
}
by = 7 - by;
if (m_limits & 1)
{
// open empty claw
if (m_piece_hand == 0)
return;
// drop piece to invalid position (shouldn't happen)
else if (bx == -1)
popmessage("Invalid piece drop!");
// collision with piece on board (user interference)
else if (m_board->read_piece(bx, by) != 0)
popmessage("Collision at %c%d!", bx + 'A', by + 1);
else
{
m_board->write_piece(bx, by, m_piece_hand);
m_board->refresh();
}
m_piece_hand = 0;
}
else
{
// close claw while forearm is raised, or at invalid position
if (~m_limits & 2 || bx == -1)
return;
// pick up piece, unless it was picked up by the user
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();
}
}
}
void robotadv_state::refresh()
{
if (machine().side_effects_disabled())
return;
update_counters();
u8 limits_prev = m_limits;
update_limits();
double x, y;
update_clawpos(&x, &y);
// claw opened or closed
if ((m_limits ^ limits_prev) & 1)
update_piece(x, y);
// output claw position
int open = m_limits & 1;
m_out_clawx[open ^ 1] = 1500; // hide
m_out_clawx[open] = int((x + 15.0) * 50.0);
m_out_clawy = int((y + 15.0) * 50.0);
}
/*******************************************************************************
I/O
*******************************************************************************/
void robotadv_state::control1_w(u8 data)
{
// d0 falling edge: write sound
if (~data & m_control1 & 1)
m_sn->write(m_latch);
// d1: ?
// d2,d3: chess clock peripheral?
// d5,d7: arm motor on
refresh();
m_motor_on = (m_motor_on & ~0xc) | (bitswap<2>(data,7,5) << 2);
// d4,d6: arm motor direction
m_motor_dir = (m_motor_dir & ~0xc) | (bitswap<2>(data,6,4) << 2);
// reverse accum if direction changed
if ((data ^ m_control1) & 0x10)
m_pwm_accum[2] = attotime::from_usec(1) - m_pwm_accum[2];
if ((data ^ m_control1) & 0x40)
m_pwm_accum[3] = attotime::from_usec(1) - m_pwm_accum[3];
for (int i = 0; i < 4; i++)
m_out_motor[i + 2] = BIT(data, i + 4);
m_control1 = data;
}
void robotadv_state::control2_w(u8 data)
{
// d0,d1: claw/lever motor on
refresh();
m_motor_on = (m_motor_on & ~3) | (data & 3);
for (int i = 0; i < 2; i++)
m_out_motor[i] = BIT(data, i);
// d2-d4: keypad mux
// d5-d7: led select
m_display->write_my(data >> 5);
m_control2 = data;
}
void robotadv_state::latch_w(u8 data)
{
// d0-d7: led data, sound data, chessboard mux
m_display->write_mx(data);
m_latch = data;
}
u8 robotadv_state::limits_r()
{
// d0: ?
// d1-d4: limit switches
// d5-d7: printer
refresh();
return m_limits << 1;
}
u8 robotadv_state::input_r()
{
u8 data = 0;
// read chessboard
if (m_latch)
{
refresh();
for (int i = 0; i < 8; i++)
{
if (BIT(m_latch, i))
data |= m_board->read_file(i, true);
}
}
// read keypad
for (int i = 0; i < 3; i++)
if (BIT(m_control2 >> 2, i))
data |= m_inputs[i]->read();
return ~data;
}
u8 robotadv_state::counters_r()
{
// arm motors optical sensors to cd4029 counters
refresh();
const int ratio = 300; // around 1 count per 300us
u8 c2 = (m_counter[2] / ratio) & 0xf;
u8 c3 = (m_counter[3] / ratio) & 0xf;
return c2 << 4 | c3;
}
/*******************************************************************************
Address Maps
*******************************************************************************/
void robotadv_state::main_map(address_map &map)
{
map(0x0000, 0x5fff).rom();
map(0x8000, 0xbfff).rom();
map(0xc000, 0xcfff).ram();
map(0xd400, 0xd7ff).ram().share("nvram");
}
void robotadv_state::io_map(address_map &map)
{
map.global_mask(0xff);
map(0xc0, 0xc0).w(FUNC(robotadv_state::control1_w));
map(0xc1, 0xc1).w(FUNC(robotadv_state::control2_w));
map(0xc2, 0xc2).nopw(); // printer
map(0xc3, 0xc3).r(FUNC(robotadv_state::limits_r));
map(0xc4, 0xc4).w(FUNC(robotadv_state::latch_w));
map(0xc5, 0xc5).nopw(); // printer
map(0xc6, 0xc6).r(FUNC(robotadv_state::input_r));
map(0xc7, 0xc7).r(FUNC(robotadv_state::counters_r));
}
/*******************************************************************************
Input Ports
*******************************************************************************/
static INPUT_PORTS_START( robotadv )
PORT_START("IN.0")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Trace Forward")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Verify")
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Change Color")
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Review")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Return")
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Hint")
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Level")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Go")
PORT_START("IN.1")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Print List")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Sound")
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Solve Mate")
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Print Board")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Best Move")
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Promote")
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Set Up")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Trace Back")
PORT_START("IN.2")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Demo Program")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("New Game")
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Auto Play")
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Test")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Form Size")
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Classic Game")
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Emotions")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Print Moves")
INPUT_PORTS_END
/*******************************************************************************
Machine Configs
*******************************************************************************/
void robotadv_state::robotadv(machine_config &config)
{
// basic machine hardware
Z80(config, m_maincpu, 6_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &robotadv_state::main_map);
m_maincpu->set_addrmap(AS_IO, &robotadv_state::io_map);
auto &irq_clock(CLOCK(config, "irq_clock", 1200)); // approximation, from 555 timer with VR
irq_clock.set_pulse_width(attotime::from_usec(10)); // guessed
irq_clock.signal_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
TIMER(config, "refresh_timer").configure_periodic(FUNC(robotadv_state::refresh_timer), attotime::from_hz(60));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
SENSORBOARD(config, m_board).set_type(sensorboard_device::MAGNETS);
m_board->set_size(8+4, 8);
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(150));
m_board->set_nvram_enable(true);
// video hardware
PWM_DISPLAY(config, m_display).set_size(3, 8);
config.set_default_layout(layout_novag_robotadv);
// sound hardware
SPEAKER(config, "speaker").front_center();
SN76489A(config, m_sn, 6_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "speaker", 1.0);
}
/*******************************************************************************
ROM Definitions
*******************************************************************************/
ROM_START( robotadv )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD("mk37029n-5_brown.u5", 0x0000, 0x2000, CRC(04f8524c) SHA1(644a35ab53aaf641af799fab2ebc870a7f4d4535) ) // MK37000-5
ROM_LOAD("mk37030n-5_white.u6", 0x2000, 0x2000, CRC(d6db4cfb) SHA1(54ab3eee2cbc9604e793116144c129f372e4144e) ) // "
ROM_LOAD("mk37031n-5_blue.u8", 0x4000, 0x2000, CRC(ae1ead57) SHA1(13fcbd751efb478f0c4f08611388eaae60bba8bf) ) // "
ROM_LOAD("orange.u10", 0xa000, 0x2000, CRC(a90a2576) SHA1(9f91ca21477de3ebc668d3ec3a08842c5d19c5ec) ) // HN482764G
ROM_LOAD("u1", 0x8000, 0x0800, CRC(db6b2598) SHA1(1315c831d3a745a171fddc7ecb7a2d23d9acf4e8) ) // MSM2716AS (u1 has no label, confirmed with several pcbs)
ROM_LOAD("robep_2.u2", 0x8800, 0x0800, CRC(100d8a59) SHA1(b60656eee18f861b0bafedea8242afd319a8e9e3) ) // "
ROM_LOAD("robep_3.u3", 0x9000, 0x0800, CRC(1a0067db) SHA1(73527246847e14527b7fba0ef19aaa46650d15da) ) // "
ROM_LOAD("robep_4.u4", 0x9800, 0x0800, CRC(30dba023) SHA1(03a133ea454ee2f60890a51a77be57eadd9af9dd) ) // "
ROM_END
} // anonymous namespace
/*******************************************************************************
Drivers
*******************************************************************************/
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS
SYST( 1982, robotadv, 0, 0, robotadv, robotadv, robotadv_state, empty_init, "Novag", "Chess Robot Adversary", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL | MACHINE_IMPERFECT_CONTROLS )

View File

@ -5,8 +5,10 @@
Novag Savant, chess computer with touchscreen. It was followed by Savant II and
Savant Royale on the same hardware, the program is the same and they just added
a bigger opening book. Savant Royale was a German limited release overclock
version of Savant II. The chess engine is MyChess by David Kittinger.
a bigger opening book. The chess engine is MyChess by David Kittinger.
Like the 1984 version Chess Robot Adversary, Savant Royale was marketed as 7.5MHz,
but it's not known how they sped it up,
Hardware overview:
- Zilog Z80B @ 6MHz
@ -29,8 +31,8 @@ TODO:
#include "cpu/z80/z80.h"
#include "cpu/f8/f8.h"
#include "machine/f3853.h"
#include "machine/sensorboard.h"
#include "machine/nvram.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "video/hlcd0538.h"
#include "video/pwm.h"
@ -278,11 +280,11 @@ void savant_state::main_map(address_map &map)
void savant_state::main_io(address_map &map)
{
map(0xc0, 0xc0).mirror(0x0038).select(0xff00).rw(FUNC(savant_state::stall_r), FUNC(savant_state::stall_w));
map(0xc1, 0xc1).mirror(0xff38).unmapw(); // clock
map(0xc2, 0xc2).mirror(0xff38).unmapw(); // printer
map(0xc3, 0xc3).mirror(0xff38).unmapr(); // printer
map(0xc1, 0xc1).mirror(0xff38).nopw(); // clock
map(0xc2, 0xc2).mirror(0xff38).nopw(); // printer
map(0xc3, 0xc3).mirror(0xff38).nopr(); // printer
map(0xc4, 0xc4).mirror(0xff38).r(FUNC(savant_state::mcustatus_r));
map(0xc5, 0xc5).mirror(0xff38).unmapw(); // printer
map(0xc5, 0xc5).mirror(0xff38).nopw(); // printer
}
void savant_state::mcu_map(address_map &map)