mattelchess: add save switch (nw)

This commit is contained in:
hap 2019-05-06 21:01:31 +02:00
parent c202418093
commit 86eb8f5c71
3 changed files with 37 additions and 12 deletions

View File

@ -2,12 +2,16 @@
// copyright-holders:hap // copyright-holders:hap
/* /*
Hughes HLCD 0515 family LCD Driver Hughes HLCD 0515 family LCD Driver
0515: 25 columns(also size of buffer/ram) 0515: 25 columns(also size of buffer/ram)
0569: 24 columns, display blank has no effect(instead it's external with VDRIVE?) 0569: 24 columns, display blank has no effect(instead it's external with VDRIVE?)
0530: specifications unknown, pinout seems similar to 0569 0530: specifications unknown, pinout seems similar to 0569
0601: specifications unknown, pinout seems similar to 0569 0601: specifications unknown, pinout seems similar to 0569
TODO:
- Does DATA OUT pin function the same on each chip? The 0515 datasheet says that
the 25th column is output first, but on 0569(no datasheet available) it's reversed.
*/ */
@ -129,7 +133,7 @@ void hlcd0515_device::set_control()
if (m_control & 1) if (m_control & 1)
{ {
m_buffer = m_ram[m_rowsel]; m_buffer = m_ram[m_rowsel];
clock_data(-1); clock_data();
} }
else else
m_buffer = 0; m_buffer = 0;
@ -149,8 +153,7 @@ void hlcd0515_device::clock_data(int col)
m_dataout = m_buffer & 1; m_dataout = m_buffer & 1;
m_write_data(m_dataout); m_write_data(m_dataout);
if (col < m_colmax) m_buffer >>= 1;
m_buffer >>= 1;
} }
else else
{ {

View File

@ -63,7 +63,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void set_control(); virtual void set_control();
void clock_data(int col); void clock_data(int col = 0);
const u8 m_colmax; // number of column pins const u8 m_colmax; // number of column pins

View File

@ -11,7 +11,6 @@ Hardware notes:
- custom LCD screen with chess squares background - custom LCD screen with chess squares background
TODO: TODO:
- add SAVE switch
- internal artwork - internal artwork
******************************************************************************/ ******************************************************************************/
@ -37,19 +36,24 @@ public:
void mchess(machine_config &config); void mchess(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(reset_switch) { update_reset(newval); }
protected: protected:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override;
private: private:
// devices/pointers // devices/pointers
required_device<mcs48_cpu_device> m_maincpu; required_device<mcs48_cpu_device> m_maincpu;
required_device_array<hlcd0569_device, 2> m_lcd; required_device_array<hlcd0569_device, 2> m_lcd;
required_ioport_array<3> m_inputs; required_ioport_array<4> m_inputs;
output_finder<2, 8, 22> m_out_x; output_finder<2, 8, 22> m_out_x;
u8 m_inp_mux; u8 m_inp_mux;
u8 m_lcd_control; u8 m_lcd_control;
void update_reset(ioport_value state);
// I/O handlers // I/O handlers
template<int Sel> DECLARE_WRITE32_MEMBER(lcd_output_w); template<int Sel> DECLARE_WRITE32_MEMBER(lcd_output_w);
DECLARE_WRITE8_MEMBER(input_w); DECLARE_WRITE8_MEMBER(input_w);
@ -72,6 +76,19 @@ void mchess_state::machine_start()
save_item(NAME(m_lcd_control)); save_item(NAME(m_lcd_control));
} }
void mchess_state::machine_reset()
{
update_reset(m_inputs[3]->read());
}
void mchess_state::update_reset(ioport_value state)
{
// assume that SAVE switch powers off the CPU
// (at reboot, the game will read the chessboard positions from LCD RAM)
m_maincpu->set_input_line(INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
}
/****************************************************************************** /******************************************************************************
Devices, I/O Devices, I/O
@ -80,10 +97,12 @@ void mchess_state::machine_start()
template<int Sel> template<int Sel>
WRITE32_MEMBER(mchess_state::lcd_output_w) WRITE32_MEMBER(mchess_state::lcd_output_w)
{ {
int enabled = ~m_inputs[3]->read() & m_lcd_control & 1;
// output to x.y.z where x = chip, y = row, z = col // output to x.y.z where x = chip, y = row, z = col
// up to 22 columns used // up to 22 columns used
for (int i = 0; i < 22; i++) for (int i = 0; i < 22; i++)
m_out_x[Sel][offset][i] = BIT(data, i); m_out_x[Sel][offset][i] = BIT(data, i) & enabled;
} }
WRITE8_MEMBER(mchess_state::input_w) WRITE8_MEMBER(mchess_state::input_w)
@ -161,6 +180,9 @@ static INPUT_PORTS_START( mchess )
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Color") PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Color")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Take Back") PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Take Back")
PORT_START("IN.3")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, mchess_state, reset_switch, nullptr) PORT_NAME("Save Switch")
INPUT_PORTS_END INPUT_PORTS_END