summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-07-19 17:29:14 +0200
committer hap <happppp@users.noreply.github.com>2019-07-19 17:29:33 +0200
commit5ffe45d37bdb103b70ab5c00eb0034b9aff0371e (patch)
tree29cf21172bec53f3392660ebc5920dda2d13917d
parentdde0ed669e1c2432d575c1f5de78aec611dfe705 (diff)
sensorboard: can now reset board with black pieces starting from the bottom (nw)
-rw-r--r--src/devices/machine/sensorboard.cpp40
-rw-r--r--src/devices/machine/sensorboard.h1
-rw-r--r--src/mame/drivers/saitek_stratos.cpp31
3 files changed, 47 insertions, 25 deletions
diff --git a/src/devices/machine/sensorboard.cpp b/src/devices/machine/sensorboard.cpp
index 2fd22010ec3..27b118905ea 100644
--- a/src/devices/machine/sensorboard.cpp
+++ b/src/devices/machine/sensorboard.cpp
@@ -14,7 +14,7 @@ can be made to look completely different with external artwork.
This device 'steals' the Shift and Ctrl keys, so don't use them in the driver.
But if you must, these inputs can be disabled with set_mod_enable(false).
In here, they're used for forcing sensor/piece inputs (a normal click activates
-both at the same time).
+both at the same time). Also used with board initialization.
If you use this device in a slot, or add multiple of them, make sure to override
the outputs with output_cb() to avoid collisions.
@@ -51,6 +51,7 @@ sensorboard_device::sensorboard_device(const machine_config &mconfig, const char
m_custom_spawn_cb(*this),
m_custom_output_cb(*this)
{
+ m_nosensors = false;
m_magnets = false;
m_inductive = false;
m_ui_enabled = 3;
@@ -186,18 +187,10 @@ void sensorboard_device::device_reset()
sensorboard_device &sensorboard_device::set_type(sb_type type)
{
+ m_nosensors = (type == NOSENSORS);
m_inductive = (type == INDUCTIVE);
m_magnets = (type == MAGNETS) || m_inductive;
- if (type == NOSENSORS)
- {
- set_mod_enable(false);
- set_delay(attotime::never);
- }
-
- if (m_inductive)
- set_mod_enable(false);
-
return *this;
}
@@ -401,7 +394,7 @@ INPUT_CHANGED_MEMBER(sensorboard_device::sensor)
if (!newval)
return;
- if (m_sensorpos != -1 || m_inp_ui->read() & 1)
+ if (m_sensorpos != -1 || (m_inp_ui->read() & 1 && !m_inductive && !m_nosensors))
return;
u8 pos = (u8)(uintptr_t)param;
@@ -538,6 +531,27 @@ INPUT_CHANGED_MEMBER(sensorboard_device::ui_init)
if (init)
m_custom_init_cb(0);
+ // rotate pieces
+ if (m_inp_ui->read() & 2)
+ {
+ u8 tempstate[0x100];
+ for (int y = 0; y < m_height; y++)
+ for (int x = 0; x < m_width; x++)
+ tempstate[m_width * (m_height - 1 - y) + (m_width - 1 - x)] = m_curstate[m_width * y + x];
+
+ memcpy(m_curstate, tempstate, m_height * m_width);
+ }
+
+ // reset undo
+ if (m_inp_ui->read() & 1)
+ {
+ memcpy(m_history[0], m_curstate, m_height * m_width);
+
+ m_upointer = 0;
+ m_ufirst = 0;
+ m_ulast = 0;
+ }
+
refresh();
}
@@ -687,8 +701,8 @@ static INPUT_PORTS_START( sensorboard )
PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("SS_CHECK", 1<<15, EQUALS, 0) PORT_CHANGED_MEMBER(DEVICE_SELF, sensorboard_device, ui_spawn, 16) PORT_NAME("Spawn Piece 16")
PORT_START("UI")
- PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 1, NOTEQUALS, 0) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Modifier Force Sensor") // hold while clicking to force sensor (ignore piece)
- PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 1, NOTEQUALS, 0) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Modifier Force Piece") // hold while clicking to force piece (ignore sensor)
+ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 1, NOTEQUALS, 0) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Modifier 2 / Force Sensor") // hold while clicking to force sensor (ignore piece)
+ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 1, NOTEQUALS, 0) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Modifier 1 / Force Piece") // hold while clicking to force piece (ignore sensor)
PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sensorboard_device, check_sensor_busy, nullptr) // check if any sensor is busy / pressed (read-only)
PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 2, NOTEQUALS, 0) PORT_CHANGED_MEMBER(DEVICE_SELF, sensorboard_device, ui_hand, 0) PORT_NAME("Remove Piece")
PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CONDITION("UI_CHECK", 2, NOTEQUALS, 0) PORT_CHANGED_MEMBER(DEVICE_SELF, sensorboard_device, ui_undo, 0) PORT_NAME("Undo Buffer First")
diff --git a/src/devices/machine/sensorboard.h b/src/devices/machine/sensorboard.h
index 1cdb0a8c327..9eef956b5ab 100644
--- a/src/devices/machine/sensorboard.h
+++ b/src/devices/machine/sensorboard.h
@@ -92,6 +92,7 @@ private:
devcb_read8 m_custom_spawn_cb;
devcb_write16 m_custom_output_cb;
+ bool m_nosensors;
bool m_magnets;
bool m_inductive;
u8 m_width;
diff --git a/src/mame/drivers/saitek_stratos.cpp b/src/mame/drivers/saitek_stratos.cpp
index d297f030b19..ab39b22fc2f 100644
--- a/src/mame/drivers/saitek_stratos.cpp
+++ b/src/mame/drivers/saitek_stratos.cpp
@@ -61,7 +61,7 @@ private:
DECLARE_READ8_MEMBER(lcd_r);
DECLARE_WRITE8_MEMBER(lcd_w);
- void stratos_mem(address_map &map);
+ void main_map(address_map &map);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
void set_cpu_freq();
@@ -146,7 +146,6 @@ INPUT_CHANGED_MEMBER(stratos_state::go_button)
WRITE8_MEMBER(stratos_state::p2000_w)
{
- m_dac->write(0); // guessed
m_select = data;
m_display->matrix_partial(2, 4, ~m_select >> 4 & 0xf, 1 << (m_select & 0xf));
@@ -164,6 +163,8 @@ WRITE8_MEMBER(stratos_state::p2200_w)
WRITE8_MEMBER(stratos_state::p2400_w)
{
+ m_dac->write(0); // guessed
+
m_led_data = data;
show_leds();
@@ -187,7 +188,6 @@ READ8_MEMBER(stratos_state::control_r)
if (sel < 8)
data |= m_inputs[sel]->read() << 5;
-
return data;
}
@@ -226,7 +226,7 @@ WRITE8_MEMBER(stratos_state::lcd_w)
m_lcd_busy->adjust(attotime::from_usec(50)); // ?
}
-void stratos_state::stratos_mem(address_map &map)
+void stratos_state::main_map(address_map &map)
{
map(0x0000, 0x1fff).ram().share("nvram.u6");
map(0x2000, 0x2000).w(FUNC(stratos_state::p2000_w));
@@ -243,7 +243,7 @@ static INPUT_PORTS_START( stratos )
PORT_START("IN.0")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Set Up")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_L) PORT_NAME("Level")
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) // freq sel
PORT_START("IN.1")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Sound")
@@ -268,12 +268,12 @@ static INPUT_PORTS_START( stratos )
PORT_START("IN.5")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Function")
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) // freq sel
PORT_START("IN.6")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Library")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Info")
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_CUSTOM) // freq sel
PORT_START("IN.7")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
@@ -289,11 +289,18 @@ static INPUT_PORTS_START( stratos )
PORT_CONFSETTING( 0x01, "5.67MHz" )
INPUT_PORTS_END
+static INPUT_PORTS_START( tking2 )
+ PORT_INCLUDE( stratos )
+
+ PORT_MODIFY("IN.5")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_CUSTOM)
+INPUT_PORTS_END
+
void stratos_state::stratos(machine_config &config)
{
/* basic machine hardware */
M65C02(config, m_maincpu, 5_MHz_XTAL); // see set_cpu_freq
- m_maincpu->set_addrmap(AS_PROGRAM, &stratos_state::stratos_mem);
+ m_maincpu->set_addrmap(AS_PROGRAM, &stratos_state::main_map);
NVRAM(config, "nvram.u6", nvram_device::DEFAULT_ALL_0);
NVRAM(config, "nvram.u7", nvram_device::DEFAULT_ALL_0);
@@ -390,8 +397,8 @@ ROM_END
CONS( 1986, stratos, 0, 0, stratos, stratos, stratos_state, empty_init, "SciSys", "Kasparov Stratos (rev. M)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
CONS( 1986, stratosl, stratos, 0, stratos, stratos, stratos_state, empty_init, "SciSys", "Kasparov Stratos (rev. L)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
-CONS( 1990, tking, 0, 0, tking2, stratos, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. D)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) // aka Turbo King II
-CONS( 1988, tkingl, tking, 0, stratos, stratos, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. L)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
-CONS( 1988, tkingp, tking, 0, stratos, stratos, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. P)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
+CONS( 1990, tking, 0, 0, tking2, tking2, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. D)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) // aka Turbo King II
+CONS( 1988, tkingl, tking, 0, stratos, stratos, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. L)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
+CONS( 1988, tkingp, tking, 0, stratos, stratos, stratos_state, empty_init, "Saitek", "Kasparov Turbo King (rev. P)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
-CONS( 1988, corona, 0, 0, corona, stratos, stratos_state, empty_init, "Saitek", "Kasparov Corona (rev. G)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )
+CONS( 1988, corona, 0, 0, corona, stratos, stratos_state, empty_init, "Saitek", "Kasparov Corona (rev. G)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK )