1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
// license:BSD-3-Clause
// copyright-holders:David Haywood, Vas Crabb
#ifndef MAME_MACHINE_TAITO68705INTERFACE_H
#define MAME_MACHINE_TAITO68705INTERFACE_H
#pragma once
#include "cpu/m6805/m68705.h"
DECLARE_DEVICE_TYPE(TAITO68705_MCU, taito68705_mcu_device)
DECLARE_DEVICE_TYPE(TAITO68705_MCU_TIGER, taito68705_mcu_tiger_device)
DECLARE_DEVICE_TYPE(ARKANOID_68705P3, arkanoid_68705p3_device)
DECLARE_DEVICE_TYPE(ARKANOID_68705P5, arkanoid_68705p5_device)
class taito68705_mcu_device_base : public device_t
{
public:
// host interface
u8 data_r();
void data_w(u8 data);
DECLARE_WRITE_LINE_MEMBER(reset_w);
DECLARE_READ_LINE_MEMBER(host_semaphore_r) { return m_host_flag ? 1 : 0; }
DECLARE_READ_LINE_MEMBER(mcu_semaphore_r) { return m_mcu_flag ? 1 : 0; }
protected:
taito68705_mcu_device_base(
machine_config const &mconfig,
device_type type,
char const *tag,
device_t *owner,
u32 clock);
auto semaphore_cb() { return m_semaphore_cb.bind(); }
// MCU callbacks
void mcu_pa_w(u8 data);
virtual void device_start() override;
virtual void device_reset() override;
bool host_flag() const { return m_host_flag; }
bool mcu_flag() const { return m_mcu_flag; }
u8 pa_value() const { return m_pa_output & (m_latch_driven ? m_host_latch : 0xff); }
void latch_control(u8 data, u8 &value, unsigned host_bit, unsigned mcu_bit);
required_device<m68705p_device> m_mcu;
private:
devcb_write_line m_semaphore_cb;
bool m_latch_driven;
bool m_reset_input;
bool m_host_flag;
bool m_mcu_flag;
u8 m_host_latch;
u8 m_mcu_latch;
u8 m_pa_output;
};
class taito68705_mcu_device : public taito68705_mcu_device_base
{
public:
template <unsigned N> auto aux_out_cb() { return m_aux_out_cb[N].bind(); }
auto aux_strobe_cb() { return m_aux_strobe_cb.bind(); }
taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
taito68705_mcu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual u8 mcu_portc_r();
void mcu_portb_w(offs_t offset, u8 data, u8 mem_mask = ~0);
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
devcb_write_line::array<6> m_aux_out_cb;
devcb_write8 m_aux_strobe_cb;
u8 m_pb_output;
};
class taito68705_mcu_tiger_device : public taito68705_mcu_device
{
public:
taito68705_mcu_tiger_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual u8 mcu_portc_r() override;
};
class arkanoid_mcu_device_base : public taito68705_mcu_device_base
{
public:
using taito68705_mcu_device_base::semaphore_cb;
auto portb_r_cb() { return m_portb_r_cb.bind(); }
protected:
arkanoid_mcu_device_base(
machine_config const &mconfig,
device_type type,
char const *tag,
device_t *owner,
u32 clock);
// MCU callbacks
u8 mcu_pb_r();
u8 mcu_pc_r();
void mcu_pc_w(u8 data);
virtual void device_start() override;
devcb_read8 m_portb_r_cb;
u8 m_pc_output;
};
class arkanoid_68705p3_device : public arkanoid_mcu_device_base
{
public:
arkanoid_68705p3_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
};
class arkanoid_68705p5_device : public arkanoid_mcu_device_base
{
public:
arkanoid_68705p5_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
};
#endif // MAME_MACHINE_TAITO68705INTERFACE_H
|