summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2021-04-19 13:01:03 +0200
committer hap <happppp@users.noreply.github.com>2021-04-19 13:01:19 +0200
commit9194b83f3b9b6977fda46c1d8142a7392218c7fc (patch)
tree45eb8b6403713feb2e64f0ff29d739c55211680f
parent7dc0aab8dfd5326aba222bdc0746b3f84eb05be9 (diff)
smartboard: add support to connect it to pc printer port
-rw-r--r--scripts/src/bus.lua6
-rw-r--r--scripts/src/machine.lua13
-rw-r--r--scripts/target/mame/mess.lua3
-rw-r--r--src/devices/bus/centronics/chessmec.cpp8
-rw-r--r--src/devices/bus/centronics/ctronics.cpp6
-rw-r--r--src/devices/bus/centronics/digiblst.cpp6
-rw-r--r--src/devices/bus/centronics/digiblst.h2
-rw-r--r--src/devices/bus/centronics/smartboard.cpp34
-rw-r--r--src/devices/bus/centronics/smartboard.h41
-rw-r--r--src/devices/machine/smartboard.cpp (renamed from src/mame/machine/smartboard.cpp)130
-rw-r--r--src/devices/machine/smartboard.h (renamed from src/mame/machine/smartboard.h)55
-rw-r--r--src/mame/drivers/tasc.cpp6
-rw-r--r--src/mame/layout/tascr30.lay8
13 files changed, 222 insertions, 96 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 34ffe693ee3..54a43cc5e12 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2587,6 +2587,8 @@ if (BUSES["CENTRONICS"]~=null) then
MAME_DIR .. "src/devices/bus/centronics/comxpl80.h",
MAME_DIR .. "src/devices/bus/centronics/covox.cpp",
MAME_DIR .. "src/devices/bus/centronics/covox.h",
+ MAME_DIR .. "src/devices/bus/centronics/digiblst.cpp",
+ MAME_DIR .. "src/devices/bus/centronics/digiblst.h",
MAME_DIR .. "src/devices/bus/centronics/dsjoy.cpp",
MAME_DIR .. "src/devices/bus/centronics/dsjoy.h",
MAME_DIR .. "src/devices/bus/centronics/epson_ex800.cpp",
@@ -2599,10 +2601,10 @@ if (BUSES["CENTRONICS"]~=null) then
MAME_DIR .. "src/devices/bus/centronics/nec_p72.h",
MAME_DIR .. "src/devices/bus/centronics/printer.cpp",
MAME_DIR .. "src/devices/bus/centronics/printer.h",
- MAME_DIR .. "src/devices/bus/centronics/digiblst.cpp",
- MAME_DIR .. "src/devices/bus/centronics/digiblst.h",
MAME_DIR .. "src/devices/bus/centronics/samdac.cpp",
MAME_DIR .. "src/devices/bus/centronics/samdac.h",
+ MAME_DIR .. "src/devices/bus/centronics/smartboard.cpp",
+ MAME_DIR .. "src/devices/bus/centronics/smartboard.h",
}
dependency {
diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua
index 599727b0980..5892219c2c9 100644
--- a/scripts/src/machine.lua
+++ b/scripts/src/machine.lua
@@ -3172,6 +3172,19 @@ if (MACHINES["T10"]~=null) then
}
end
+
+---------------------------------------------------
+--
+--@src/devices/machine/smartboard.h,MACHINES["TASC_SB30"] = true
+---------------------------------------------------
+
+if (MACHINES["TASC_SB30"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/machine/smartboard.cpp",
+ MAME_DIR .. "src/devices/machine/smartboard.h",
+ }
+end
+
---------------------------------------------------
--
--@src/devices/machine/tc009xlvc.h,MACHINES["TC0091LVC"] = true
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index deff32dce56..558a6e52c26 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -689,6 +689,7 @@ MACHINES["SPG290"] = true
MACHINES["STVCD"] = true
MACHINES["SUN4C_MMU"] = true
MACHINES["SWTPC8212"] = true
+MACHINES["TASC_SB30"] = true
MACHINES["TC0091LVC"] = true
MACHINES["TDC1008"] = true
--MACHINES["TE7750"] = true
@@ -3860,8 +3861,6 @@ files {
createMESSProjects(_target, _subtarget, "tasc")
files {
MAME_DIR .. "src/mame/drivers/tasc.cpp",
- MAME_DIR .. "src/mame/machine/smartboard.cpp",
- MAME_DIR .. "src/mame/machine/smartboard.h",
}
createMESSProjects(_target, _subtarget, "tatung")
diff --git a/src/devices/bus/centronics/chessmec.cpp b/src/devices/bus/centronics/chessmec.cpp
index dc61831a42c..fb30a7253b7 100644
--- a/src/devices/bus/centronics/chessmec.cpp
+++ b/src/devices/bus/centronics/chessmec.cpp
@@ -2,7 +2,7 @@
// copyright-holders:hap
/*
-The ChessMachine EC by Tasc
+The ChessMachine EC by Tasc (LPT interface)
External module with ARM2 CPU, also sold under the Mephisto brand by H+G
see chessmachine_device for technical notes
@@ -13,7 +13,7 @@ see chessmachine_device for technical notes
#include "chessmec.h"
-DEFINE_DEVICE_TYPE(CENTRONICS_CHESSMEC, centronics_chessmec_device, "centronics_chessmec", "The ChessMachine EC")
+DEFINE_DEVICE_TYPE(CENTRONICS_CHESSMEC, centronics_chessmec_device, "centronics_chessmec", "Tasc ChessMachine EC Interface")
//-------------------------------------------------
// constructor
@@ -26,13 +26,11 @@ centronics_chessmec_device::centronics_chessmec_device(const machine_config &mco
{ }
-
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void centronics_chessmec_device::device_add_mconfig(machine_config &config)
{
- CHESSMACHINE(config, m_chessm, 15'000'000);
- m_chessm->data_out().set(FUNC(centronics_chessmec_device::output_busy));
+ CHESSMACHINE(config, m_chessm, 15'000'000).data_out().set(FUNC(centronics_chessmec_device::output_busy));
}
diff --git a/src/devices/bus/centronics/ctronics.cpp b/src/devices/bus/centronics/ctronics.cpp
index eff7f7bd864..876e2cfcce4 100644
--- a/src/devices/bus/centronics/ctronics.cpp
+++ b/src/devices/bus/centronics/ctronics.cpp
@@ -133,8 +133,9 @@ device_centronics_peripheral_interface::~device_centronics_peripheral_interface(
#include "nec_p72.h"
#include "printer.h"
#include "covox.h"
-#include "chessmec.h"
#include "samdac.h"
+#include "chessmec.h"
+#include "smartboard.h"
void centronics_devices(device_slot_interface &device)
{
@@ -147,6 +148,7 @@ void centronics_devices(device_slot_interface &device)
device.option_add("printer", CENTRONICS_PRINTER);
device.option_add("covox", CENTRONICS_COVOX);
device.option_add("covox_stereo", CENTRONICS_COVOX_STEREO);
- device.option_add("chessmec", CENTRONICS_CHESSMEC);
device.option_add("samdac", CENTRONICS_SAMDAC);
+ device.option_add("chessmec", CENTRONICS_CHESSMEC);
+ device.option_add("smartboard", CENTRONICS_SMARTBOARD);
}
diff --git a/src/devices/bus/centronics/digiblst.cpp b/src/devices/bus/centronics/digiblst.cpp
index 76c2aee636a..af02c153653 100644
--- a/src/devices/bus/centronics/digiblst.cpp
+++ b/src/devices/bus/centronics/digiblst.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Barry Rodewald
/*
- * digiblst.c
+ * digiblst.cpp
*
* Created on: 23/08/2014
*/
@@ -11,7 +11,7 @@
#include "speaker.h"
//**************************************************************************
-// COVOX DEVICE
+// DIGIBLASTER DEVICE
//**************************************************************************
// device type definition
@@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE(CENTRONICS_DIGIBLASTER, centronics_digiblaster_device, "digib
IMPLEMENTATION
***************************************************************************/
//-------------------------------------------------
-// centronics_covox_device - constructor
+// centronics_digiblaster_device - constructor
//-------------------------------------------------
centronics_digiblaster_device::centronics_digiblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
diff --git a/src/devices/bus/centronics/digiblst.h b/src/devices/bus/centronics/digiblst.h
index d6c40cec78c..00a8246b802 100644
--- a/src/devices/bus/centronics/digiblst.h
+++ b/src/devices/bus/centronics/digiblst.h
@@ -20,7 +20,7 @@
#include "ctronics.h"
#include "sound/dac.h"
-// ======================> centronics_covox_device
+// ======================> centronics_digiblaster_device
class centronics_digiblaster_device : public device_t,
public device_centronics_peripheral_interface
diff --git a/src/devices/bus/centronics/smartboard.cpp b/src/devices/bus/centronics/smartboard.cpp
new file mode 100644
index 00000000000..6bef56724ab
--- /dev/null
+++ b/src/devices/bus/centronics/smartboard.cpp
@@ -0,0 +1,34 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/*
+
+Tasc SmartBoard SB30 (LPT interface)
+The actual chessboard controller device is in devices/machine/smartboard.*
+
+*/
+
+#include "emu.h"
+#include "smartboard.h"
+
+
+DEFINE_DEVICE_TYPE(CENTRONICS_SMARTBOARD, centronics_smartboard_device, "centronics_smartboard", "Tasc SmartBoard SB30 Interface")
+
+//-------------------------------------------------
+// constructor
+//-------------------------------------------------
+
+centronics_smartboard_device::centronics_smartboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CENTRONICS_SMARTBOARD, tag, owner, clock),
+ device_centronics_peripheral_interface(mconfig, *this),
+ m_sb30(*this, "sb30")
+{ }
+
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+void centronics_smartboard_device::device_add_mconfig(machine_config &config)
+{
+ TASC_SB30(config, m_sb30).data_out().set(FUNC(centronics_smartboard_device::output_busy));
+}
diff --git a/src/devices/bus/centronics/smartboard.h b/src/devices/bus/centronics/smartboard.h
new file mode 100644
index 00000000000..6ad21851495
--- /dev/null
+++ b/src/devices/bus/centronics/smartboard.h
@@ -0,0 +1,41 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/*
+
+ Tasc SmartBoard SB30 (LPT interface)
+
+*/
+
+#ifndef MAME_BUS_CENTRONICS_SMARTBOARD_H
+#define MAME_BUS_CENTRONICS_SMARTBOARD_H
+
+#pragma once
+
+#include "ctronics.h"
+#include "machine/smartboard.h"
+
+
+class centronics_smartboard_device : public device_t,
+ public device_centronics_peripheral_interface
+{
+public:
+ // construction/destruction
+ centronics_smartboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override { }
+ virtual void device_add_mconfig(machine_config &config) override;
+
+ virtual DECLARE_WRITE_LINE_MEMBER(input_data2) override { if (started()) m_sb30->reset_w(state); }
+ virtual DECLARE_WRITE_LINE_MEMBER(input_data0) override { if (started()) m_sb30->data0_w(state); }
+ virtual DECLARE_WRITE_LINE_MEMBER(input_data7) override { if (started()) m_sb30->data1_w(state); }
+
+private:
+ required_device<tasc_sb30_device> m_sb30;
+};
+
+
+DECLARE_DEVICE_TYPE(CENTRONICS_SMARTBOARD, centronics_smartboard_device)
+
+#endif // MAME_BUS_CENTRONICS_SMARTBOARD_H
diff --git a/src/mame/machine/smartboard.cpp b/src/devices/machine/smartboard.cpp
index e4cef490e4f..303317d888b 100644
--- a/src/mame/machine/smartboard.cpp
+++ b/src/devices/machine/smartboard.cpp
@@ -1,15 +1,17 @@
// license:BSD-3-Clause
-// copyright-holders:Sandro Ronco
+// copyright-holders:Sandro Ronco, hap
/******************************************************************************
- Tasc SmartBoard
+Tasc SmartBoard SB30
- SB30 (81 LEDs) is "SmartBoard I"
- SB20 (64 LEDs) is "SmartBoard II"
+Chessboard controller for use with Tasc R30 chesscomputer, or as PC peripheral.
- The SmartBoard can detect which piece is present on a specific square, more
- info on the technology used in the piece recognition system can be found in
- the US patent 5,129,654
+SB30 (81 LEDs) is "SmartBoard I"
+SB20 (64 LEDs) is "SmartBoard II"
+
+The SmartBoard can detect which piece is present on a specific square, more
+info on the technology used in the piece recognition system can be found in
+the US patent 5,129,654
******************************************************************************/
@@ -70,9 +72,10 @@ DEFINE_DEVICE_TYPE(TASC_SB30, tasc_sb30_device, "tasc_sb30", "Tasc SmartBoard SB
tasc_sb30_device::tasc_sb30_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, TASC_SB30, tag, owner, clock)
, m_board(*this, "board")
- , m_out_leds(*this, "led_%u%u", 0U, 0U)
-{
-}
+ , m_out_leds(*this, "sb30_led_%u.%u", 0U, 0U)
+ , m_data_out(*this)
+ , m_led_out(*this)
+{ }
//-------------------------------------------------
@@ -81,23 +84,22 @@ tasc_sb30_device::tasc_sb30_device(const machine_config &mconfig, const char *ta
void tasc_sb30_device::device_start()
{
- m_out_leds.resolve();
-
- save_item(NAME(m_data));
- save_item(NAME(m_position));
- save_item(NAME(m_shift));
-}
+ m_led_out.resolve();
+ if (m_led_out.isnull())
+ m_out_leds.resolve();
+ m_data_out.resolve_safe();
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
+ std::fill(std::begin(m_squares), std::end(m_squares), 0);
-void tasc_sb30_device::device_reset()
-{
- m_data = 0;
- m_position = 0;
- m_shift = 0;
+ // register for savestates
+ save_item(NAME(m_reset));
+ save_item(NAME(m_data0));
+ save_item(NAME(m_data1));
+ save_item(NAME(m_output));
+ save_item(NAME(m_pos));
+ save_item(NAME(m_shift));
+ save_item(NAME(m_squares));
}
@@ -163,6 +165,8 @@ u8 tasc_sb30_device::spawn_cb(offs_t offset)
{
int piece_id = 0;
+ // While most software works fine as long as color and piece type can be distinguished,
+ // each individual chesspiece is expected to have a unique id.
switch (offset)
{
case 1+0:
@@ -257,49 +261,75 @@ u8 tasc_sb30_device::spawn_cb(offs_t offset)
// I/O handlers
//-------------------------------------------------
-u8 tasc_sb30_device::read()
+void tasc_sb30_device::reset_w(int state)
{
- if (m_position < 0x40)
+ state = state ? 1 : 0;
+
+ if (!state && m_reset)
{
- int x = 7 - m_position / 8;
- int y = 7 - m_position % 8;
- int piece_id = m_board->read_sensor(x, y);
+ m_pos = 0;
+ update_output();
+ }
- // each piece is identified by a single bit in a 32-bit sequence, if multiple bits are active the MSB is used
- u32 sb30_id = 0;
- if (piece_id > 0)
- sb30_id = 1UL << (piece_id - 1);
+ m_reset = state;
+}
+
+void tasc_sb30_device::data0_w(int state)
+{
+ state = state ? 1 : 0;
- return BIT(sb30_id, m_shift & 0x1f);
+ if (!state && m_data0)
+ {
+ if (m_pos < 0x40)
+ {
+ // output board led(s)
+ if (m_led_out.isnull())
+ m_out_leds[m_pos & 7][m_pos >> 3] = m_data1;
+ else
+ m_led_out(m_pos, m_data1);
+ }
}
- return 0;
+ m_data0 = state;
}
-void tasc_sb30_device::write(u8 data)
+void tasc_sb30_device::data1_w(int state)
{
- if (!BIT(data, 3) && BIT(m_data, 3))
- m_position = 0;
+ state = state ? 1 : 0;
- if (!BIT(data, 6) && BIT(m_data, 6))
+ if (!state && m_data1)
{
- if (m_position < 0x40)
+ m_pos++;
+
+ if ((m_pos & 0x3f) == 0)
+ m_shift++;
+
+ if (m_data0)
{
- int x = m_position / 8;
- int y = m_position % 8;
- m_out_leds[y][x] = BIT(data, 7);
+ m_shift = 0;
+
+ // start scan
+ scan_board();
}
- m_shift = 0;
+ update_output();
}
- if (!BIT(data, 7) && BIT(m_data, 7))
- {
- m_position++;
+ m_data1 = state;
+}
- if (m_position == 0x40)
- m_shift++;
+void tasc_sb30_device::scan_board()
+{
+ for (int i = 0; i < 64; i++)
+ {
+ // each piece is identified by a single bit in a 32-bit sequence
+ int piece_id = m_board->read_sensor(i >> 3 ^ 7, ~i & 7);
+ m_squares[i] = piece_id ? (1 << (piece_id - 1)) : 0;
}
+}
- m_data = data;
+void tasc_sb30_device::update_output()
+{
+ m_output = BIT(m_squares[m_pos & 0x3f], m_shift & 0x1f);
+ m_data_out(m_output);
}
diff --git a/src/mame/machine/smartboard.h b/src/devices/machine/smartboard.h
index 0929aee885d..73237f2580c 100644
--- a/src/mame/machine/smartboard.h
+++ b/src/devices/machine/smartboard.h
@@ -1,10 +1,10 @@
// license:BSD-3-Clause
-// copyright-holders:Sandro Ronco
-/**********************************************************************
+// copyright-holders:Sandro Ronco, hap
+/*
- Tasc SmartBoard
+ Tasc SmartBoard SB30
-*********************************************************************/
+*/
#ifndef MAME_MACHINE_SMARTBOARD_H
#define MAME_MACHINE_SMARTBOARD_H
@@ -13,47 +13,52 @@
#include "machine/sensorboard.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// ======================> tasc_sb30_device
-
class tasc_sb30_device : public device_t
{
public:
- // construction/destruction
tasc_sb30_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
- u8 read();
- void write(u8 data);
+ // configuration helpers
+ auto data_out() { return m_data_out.bind(); } // data_r
+ auto led_out() { return m_led_out.bind(); } // optional, outputs to sb30_ledy.x when not used
+
+ // external read/write lines
+ void reset_w(int state);
+ void data0_w(int state);
+ void data1_w(int state);
+ int data_r() { return m_output; }
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_reset() override;
-
- // optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
private:
- void out_led(int pos);
+ required_device<sensorboard_device> m_board;
+ output_finder<8,8> m_out_leds;
+
+ devcb_write_line m_data_out;
+ devcb_write8 m_led_out;
+
+ void scan_board();
+ void update_output();
bool piece_available(u8 id);
void init_cb(int state);
u8 spawn_cb(offs_t offset);
- required_device<sensorboard_device> m_board;
- output_finder<8,8> m_out_leds;
+ // i/o lines
+ int m_reset = 0;
+ int m_data0 = 0;
+ int m_data1 = 0;
+ int m_output = 0;
- u8 m_data;
- u32 m_position;
- u8 m_shift;
+ // internal use
+ u32 m_pos = 0;
+ u8 m_shift = 0;
+ u32 m_squares[64]; // board state
};
-// device type definition
DECLARE_DEVICE_TYPE(TASC_SB30, tasc_sb30_device)
-
#endif // MAME_MACHINE_SMARTBOARD_H
diff --git a/src/mame/drivers/tasc.cpp b/src/mame/drivers/tasc.cpp
index 04b87f0c62d..ea3d37cca41 100644
--- a/src/mame/drivers/tasc.cpp
+++ b/src/mame/drivers/tasc.cpp
@@ -151,7 +151,7 @@ u32 tasc_state::input_r()
disable_bootrom_next();
// read chessboard
- u32 data = m_smartboard->read();
+ u32 data = m_smartboard->data_r();
// read keypad
for (int i = 0; i < 4; i++)
@@ -170,7 +170,9 @@ void tasc_state::control_w(offs_t offset, u32 data, u32 mem_mask)
if (BIT(data, 27))
m_lcd->write(BIT(data, 26), data & 0xff);
- m_smartboard->write((data >> 24) & 0xff);
+ m_smartboard->reset_w(BIT(data, 27));
+ m_smartboard->data0_w(BIT(data, 30));
+ m_smartboard->data1_w(BIT(data, 31));
}
else
{
diff --git a/src/mame/layout/tascr30.lay b/src/mame/layout/tascr30.lay
index 43fa703d1d4..4d8cdd95447 100644
--- a/src/mame/layout/tascr30.lay
+++ b/src/mame/layout/tascr30.lay
@@ -325,12 +325,12 @@ license:CC0
<repeat count="8">
<param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" />
- <element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
+ <element name="sb30_led_~j~.~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
<repeat count="8">
<param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" />
- <element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
+ <element name="sb30_led_~j~.~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
</repeat>
@@ -340,12 +340,12 @@ license:CC0
<repeat count="8">
<param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" />
- <element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
+ <element name="sb30_led_~j~.~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
<repeat count="8">
<param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" />
- <element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
+ <element name="sb30_led_~j~.~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
</repeat>
</group>