summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-04-27 12:35:05 +0200
committer hap <happppp@users.noreply.github.com>2019-04-27 12:35:18 +0200
commit6f6a87dd452948473b11cb5fb36d1b87f03df2b2 (patch)
tree46486b765c84e165d00ddf219f4c22da4bb34dff
parent421651b9b7d93117e29d4f8489b74449a40eac7b (diff)
talkingbb: add leds to savestate (nw)
-rw-r--r--src/mame/drivers/talkingbb.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mame/drivers/talkingbb.cpp b/src/mame/drivers/talkingbb.cpp
index d2d0f5f307b..5f6377a032f 100644
--- a/src/mame/drivers/talkingbb.cpp
+++ b/src/mame/drivers/talkingbb.cpp
@@ -25,6 +25,7 @@ TODO:
- Buttons are unresponsive at initial game setup, you need to hold the yes/no button
until it responds. The keypad reading routine is at $1A5D, it gets skipped for several
seconds at a time. Once in-game, everything is fine though. BTANB or different cause?
+- get rid of savestate workaround once outputs support savestates
*******************************************************************************
@@ -132,6 +133,7 @@ public:
protected:
virtual void machine_start() override;
+ virtual void device_post_load() override;
private:
// devices/pointers
@@ -146,8 +148,10 @@ private:
u8 m_bank;
u8 m_led_select;
+ u8 m_led_cache[12];
- TIMER_DEVICE_CALLBACK_MEMBER(delay_display) { m_out_led[param] = 0; }
+ void set_led(int i, int value) { m_led_cache[i] = m_out_led[i] = value; }
+ TIMER_DEVICE_CALLBACK_MEMBER(delay_display) { set_led(param, 0); }
// I/O handlers
DECLARE_WRITE8_MEMBER(bank_w);
@@ -165,10 +169,18 @@ void talkingbb_state::machine_start()
// zerofill
m_bank = 0;
m_led_select = 0;
+ memset(m_led_cache, 0, sizeof(m_led_cache));
// register for savestates
save_item(NAME(m_bank));
save_item(NAME(m_led_select));
+ save_item(NAME(m_led_cache));
+}
+
+void talkingbb_state::device_post_load()
+{
+ for (int i = 0; i < 4; i++)
+ m_out_led[i] = m_led_cache[i];
}
@@ -212,7 +224,7 @@ WRITE8_MEMBER(talkingbb_state::input_w)
if (prev & ~cur)
m_delay_display[i]->adjust(attotime::from_msec(50), i);
else if (cur)
- m_out_led[i] = 1;
+ set_led(i, 1);
}
m_led_select = data;
@@ -254,7 +266,7 @@ void talkingbb_state::main_map(address_map &map)
void talkingbb_state::main_io(address_map &map)
{
- map(0x0000, 0x07ff).mirror(0x3800).ram();
+ map(0x0000, 0x07ff).mirror(0x7800).ram();
map(0x8000, 0x8000).mirror(0x7fff).rw(FUNC(talkingbb_state::input_r), FUNC(talkingbb_state::input_w));
}