summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-05-06 21:01:31 +0200
committer hap <happppp@users.noreply.github.com>2019-05-06 21:01:52 +0200
commit86eb8f5c713154ecfaf5a9803d77302c2bee0a1a (patch)
treef887c2f4658a81d9a64ad9ee7202defdc8dd0ca5
parentc202418093141878f0db7041174522ff3b798d2e (diff)
mattelchess: add save switch (nw)
-rw-r--r--src/devices/video/hlcd0515.cpp19
-rw-r--r--src/devices/video/hlcd0515.h2
-rw-r--r--src/mame/drivers/mattelchess.cpp28
3 files changed, 37 insertions, 12 deletions
diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp
index eb34af3b78a..5a7f4e911e5 100644
--- a/src/devices/video/hlcd0515.cpp
+++ b/src/devices/video/hlcd0515.cpp
@@ -2,12 +2,16 @@
// copyright-holders:hap
/*
- Hughes HLCD 0515 family LCD Driver
+Hughes HLCD 0515 family LCD Driver
- 0515: 25 columns(also size of buffer/ram)
- 0569: 24 columns, display blank has no effect(instead it's external with VDRIVE?)
- 0530: specifications unknown, pinout seems similar to 0569
- 0601: specifications unknown, pinout seems similar to 0569
+0515: 25 columns(also size of buffer/ram)
+0569: 24 columns, display blank has no effect(instead it's external with VDRIVE?)
+0530: 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)
{
m_buffer = m_ram[m_rowsel];
- clock_data(-1);
+ clock_data();
}
else
m_buffer = 0;
@@ -149,8 +153,7 @@ void hlcd0515_device::clock_data(int col)
m_dataout = m_buffer & 1;
m_write_data(m_dataout);
- if (col < m_colmax)
- m_buffer >>= 1;
+ m_buffer >>= 1;
}
else
{
diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h
index af821eb8fcf..868621c90d2 100644
--- a/src/devices/video/hlcd0515.h
+++ b/src/devices/video/hlcd0515.h
@@ -63,7 +63,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void set_control();
- void clock_data(int col);
+ void clock_data(int col = 0);
const u8 m_colmax; // number of column pins
diff --git a/src/mame/drivers/mattelchess.cpp b/src/mame/drivers/mattelchess.cpp
index 3da0a4bde70..5a8ec04460e 100644
--- a/src/mame/drivers/mattelchess.cpp
+++ b/src/mame/drivers/mattelchess.cpp
@@ -11,7 +11,6 @@ Hardware notes:
- custom LCD screen with chess squares background
TODO:
-- add SAVE switch
- internal artwork
******************************************************************************/
@@ -37,19 +36,24 @@ public:
void mchess(machine_config &config);
+ DECLARE_INPUT_CHANGED_MEMBER(reset_switch) { update_reset(newval); }
+
protected:
virtual void machine_start() override;
+ virtual void machine_reset() override;
private:
// devices/pointers
required_device<mcs48_cpu_device> m_maincpu;
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;
u8 m_inp_mux;
u8 m_lcd_control;
+ void update_reset(ioport_value state);
+
// I/O handlers
template<int Sel> DECLARE_WRITE32_MEMBER(lcd_output_w);
DECLARE_WRITE8_MEMBER(input_w);
@@ -72,6 +76,19 @@ void mchess_state::machine_start()
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
@@ -80,10 +97,12 @@ void mchess_state::machine_start()
template<int Sel>
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
// up to 22 columns used
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)
@@ -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(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_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