phantom: add motor position to internal artwork

This commit is contained in:
hap 2022-02-23 01:18:29 +01:00
parent 2927916c60
commit d6c23c82b2
5 changed files with 128 additions and 102 deletions

View File

@ -59,6 +59,7 @@ public:
// handle pieces
void cancel_hand();
void remove_hand();
int get_handpos() { return m_handpos; }
bool drop_piece(u8 x, u8 y);
bool pickup_piece(u8 x, u8 y);

View File

@ -25,15 +25,18 @@ daughterboard, the housing is the same as model 6100, except for button labels.
Model 6126 has a dedicated PCB, this version also has a motion sensor at the front
and 2 leds to mimick eyes, and the housing color theme is green instead of beige.
To play, wait until the motor is finished before making a move. At boot-up, the
computer will do a self-test.
After the player captures a piece, select the captured piece from the MAME sensorboard
spawn block and place it at the designated box at the edge of the chessboard.
At boot-up, the computer will do a self-test, the user can start playing after the
motor has moved to the upper-right corner. The computer will continue positioning
pieces though, so it may be a bit distracting. Or, just hold INSERT (on PC) for a
while to speed up MAME before starting a new game.
After the user captures a piece, select the captured piece from the MAME sensorboard
spawn block and place it anywhere on a free spot at the designated box at the
edge of the chessboard.
TODO:
- sensorboard undo buffer goes out of control, probably not worth solving this issue
- cphantom artwork should be green instead of beige
- motor position in artwork?
BTANB:
- cphantom: As the manual suggests, the computer's move should be displayed on the
@ -73,7 +76,9 @@ public:
m_board(*this, "board"),
m_display(*this, "display"),
m_inputs(*this, "IN.%u", 0),
m_out_motor(*this, "motor.%u", 0U)
m_out_motor(*this, "motor.%u", 0U),
m_out_motorx(*this, "motorx%u", 0U),
m_out_motory(*this, "motory")
{ }
void phantom(machine_config &config);
@ -91,6 +96,8 @@ protected:
required_device<pwm_display_device> m_display;
optional_ioport_array<2> m_inputs;
output_finder<5> m_out_motor;
output_finder<2> m_out_motorx;
output_finder<> m_out_motory;
// address maps
virtual void main_map(address_map &map);
@ -123,13 +130,14 @@ protected:
bool m_hmotor_sensor0_ff;
bool m_hmotor_sensor1_ff;
int m_piece;
bool m_piece_collision;
u8 m_pieces_map[0x40][0x40];
};
void phantom_state::machine_start()
{
m_out_motor.resolve();
m_out_motorx.resolve();
m_out_motory.resolve();
// register for savestates
save_item(NAME(m_mux));
@ -143,7 +151,6 @@ void phantom_state::machine_start()
save_item(NAME(m_hmotor_sensor0_ff));
save_item(NAME(m_hmotor_sensor1_ff));
save_item(NAME(m_piece));
save_item(NAME(m_piece_collision));
save_item(NAME(m_pieces_map));
}
@ -215,7 +222,6 @@ void phantom_state::init_motors()
m_hmotor_sensor0_ff = false;
m_hmotor_sensor1_ff = false;
m_piece = 0;
m_piece_collision = false;
memset(m_pieces_map, 0, sizeof(m_pieces_map));
}
@ -244,6 +250,12 @@ 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;
}
void phantom_state::update_pieces_position(int state)
@ -260,26 +272,30 @@ void phantom_state::update_pieces_position(int state)
if (state)
{
if (m_piece_collision)
m_piece_collision = valid_pos = false;
if (valid_pos)
{
m_piece = m_board->read_piece(x, y);
m_board->write_piece(x, y, 0);
// check if piece was picked up by user
int pos = (y << 4 & 0xf0) | (x & 0x0f);
if (pos == m_board->get_handpos())
m_piece = 0;
else
m_piece = m_board->read_piece(x, y);
if (m_piece != 0)
m_board->write_piece(x, y, 0);
}
else
m_piece = m_pieces_map[m_vmotor_pos / 4][m_hmotor_pos / 4];
m_pieces_map[m_vmotor_pos / 4][m_hmotor_pos / 4] = 0;
}
else
else if (m_piece != 0)
{
// check for pieces collisions
if (valid_pos && m_board->read_piece(x, y) != 0)
{
valid_pos = false;
m_piece_collision = true;
logerror("Chesspiece collision at %C%d\n", x + 'A', y + 1);
}
if (valid_pos)
@ -551,7 +567,7 @@ void phantom_state::phantom(machine_config &config)
const attotime irq_period = attotime::from_hz(4.9152_MHz_XTAL / 0x2000); // 4060, 600Hz
m_maincpu->set_periodic_int(FUNC(phantom_state::irq0_line_assert), irq_period);
TIMER(config, "motors_timer").configure_periodic(FUNC(phantom_state::motors_timer), irq_period * 5);
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);

View File

@ -12326,7 +12326,8 @@ ROM_END
"Playmaker" is actually Tiger's trademark for the d-pad controller, this
controller term was also used in for example Deluxe Football, and 7 in 1 Sports
Stadium. The d-pad has a ball shape at the bottom that sits on a concave base.
Note that this was 2 years before Nintendo's d-pad invention.
It is patented under US4256931 (mid-1979, a couple of years before Nintendo's
Game & Watch d-pad with US4687200).
***************************************************************************/

View File

@ -7,7 +7,7 @@ license:CC0
<!-- define elements -->
<element name="black"><rect><color red="0.17" green="0.15" blue="0.15" /></rect></element>
<element name="blackb"><rect><color red="0" green="0" blue="0" /></rect></element>
<element name="redb"><rect><color red="0.81" green="0.3" blue="0.29" /></rect></element>
<element name="disk_black"><disk><color red="0.17" green="0.15" blue="0.15" /></disk></element>
<element name="disk_white"><disk><color red="0.99" green="0.99" blue="0.99" /></disk></element>
@ -38,6 +38,29 @@ license:CC0
</disk>
</element>
<element name="mpos0" defstate="0">
<rect>
<bounds x="0" y="0" width="256" height="2" />
<color alpha="0" />
</rect>
<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.35" />
</disk>
</element>
<element name="mpos1" defstate="0">
<rect>
<bounds x="0" y="0" width="256" height="2" />
<color alpha="0" />
</rect>
<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" />
</disk>
</element>
<element name="text_1">
<rect><color red="0.209" green="0.209" blue="0.201" /></rect>
<text string="1"><color red="0.843" green="0.678" blue="0.482" /></text>
@ -189,6 +212,7 @@ license:CC0
<element name="text_p5"> <image file="chess/wn.svg"/></element>
<element name="text_p6"> <image file="chess/wp.svg"/></element>
<!-- sb board -->
<element name="cblack"><rect><color red="0.209" green="0.209" blue="0.201" /></rect></element>
@ -403,6 +427,7 @@ license:CC0
</repeat>
</group>
<!-- sb ui -->
<element name="hlub" defstate="0">
@ -535,6 +560,9 @@ license:CC0
<element ref="text_uiu3b"><bounds x="4" y="75" width="2" height="2" /></element>
</group>
<!-- bottom panel -->
<group name="panel">
<bounds x="0" y="0" width="122" height="17" />
@ -635,8 +663,7 @@ license:CC0
<element ref="text_p6" ><bounds x="43.5" y="9.5" width="2.3" height="2.5" /></element>
<element name="0.7" ref="led" blend="multiply"><bounds x="43.5" y="9.5" width="2.3" height="2.5" /></element>
<!-- lcd panel -->
<!-- lcd screen -->
<element ref="cwhite"><bounds x="3.5" y="5" width="20.25" height="7.5" /></element>
<element ref="black"><bounds x="3.725" y="5.225" width="19.8" height="7.05" /></element>
<element ref="lcd_bg"><bounds x="4.625" y="6.125" width="18" height="5.25" /></element>
@ -654,42 +681,6 @@ license:CC0
<element name="4.7" ref="ldot"><bounds x="13.3925" y="9.2375" width="0.45" height="0.45" /></element>
</group>
<!-- motor status -->
<element name="text_motor"><text string="MOTOR:"><color red="0.843" green="0.678" blue="0.482" /></text></element>
<element name="text_motoru">
<text string="U" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="U" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motord">
<text string="D" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="D" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorl">
<text string="L" state="0" align="2"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="L" state="1" align="2"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorr">
<text string="R" state="0" align="1"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="R" state="1" align="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorx">
<text string="X" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="X" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<group name="motor">
<bounds x="0" y="0" width="10" height="12" />
<element ref="text_motor"><bounds x="0" y="0" width="10" height="2" /></element>
<element ref="cwhite"><bounds x="0" y="11" width="10" height="1" /></element>
<element name="motor.1" ref="text_motoru"><bounds x="0" y="3" width="10" height="2" /></element>
<element name="motor.2" ref="text_motorl"><bounds x="0" y="5" width="3.5" height="2" /></element>
<element name="motor.3" ref="text_motorr"><bounds x="6.5" y="5" width="3.5" height="2" /></element>
<element name="motor.4" ref="text_motorx"><bounds x="0" y="5" width="10" height="2" /></element>
<element name="motor.0" ref="text_motord"><bounds x="0" y="7" width="10" height="2" /></element>
</group>
<!-- build screen -->
@ -701,13 +692,26 @@ license:CC0
<element ref="cwhite"><bounds x="-0.5" y="3" width="81" height="81" /></element>
<group ref="sb_board"><bounds x="-20.5" y="3.5" width="121" height="80" /></group>
<group ref="sb_ui"><bounds x="-33" y="3" width="10" height="80" /></group>
<group ref="motor"><bounds x="-33" y="84.5" width="10" height="12" /></group>
<group ref="panel"><bounds x="-21" y="85" width="122" height="17" /></group>
<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">
<repeat count="2">
<param name="i" start="0" increment="1" />
<element name="motorx~i~" ref="mpos~i~">
<animate name="motory" />
<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>
</repeat>
<element ref="blackb"><bounds x="110" y="0" width="5" height="100" /></element>
</collection>
</view>
</mamelayout>

View File

@ -7,7 +7,7 @@ license:CC0
<!-- define elements -->
<element name="black"><rect><color red="0.17" green="0.15" blue="0.15" /></rect></element>
<element name="blackb"><rect><color red="0" green="0" blue="0" /></rect></element>
<element name="redb"><rect><color red="0.81" green="0.3" blue="0.29" /></rect></element>
<element name="disk_black"><disk><color red="0.17" green="0.15" blue="0.15" /></disk></element>
<element name="disk_white"><disk><color red="0.99" green="0.99" blue="0.99" /></disk></element>
@ -38,6 +38,29 @@ license:CC0
</disk>
</element>
<element name="mpos0" defstate="0">
<rect>
<bounds x="0" y="0" width="256" height="2" />
<color alpha="0" />
</rect>
<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.35" />
</disk>
</element>
<element name="mpos1" defstate="0">
<rect>
<bounds x="0" y="0" width="256" height="2" />
<color alpha="0" />
</rect>
<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" />
</disk>
</element>
<element name="text_1">
<rect><color red="0.209" green="0.209" blue="0.201" /></rect>
<text string="1"><color red="0.843" green="0.678" blue="0.482" /></text>
@ -189,6 +212,7 @@ license:CC0
<element name="text_p5"> <image file="chess/wn.svg"/></element>
<element name="text_p6"> <image file="chess/wp.svg"/></element>
<!-- sb board -->
<element name="cblack"><rect><color red="0.209" green="0.209" blue="0.201" /></rect></element>
@ -403,6 +427,7 @@ license:CC0
</repeat>
</group>
<!-- sb ui -->
<element name="hlub" defstate="0">
@ -535,6 +560,9 @@ license:CC0
<element ref="text_uiu3b"><bounds x="4" y="75" width="2" height="2" /></element>
</group>
<!-- bottom panel -->
<group name="panel">
<bounds x="0" y="0" width="122" height="17" />
@ -635,8 +663,7 @@ license:CC0
<element ref="text_p6" ><bounds x="43.5" y="9.5" width="2.3" height="2.5" /></element>
<element name="0.7" ref="led" blend="multiply"><bounds x="43.5" y="9.5" width="2.3" height="2.5" /></element>
<!-- lcd panel -->
<!-- lcd screen -->
<element ref="cwhite"><bounds x="3.5" y="5" width="20.25" height="7.5" /></element>
<element ref="black"><bounds x="3.725" y="5.225" width="19.8" height="7.05" /></element>
<element ref="lcd_bg"><bounds x="4.625" y="6.125" width="18" height="5.25" /></element>
@ -654,42 +681,6 @@ license:CC0
<element name="4.7" ref="ldot"><bounds x="13.3925" y="9.2375" width="0.45" height="0.45" /></element>
</group>
<!-- motor status -->
<element name="text_motor"><text string="MOTOR:"><color red="0.843" green="0.678" blue="0.482" /></text></element>
<element name="text_motoru">
<text string="U" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="U" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motord">
<text string="D" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="D" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorl">
<text string="L" state="0" align="2"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="L" state="1" align="2"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorr">
<text string="R" state="0" align="1"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="R" state="1" align="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<element name="text_motorx">
<text string="X" state="0"><color red="0.209" green="0.209" blue="0.201" /></text>
<text string="X" state="1"><color red="0.9" green="0.9" blue="0.85" /></text>
</element>
<group name="motor">
<bounds x="0" y="0" width="10" height="12" />
<element ref="text_motor"><bounds x="0" y="0" width="10" height="2" /></element>
<element ref="cwhite"><bounds x="0" y="11" width="10" height="1" /></element>
<element name="motor.1" ref="text_motoru"><bounds x="0" y="3" width="10" height="2" /></element>
<element name="motor.2" ref="text_motorl"><bounds x="0" y="5" width="3.5" height="2" /></element>
<element name="motor.3" ref="text_motorr"><bounds x="6.5" y="5" width="3.5" height="2" /></element>
<element name="motor.4" ref="text_motorx"><bounds x="0" y="5" width="10" height="2" /></element>
<element name="motor.0" ref="text_motord"><bounds x="0" y="7" width="10" height="2" /></element>
</group>
<!-- build screen -->
@ -701,10 +692,23 @@ license:CC0
<element ref="cwhite"><bounds x="-0.5" y="3" width="81" height="81" /></element>
<group ref="sb_board"><bounds x="-20.5" y="3.5" width="121" height="80" /></group>
<group ref="sb_ui"><bounds x="-33" y="3" width="10" height="80" /></group>
<group ref="motor"><bounds x="-33" y="84.5" width="10" height="12" /></group>
<group ref="panel"><bounds x="-21" y="85" width="122" height="17" /></group>
<!-- optional motor position overlay -->
<collection name="Motor Position">
<repeat count="2">
<param name="i" start="0" increment="1" />
<element name="motorx~i~" ref="mpos~i~">
<animate name="motory" />
<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>
</repeat>
<element ref="blackb"><bounds x="110" y="0" width="5" height="100" /></element>
</collection>
</view>
</mamelayout>