summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/bublbobl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/bublbobl.cpp')
-rw-r--r--src/mame/machine/bublbobl.cpp111
1 files changed, 93 insertions, 18 deletions
diff --git a/src/mame/machine/bublbobl.cpp b/src/mame/machine/bublbobl.cpp
index b4ae1801938..8ca3f92b53a 100644
--- a/src/mame/machine/bublbobl.cpp
+++ b/src/mame/machine/bublbobl.cpp
@@ -57,29 +57,104 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_nmitrigger_w)
}
-static const uint8_t tokio_prot_data[] =
-{
- 0x6c,
- 0x7f,0x5f,0x7f,0x6f,0x5f,0x77,0x5f,0x7f,0x5f,0x7f,0x5f,0x7f,0x5b,0x7f,0x5f,0x7f,
- 0x5f,0x77,0x59,0x7f,0x5e,0x7e,0x5f,0x6d,0x57,0x7f,0x5d,0x7d,0x5f,0x7e,0x5f,0x7f,
- 0x5d,0x7d,0x5f,0x7e,0x5e,0x79,0x5f,0x7f,0x5f,0x7f,0x5d,0x7f,0x5f,0x7b,0x5d,0x7e,
- 0x5f,0x7f,0x5d,0x7d,0x5f,0x7e,0x5e,0x7e,0x5f,0x7d,0x5f,0x7f,0x5f,0x7e,0x7f,0x5f,
- 0x01,0x00,0x02,0x01,0x01,0x01,0x03,0x00,0x05,0x02,0x04,0x01,0x03,0x00,0x05,0x01,
- 0x02,0x03,0x00,0x04,0x04,0x01,0x02,0x00,0x05,0x03,0x02,0x01,0x04,0x05,0x00,0x03,
- 0x00,0x05,0x02,0x01,0x03,0x04,0x05,0x00,0x01,0x04,0x04,0x02,0x01,0x04,0x01,0x00,
- 0x03,0x01,0x02,0x05,0x00,0x03,0x00,0x01,0x02,0x00,0x03,0x04,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,
- 0x01,0x02,0x01,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x02,0x00,0x01,0x01,0x00,0x00,0x02,0x01,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x01
-};
+
+CUSTOM_INPUT_MEMBER(bublbobl_state::tokio_mcu_sent_r)
+{
+ if (m_mcu_sent) return 0;
+ else return 1;
+}
+
+CUSTOM_INPUT_MEMBER(bublbobl_state::tokio_main_sent_r)
+{
+ if (m_main_sent) return 0;
+ else return 1;
+}
+
READ8_MEMBER(bublbobl_state::tokio_mcu_r)
{
- m_tokio_prot_count %= sizeof(tokio_prot_data);
- return tokio_prot_data[m_tokio_prot_count++];
+ if (!m_mcu)
+ return 0x00;
+
+ m_mcu_sent = false;
+
+// printf("%s: tokio_mcu_r %02x\n", space.machine().describe_context(), m_from_mcu);
+
+ return m_from_mcu;
+}
+
+WRITE8_MEMBER(bublbobl_state::tokio_mcu_w)
+{
+ if (!m_mcu)
+ return;
+
+// printf("%s: tokio_mcu_w %02x\n", space.machine().describe_context(), data);
+
+ m_from_main = data;
+ m_main_sent = true;
+ m_mcu->set_input_line(0, ASSERT_LINE);
+
+}
+
+
+READ8_MEMBER(bublbobl_state::tokio_mcu_porta_r)
+{
+// printf("tokio_mcu_porta_r\n");
+ return m_to_mcu_latch;
+}
+
+WRITE8_MEMBER(bublbobl_state::tokio_mcu_porta_w)
+{
+// printf("tokio_mcu_porta_w %02x\n", data);
+ m_from_mcu_latch = data;
+}
+
+
+READ8_MEMBER(bublbobl_state::tokio_mcu_portc_r)
+{
+ uint8_t ret = 0;
+
+ if (!m_main_sent)
+ ret |= 0x01;
+ if (m_mcu_sent)
+ ret |= 0x02;
+
+ ret ^= 0x3; // inverted logic compared to tigerh
+
+// printf("%s: tokio_mcu_portc_r %02x\n", space.machine().describe_context(), ret);
+
+ return ret;
+}
+
+
+WRITE8_MEMBER(bublbobl_state::tokio_mcu_portb_w)
+{
+// printf("tokio_mcu_portb_w %02x\n", data);
+
+ if ((mem_mask & 0x02) && (~data & 0x02) && (m_old_portB & 0x02))
+ {
+ if (m_main_sent)
+ m_mcu->set_input_line(0, CLEAR_LINE);
+
+ m_to_mcu_latch = m_from_main;
+ m_main_sent = false;
+ }
+ if ((mem_mask & 0x04) && (data & 0x04) && (~m_old_portB & 0x04))
+ {
+ m_from_mcu = m_from_mcu_latch;
+ m_mcu_sent = true;
+ // printf("sent %02x\n", m_from_mcu);
+ }
+
+ m_old_portB = data;
+
}
+
+
+
+
+
READ8_MEMBER(bublbobl_state::tokiob_mcu_r)
{
return 0xbf; /* ad-hoc value set to pass initial testing */