1
/**********************************************************************
3
SMC CRT9212 Double Row Buffer (DRB) emulation
6
Visit http://mamedev.org for licensing and usage restrictions.
8
**********************************************************************/
15
//**************************************************************************
17
//**************************************************************************
32
m_out_rof_func(_state);
35
m_out_wof_func(_state);
39
//**************************************************************************
41
//**************************************************************************
44
//**************************************************************************
46
//**************************************************************************
48
// device type definition
49
const device_type CRT9212 = &device_creator<crt9212_device>;
51
//-------------------------------------------------
52
// crt9212_device - constructor
53
//-------------------------------------------------
55
crt9212_device::crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
56
: device_t(mconfig, CRT9212, "SMC CRT9212", tag, owner, clock)
61
//-------------------------------------------------
62
// device_config_complete - perform any
63
// operations now that the configuration is
65
//-------------------------------------------------
67
void crt9212_device::device_config_complete()
69
// inherit a copy of the static data
70
const crt9212_interface *intf = reinterpret_cast<const crt9212_interface *>(static_config());
72
*static_cast<crt9212_interface *>(this) = *intf;
74
// or initialize to defaults if none provided
77
memset(&m_out_rof_cb, 0, sizeof(m_out_rof_cb));
78
memset(&m_out_wof_cb, 0, sizeof(m_out_wof_cb));
79
memset(&m_in_ren_cb, 0, sizeof(m_in_ren_cb));
80
memset(&m_in_wen_cb, 0, sizeof(m_in_wen_cb));
81
memset(&m_in_wen2_cb, 0, sizeof(m_in_wen2_cb));
86
//-------------------------------------------------
87
// device_start - device-specific startup
88
//-------------------------------------------------
90
void crt9212_device::device_start()
93
m_out_rof_func.resolve(m_out_rof_cb, *this);
94
m_out_wof_func.resolve(m_out_wof_cb, *this);
95
m_in_ren_func.resolve(m_in_ren_cb, *this);
96
m_in_wen_func.resolve(m_in_wen_cb, *this);
97
m_in_wen2_func.resolve(m_in_wen2_cb, *this);
99
// register for state saving
100
save_item(NAME(m_input));
101
save_item(NAME(m_output));
102
save_item(NAME(m_buffer));
103
save_item(NAME(m_rac));
104
save_item(NAME(m_wac));
105
save_item(NAME(m_tog));
106
save_item(NAME(m_clrcnt));
107
save_item(NAME(m_rclk));
108
save_item(NAME(m_wclk));
112
//-------------------------------------------------
113
// read - buffer read
114
//-------------------------------------------------
116
READ8_MEMBER( crt9212_device::read )
122
//-------------------------------------------------
123
// write - buffer write
124
//-------------------------------------------------
126
WRITE8_MEMBER( crt9212_device::write )
132
//-------------------------------------------------
133
// clrcnt_w - clear address counters
134
//-------------------------------------------------
136
WRITE_LINE_MEMBER( crt9212_device::clrcnt_w )
142
//-------------------------------------------------
143
// tog_w - toggle buffer
144
//-------------------------------------------------
146
WRITE_LINE_MEMBER( crt9212_device::tog_w )
152
//-------------------------------------------------
153
// rclk_w - read clock
154
//-------------------------------------------------
156
WRITE_LINE_MEMBER( crt9212_device::rclk_w )
158
if (m_rclk && !state)
165
m_buffer = !m_buffer;
167
// clear write address counter
173
// clear read address counter
180
if (REN && (m_rac < CRT9212_RAM_SIZE))
183
m_output = m_ram[m_rac][!m_buffer];
185
// increment read address counter
188
if (m_rac == CRT9212_RAM_SIZE)
201
//-------------------------------------------------
202
// wclk_w - write clock
203
//-------------------------------------------------
205
WRITE_LINE_MEMBER( crt9212_device::wclk_w )
207
if (!m_rclk && state)
209
if (WEN && WEN2 && (m_wac < CRT9212_RAM_SIZE))
212
m_ram[m_rac][m_buffer] = m_input;
214
// increment read address counter
217
if (m_wac == CRT9212_RAM_SIZE)
219
// set write overflow