smartboard: add support to connect it to pc printer port

This commit is contained in:
hap 2021-04-19 13:01:03 +02:00
parent 7dc0aab8df
commit 9194b83f3b
13 changed files with 228 additions and 102 deletions

View File

@ -2587,6 +2587,8 @@ if (BUSES["CENTRONICS"]~=null) then
MAME_DIR .. "src/devices/bus/centronics/comxpl80.h", MAME_DIR .. "src/devices/bus/centronics/comxpl80.h",
MAME_DIR .. "src/devices/bus/centronics/covox.cpp", MAME_DIR .. "src/devices/bus/centronics/covox.cpp",
MAME_DIR .. "src/devices/bus/centronics/covox.h", 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.cpp",
MAME_DIR .. "src/devices/bus/centronics/dsjoy.h", MAME_DIR .. "src/devices/bus/centronics/dsjoy.h",
MAME_DIR .. "src/devices/bus/centronics/epson_ex800.cpp", 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/nec_p72.h",
MAME_DIR .. "src/devices/bus/centronics/printer.cpp", MAME_DIR .. "src/devices/bus/centronics/printer.cpp",
MAME_DIR .. "src/devices/bus/centronics/printer.h", 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.cpp",
MAME_DIR .. "src/devices/bus/centronics/samdac.h", 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 { dependency {

View File

@ -3172,6 +3172,19 @@ if (MACHINES["T10"]~=null) then
} }
end 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 --@src/devices/machine/tc009xlvc.h,MACHINES["TC0091LVC"] = true

View File

@ -689,6 +689,7 @@ MACHINES["SPG290"] = true
MACHINES["STVCD"] = true MACHINES["STVCD"] = true
MACHINES["SUN4C_MMU"] = true MACHINES["SUN4C_MMU"] = true
MACHINES["SWTPC8212"] = true MACHINES["SWTPC8212"] = true
MACHINES["TASC_SB30"] = true
MACHINES["TC0091LVC"] = true MACHINES["TC0091LVC"] = true
MACHINES["TDC1008"] = true MACHINES["TDC1008"] = true
--MACHINES["TE7750"] = true --MACHINES["TE7750"] = true
@ -3860,8 +3861,6 @@ files {
createMESSProjects(_target, _subtarget, "tasc") createMESSProjects(_target, _subtarget, "tasc")
files { files {
MAME_DIR .. "src/mame/drivers/tasc.cpp", 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") createMESSProjects(_target, _subtarget, "tatung")

View File

@ -2,7 +2,7 @@
// copyright-holders:hap // 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 External module with ARM2 CPU, also sold under the Mephisto brand by H+G
see chessmachine_device for technical notes see chessmachine_device for technical notes
@ -13,7 +13,7 @@ see chessmachine_device for technical notes
#include "chessmec.h" #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 // constructor
@ -26,13 +26,11 @@ centronics_chessmec_device::centronics_chessmec_device(const machine_config &mco
{ } { }
//------------------------------------------------- //-------------------------------------------------
// device_add_mconfig - add device configuration // device_add_mconfig - add device configuration
//------------------------------------------------- //-------------------------------------------------
void centronics_chessmec_device::device_add_mconfig(machine_config &config) void centronics_chessmec_device::device_add_mconfig(machine_config &config)
{ {
CHESSMACHINE(config, m_chessm, 15'000'000); CHESSMACHINE(config, m_chessm, 15'000'000).data_out().set(FUNC(centronics_chessmec_device::output_busy));
m_chessm->data_out().set(FUNC(centronics_chessmec_device::output_busy));
} }

View File

@ -133,8 +133,9 @@ device_centronics_peripheral_interface::~device_centronics_peripheral_interface(
#include "nec_p72.h" #include "nec_p72.h"
#include "printer.h" #include "printer.h"
#include "covox.h" #include "covox.h"
#include "chessmec.h"
#include "samdac.h" #include "samdac.h"
#include "chessmec.h"
#include "smartboard.h"
void centronics_devices(device_slot_interface &device) 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("printer", CENTRONICS_PRINTER);
device.option_add("covox", CENTRONICS_COVOX); device.option_add("covox", CENTRONICS_COVOX);
device.option_add("covox_stereo", CENTRONICS_COVOX_STEREO); device.option_add("covox_stereo", CENTRONICS_COVOX_STEREO);
device.option_add("chessmec", CENTRONICS_CHESSMEC);
device.option_add("samdac", CENTRONICS_SAMDAC); device.option_add("samdac", CENTRONICS_SAMDAC);
device.option_add("chessmec", CENTRONICS_CHESSMEC);
device.option_add("smartboard", CENTRONICS_SMARTBOARD);
} }

View File

@ -1,7 +1,7 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Barry Rodewald // copyright-holders:Barry Rodewald
/* /*
* digiblst.c * digiblst.cpp
* *
* Created on: 23/08/2014 * Created on: 23/08/2014
*/ */
@ -11,7 +11,7 @@
#include "speaker.h" #include "speaker.h"
//************************************************************************** //**************************************************************************
// COVOX DEVICE // DIGIBLASTER DEVICE
//************************************************************************** //**************************************************************************
// device type definition // device type definition
@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE(CENTRONICS_DIGIBLASTER, centronics_digiblaster_device, "digib
IMPLEMENTATION 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) centronics_digiblaster_device::centronics_digiblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)

View File

@ -20,7 +20,7 @@
#include "ctronics.h" #include "ctronics.h"
#include "sound/dac.h" #include "sound/dac.h"
// ======================> centronics_covox_device // ======================> centronics_digiblaster_device
class centronics_digiblaster_device : public device_t, class centronics_digiblaster_device : public device_t,
public device_centronics_peripheral_interface public device_centronics_peripheral_interface

View File

@ -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));
}

View File

@ -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

View File

@ -1,15 +1,17 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Sandro Ronco // copyright-holders:Sandro Ronco, hap
/****************************************************************************** /******************************************************************************
Tasc SmartBoard Tasc SmartBoard SB30
SB30 (81 LEDs) is "SmartBoard I" Chessboard controller for use with Tasc R30 chesscomputer, or as PC peripheral.
SB20 (64 LEDs) is "SmartBoard II"
The SmartBoard can detect which piece is present on a specific square, more SB30 (81 LEDs) is "SmartBoard I"
info on the technology used in the piece recognition system can be found in SB20 (64 LEDs) is "SmartBoard II"
the US patent 5,129,654
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) 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) : device_t(mconfig, TASC_SB30, tag, owner, clock)
, m_board(*this, "board") , 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() void tasc_sb30_device::device_start()
{ {
m_led_out.resolve();
if (m_led_out.isnull())
m_out_leds.resolve(); m_out_leds.resolve();
save_item(NAME(m_data)); m_data_out.resolve_safe();
save_item(NAME(m_position));
std::fill(std::begin(m_squares), std::end(m_squares), 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_shift));
} save_item(NAME(m_squares));
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void tasc_sb30_device::device_reset()
{
m_data = 0;
m_position = 0;
m_shift = 0;
} }
@ -163,6 +165,8 @@ u8 tasc_sb30_device::spawn_cb(offs_t offset)
{ {
int piece_id = 0; 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) switch (offset)
{ {
case 1+0: case 1+0:
@ -257,49 +261,75 @@ u8 tasc_sb30_device::spawn_cb(offs_t offset)
// I/O handlers // 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; m_pos = 0;
int y = 7 - m_position % 8; update_output();
int piece_id = m_board->read_sensor(x, y);
// 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);
return BIT(sb30_id, m_shift & 0x1f);
} }
return 0; m_reset = state;
} }
void tasc_sb30_device::write(u8 data) void tasc_sb30_device::data0_w(int state)
{ {
if (!BIT(data, 3) && BIT(m_data, 3)) state = state ? 1 : 0;
m_position = 0;
if (!BIT(data, 6) && BIT(m_data, 6)) if (!state && m_data0)
{ {
if (m_position < 0x40) if (m_pos < 0x40)
{ {
int x = m_position / 8; // output board led(s)
int y = m_position % 8; if (m_led_out.isnull())
m_out_leds[y][x] = BIT(data, 7); m_out_leds[m_pos & 7][m_pos >> 3] = m_data1;
else
m_led_out(m_pos, m_data1);
}
} }
m_shift = 0; m_data0 = state;
} }
if (!BIT(data, 7) && BIT(m_data, 7)) void tasc_sb30_device::data1_w(int state)
{
state = state ? 1 : 0;
if (!state && m_data1)
{ {
m_position++; m_pos++;
if (m_position == 0x40) if ((m_pos & 0x3f) == 0)
m_shift++; m_shift++;
if (m_data0)
{
m_shift = 0;
// start scan
scan_board();
} }
m_data = data; update_output();
}
m_data1 = state;
}
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;
}
}
void tasc_sb30_device::update_output()
{
m_output = BIT(m_squares[m_pos & 0x3f], m_shift & 0x1f);
m_data_out(m_output);
} }

View File

@ -1,10 +1,10 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Sandro Ronco // copyright-holders:Sandro Ronco, hap
/********************************************************************** /*
Tasc SmartBoard Tasc SmartBoard SB30
*********************************************************************/ */
#ifndef MAME_MACHINE_SMARTBOARD_H #ifndef MAME_MACHINE_SMARTBOARD_H
#define MAME_MACHINE_SMARTBOARD_H #define MAME_MACHINE_SMARTBOARD_H
@ -13,47 +13,52 @@
#include "machine/sensorboard.h" #include "machine/sensorboard.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> tasc_sb30_device
class tasc_sb30_device : public device_t class tasc_sb30_device : public device_t
{ {
public: public:
// construction/destruction
tasc_sb30_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); tasc_sb30_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
u8 read(); // configuration helpers
void write(u8 data); 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: protected:
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
virtual void device_reset() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
private: 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); bool piece_available(u8 id);
void init_cb(int state); void init_cb(int state);
u8 spawn_cb(offs_t offset); u8 spawn_cb(offs_t offset);
required_device<sensorboard_device> m_board; // i/o lines
output_finder<8,8> m_out_leds; int m_reset = 0;
int m_data0 = 0;
int m_data1 = 0;
int m_output = 0;
u8 m_data; // internal use
u32 m_position; u32 m_pos = 0;
u8 m_shift; u8 m_shift = 0;
u32 m_squares[64]; // board state
}; };
// device type definition
DECLARE_DEVICE_TYPE(TASC_SB30, tasc_sb30_device) DECLARE_DEVICE_TYPE(TASC_SB30, tasc_sb30_device)
#endif // MAME_MACHINE_SMARTBOARD_H #endif // MAME_MACHINE_SMARTBOARD_H

View File

@ -151,7 +151,7 @@ u32 tasc_state::input_r()
disable_bootrom_next(); disable_bootrom_next();
// read chessboard // read chessboard
u32 data = m_smartboard->read(); u32 data = m_smartboard->data_r();
// read keypad // read keypad
for (int i = 0; i < 4; i++) 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)) if (BIT(data, 27))
m_lcd->write(BIT(data, 26), data & 0xff); 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 else
{ {

View File

@ -325,12 +325,12 @@ license:CC0
<repeat count="8"> <repeat count="8">
<param name="y" start="0.5" increment="10" /> <param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" /> <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>
<repeat count="8"> <repeat count="8">
<param name="y" start="10.5" increment="10" /> <param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" /> <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>
</repeat> </repeat>
@ -340,12 +340,12 @@ license:CC0
<repeat count="8"> <repeat count="8">
<param name="y" start="0.5" increment="10" /> <param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" /> <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>
<repeat count="8"> <repeat count="8">
<param name="y" start="10.5" increment="10" /> <param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" /> <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>
</repeat> </repeat>
</group> </group>