summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-06-27 01:37:40 +0200
committer hap <happppp@users.noreply.github.com>2019-06-27 01:37:55 +0200
commit60924e122283d734f63519196f6bb743de28caad (patch)
treeec74b0fd46063b8cb7f52e3d2d6bedd4ddde0817 /src/devices
parentffe04a3f0801b3a90db471e79cb1f2ed8413bcfa (diff)
New not working machine added
------------- Savant [hap, Berger, Sean Riddle]
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/machine/f3853.cpp18
-rw-r--r--src/devices/machine/f3853.h1
-rw-r--r--src/devices/machine/sensorboard.cpp50
-rw-r--r--src/devices/machine/sensorboard.h10
-rw-r--r--src/devices/video/hlcd0538.h2
5 files changed, 45 insertions, 36 deletions
diff --git a/src/devices/machine/f3853.cpp b/src/devices/machine/f3853.cpp
index 29be4c38823..7a23f5a04d0 100644
--- a/src/devices/machine/f3853.cpp
+++ b/src/devices/machine/f3853.cpp
@@ -50,7 +50,7 @@ f3853_device::f3853_device(const machine_config &mconfig, device_type type, cons
m_int_vector(0),
m_prescaler(31),
m_priority_line(false),
- m_external_interrupt_line(true)
+ m_external_interrupt_line(false)
{ }
f3853_device::f3853_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
@@ -210,7 +210,7 @@ TIMER_CALLBACK_MEMBER(f3853_device::timer_callback)
WRITE_LINE_MEMBER(f3853_device::ext_int_w)
{
- if (m_external_interrupt_line && !state && m_external_int_enable)
+ if (!m_external_interrupt_line && state && m_external_int_enable)
{
m_request_flipflop = true;
}
@@ -387,6 +387,20 @@ WRITE8_MEMBER(f3856_device::write)
// f38t56_device-specific handlers
//-------------------------------------------------
+READ8_MEMBER(f38t56_device::read)
+{
+ switch (offset & 3)
+ {
+ // interrupt: sense ext int pin
+ case 2:
+ return (m_external_interrupt_line) ? 0 : 0x80;
+
+ // other: same as 3856
+ default:
+ return f3856_device::read(space, offset);
+ }
+}
+
WRITE8_MEMBER(f38t56_device::write)
{
switch (offset & 3)
diff --git a/src/devices/machine/f3853.h b/src/devices/machine/f3853.h
index 762f46950fb..48d0543dfec 100644
--- a/src/devices/machine/f3853.h
+++ b/src/devices/machine/f3853.h
@@ -169,6 +169,7 @@ class f38t56_device : public f3856_device
public:
f38t56_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ virtual DECLARE_READ8_MEMBER(read) override;
virtual DECLARE_WRITE8_MEMBER(write) override;
};
diff --git a/src/devices/machine/sensorboard.cpp b/src/devices/machine/sensorboard.cpp
index 784041f957b..b2106665aaf 100644
--- a/src/devices/machine/sensorboard.cpp
+++ b/src/devices/machine/sensorboard.cpp
@@ -51,7 +51,6 @@ sensorboard_device::sensorboard_device(const machine_config &mconfig, const char
m_custom_spawn_cb(*this),
m_custom_output_cb(*this)
{
- memset(m_inistate, 0, ARRAY_LENGTH(m_inistate));
m_magnets = false;
m_inductive = false;
m_ui_enabled = 3;
@@ -71,7 +70,7 @@ sensorboard_device::sensorboard_device(const machine_config &mconfig, const char
void sensorboard_device::device_start()
{
// resolve handlers
- m_custom_init_cb.resolve_safe(0);
+ m_custom_init_cb.resolve_safe();
m_custom_sensor_cb.resolve_safe(0);
m_custom_spawn_cb.resolve();
m_custom_output_cb.resolve();
@@ -83,9 +82,8 @@ void sensorboard_device::device_start()
m_out_count.resolve();
}
- // custom init (meant for setting m_inistate)
- m_custom_init_cb();
- memcpy(m_curstate, m_inistate, m_height * m_width);
+ clear_board();
+ m_custom_init_cb(1);
memcpy(m_history[0], m_curstate, m_height * m_width);
for (int i = 0; i < m_maxspawn; i++)
@@ -128,7 +126,6 @@ void sensorboard_device::device_start()
save_item(NAME(m_ui_enabled));
save_item(NAME(m_curstate));
- save_item(NAME(m_inistate));
save_item(NAME(m_history));
save_item(NAME(m_uselect));
@@ -139,7 +136,7 @@ void sensorboard_device::device_start()
save_item(NAME(m_sensordelay));
}
-int sensorboard_device::preset_chess()
+void sensorboard_device::preset_chess(int state)
{
// set chessboard start position
@@ -150,24 +147,22 @@ int sensorboard_device::preset_chess()
// 5 = white queen 11 = black queen
// 6 = white king 12 = black king
- write_init(0, 0, 4);
- write_init(7, 0, 4);
- write_init(1, 0, 2);
- write_init(6, 0, 2);
- write_init(2, 0, 3);
- write_init(5, 0, 3);
- write_init(3, 0, 5);
- write_init(4, 0, 6);
+ write_piece(0, 0, 4);
+ write_piece(7, 0, 4);
+ write_piece(1, 0, 2);
+ write_piece(6, 0, 2);
+ write_piece(2, 0, 3);
+ write_piece(5, 0, 3);
+ write_piece(3, 0, 5);
+ write_piece(4, 0, 6);
for (int x = 0; x < 8; x++)
{
- write_init(x, 1, 1);
- write_init(x, 6, 7);
- write_init(x, 7, read_init(x, 0) + 6);
+ write_piece(x, 1, 1);
+ write_piece(x, 6, 7);
+ write_piece(x, 7, read_piece(x, 0) + 6);
}
- return 1;
-
// note that for inductive boards, 2 additional callbacks are needed:
// additional init_cb() for reassigning the piece ids for initial board state
// spawn_cb() for checking if a piece is available and reassigning the piece id
@@ -177,6 +172,9 @@ void sensorboard_device::device_reset()
{
cancel_sensor();
cancel_hand();
+
+ clear_board();
+ m_custom_init_cb(0);
refresh();
}
@@ -416,7 +414,7 @@ INPUT_CHANGED_MEMBER(sensorboard_device::ui_spawn)
return;
u8 pos = (u8)(uintptr_t)param;
- if (pos >= m_maxspawn)
+ if (pos > m_maxspawn)
return;
cancel_sensor();
@@ -506,16 +504,14 @@ INPUT_CHANGED_MEMBER(sensorboard_device::ui_init)
if (!newval)
return;
- u8 select = (u8)(uintptr_t)param;
+ u8 init = (u8)(uintptr_t)param;
cancel_sensor();
cancel_hand();
- // clear board
- memset(m_curstate, 0, m_height * m_width);
+ clear_board();
- // reset to initial position
- if (select)
- memcpy(m_curstate, m_inistate, m_height * m_width);
+ if (init)
+ m_custom_init_cb(0);
refresh();
}
diff --git a/src/devices/machine/sensorboard.h b/src/devices/machine/sensorboard.h
index c710d1cdfeb..77f43bfd26c 100644
--- a/src/devices/machine/sensorboard.h
+++ b/src/devices/machine/sensorboard.h
@@ -32,12 +32,12 @@ public:
sensorboard_device &set_ui_enable(bool b) { if (!b) m_maxspawn = 0; m_ui_enabled = (b) ? 3 : 0; return *this; } // enable UI inputs
sensorboard_device &set_mod_enable(bool b) { if (b) m_ui_enabled |= 1; else m_ui_enabled &= 2; return *this; } // enable modifier keys
- auto init_cb() { return m_custom_init_cb.bind(); }
+ auto init_cb() { return m_custom_init_cb.bind(); } // for setting pieces starting position
auto sensor_cb() { return m_custom_sensor_cb.bind(); } // x = offset & 0xf, y = offset >> 4 & 0xf
auto spawn_cb() { return m_custom_spawn_cb.bind(); } // spawnpoint/piece = offset, retval = new piece id
auto output_cb() { return m_custom_output_cb.bind(); } // pos = offset(A8 for ui/board, A9 for count), id = data
- int preset_chess(); // init_cb() preset for chessboards
+ void preset_chess(int state); // init_cb() preset for chessboards
// read sensors
u8 read_sensor(u8 x, u8 y);
@@ -47,8 +47,7 @@ public:
// handle board state
u8 read_piece(u8 x, u8 y) { return m_curstate[y * m_width + x]; }
void write_piece(u8 x, u8 y, u8 id) { m_curstate[y * m_width + x] = id; }
- u8 read_init(u8 x, u8 y) { return m_inistate[y * m_width + x]; }
- void write_init(u8 x, u8 y, u8 id) { m_inistate[y * m_width + x] = id; } // for setting initial board state
+ void clear_board() { memset(m_curstate, 0, ARRAY_LENGTH(m_curstate)); }
void refresh();
@@ -85,7 +84,7 @@ private:
required_ioport_array<10> m_inp_rank;
required_ioport m_inp_ui;
- devcb_read_line m_custom_init_cb;
+ devcb_write_line m_custom_init_cb;
devcb_read8 m_custom_sensor_cb;
devcb_read8 m_custom_spawn_cb;
devcb_write16 m_custom_output_cb;
@@ -105,7 +104,6 @@ private:
u8 m_ui_enabled;
u8 m_curstate[0x100];
- u8 m_inistate[0x100];
u8 m_history[1000][0x100];
u8 m_uselect;
diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h
index bc1a78d16fc..694abe3648c 100644
--- a/src/devices/video/hlcd0538.h
+++ b/src/devices/video/hlcd0538.h
@@ -73,7 +73,7 @@ protected:
class hlcd0539_device : public hlcd0538_device
{
public:
- hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+ hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
};