Previous 199869 Revisions Next

r22791 Sunday 12th May, 2013 at 16:50:16 UTC by smf
modernised Y8950 [smf]
[src/emu/sound]8950intf.c 8950intf.h
[src/mame/drivers]cybertnk.c ginganin.c snk.c

trunk/src/mame/drivers/cybertnk.c
r22790r22791
634634ADDRESS_MAP_END
635635
636636static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 8, cybertnk_state )
637   AM_RANGE(0x0000, 0x7fff ) AM_ROM
638   AM_RANGE(0x8000, 0x9fff ) AM_RAM
639   AM_RANGE(0xa001, 0xa001 ) AM_READ(soundlatch_byte_r)
640   AM_RANGE(0xa005, 0xa006 ) AM_NOP
641   AM_RANGE(0xa000, 0xa001 ) AM_DEVREADWRITE_LEGACY("ym1", y8950_r, y8950_w)
642   AM_RANGE(0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("ym2", y8950_r, y8950_w)
637   AM_RANGE(0x0000, 0x7fff) AM_ROM
638   AM_RANGE(0x8000, 0x9fff) AM_RAM
639   AM_RANGE(0xa001, 0xa001) AM_READ(soundlatch_byte_r)
640   AM_RANGE(0xa005, 0xa006) AM_NOP
641   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ym1", y8950_device, read, write)
642   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ym2", y8950_device, read, write)
643643ADDRESS_MAP_END
644644
645645// Player 1 controls the Driving and the Cannons
r22790r22791
825825*/
826826
827827
828static const y8950_interface y8950_config = {
829   /* TODO */
830   DEVCB_NULL,
831   DEVCB_NULL,
832   DEVCB_NULL,
833   DEVCB_NULL,
834   DEVCB_NULL
835};
836
837828static MACHINE_CONFIG_START( cybertnk, cybertnk_state )
838829   MCFG_CPU_ADD("maincpu", M68000,XTAL_20MHz/2)
839830   MCFG_CPU_PROGRAM_MAP(master_mem)
r22790r22791
873864   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
874865
875866   MCFG_SOUND_ADD("ym1", Y8950, XTAL_3_579545MHz)
876   MCFG_SOUND_CONFIG(y8950_config)
877867   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
878868   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
879869
880870   MCFG_SOUND_ADD("ym2", Y8950, XTAL_3_579545MHz)
881   MCFG_SOUND_CONFIG(y8950_config)
882871   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
883872   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
884873MACHINE_CONFIG_END
trunk/src/mame/drivers/ginganin.c
r22790r22791
9494   AM_RANGE(0x0000, 0x07ff) AM_RAM
9595   AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE("6840ptm", ptm6840_device, read, write)
9696   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r)
97   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ymsnd", y8950_w)
97   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE("ymsnd", y8950_device, write)
9898   AM_RANGE(0x2800, 0x2801) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
9999   AM_RANGE(0x4000, 0xffff) AM_ROM
100100ADDRESS_MAP_END
trunk/src/mame/drivers/snk.c
r22790r22791
473473   DEVCB_DRIVER_LINE_MEMBER(snk_state,ymirq_callback_1)
474474};
475475
476static const y8950_interface y8950_config_2 =
477{
478   DEVCB_DRIVER_LINE_MEMBER(snk_state,ymirq_callback_2)
479};
480476
481477
482
483478WRITE8_MEMBER(snk_state::snk_soundlatch_w)
484479{
485480   soundlatch_byte_w(space, offset, data);
r22790r22791
14621457   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14631458   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3526_device, status_port_r, control_port_w)
14641459   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3526_device, write_port_w)
1465   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
1466   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", y8950_write_port_w)
1460   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w)
1461   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("ym2", y8950_device, write_port_w)
14671462   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
14681463ADDRESS_MAP_END
14691464
r22790r22791
14731468   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14741469   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3812_status_port_r, ym3812_control_port_w)
14751470   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3812_write_port_w)
1476   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
1477   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", y8950_write_port_w)
1471   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w)
1472   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("ym2", y8950_device, write_port_w)
14781473   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
14791474ADDRESS_MAP_END
14801475
r22790r22791
14821477   AM_RANGE(0x0000, 0xbfff) AM_ROM
14831478   AM_RANGE(0xc000, 0xcfff) AM_RAM
14841479   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
1485   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
1486   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", y8950_write_port_w)
1480   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", y8950_device, status_port_r, control_port_w)
1481   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("ym2", y8950_device, write_port_w)
14871482   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
14881483ADDRESS_MAP_END
14891484
r22790r22791
38993894
39003895   /* sound hardware */
39013896   MCFG_SOUND_REPLACE("ym2", Y8950, XTAL_8MHz/2) /* verified on pcb */
3902   MCFG_SOUND_CONFIG(y8950_config_2)
3897   MCFG_Y8950_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_2))
39033898   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
39043899MACHINE_CONFIG_END
39053900
r22790r22791
39423937   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
39433938
39443939   MCFG_SOUND_ADD("ym2", Y8950, XTAL_8MHz/2) /* verified on pcb */
3945   MCFG_SOUND_CONFIG(y8950_config_2)
3940   MCFG_Y8950_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_2))
39463941   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
39473942MACHINE_CONFIG_END
39483943
r22790r22791
40464041   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
40474042
40484043   MCFG_SOUND_ADD("ym2", Y8950, 4000000)
4049   MCFG_SOUND_CONFIG(y8950_config_2)
4044   MCFG_Y8950_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_2))
40504045   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
40514046MACHINE_CONFIG_END
40524047
trunk/src/emu/sound/8950intf.c
r22790r22791
1616* NOTES
1717*
1818******************************************************************************/
19#include "emu.h"
2019#include "8950intf.h"
2120#include "fm.h"
22#include "sound/fmopl.h"
21#include "fmopl.h"
2322
2423
25struct y8950_state
24static void IRQHandler(void *param,int irq)
2625{
27   sound_stream *  stream;
28   emu_timer *     timer[2];
29   void *          chip;
30   const y8950_interface *intf;
31   y8950_device *device;
32};
26   y8950_device *y8950 = (y8950_device *) param;
27   y8950->_IRQHandler(irq);
28}
3329
34
35INLINE y8950_state *get_safe_token(device_t *device)
30void y8950_device::_IRQHandler(int irq)
3631{
37   assert(device != NULL);
38   assert(device->type() == Y8950);
39   return (y8950_state *)downcast<y8950_device *>(device)->token();
32   m_irq_handler(irq);
4033}
4134
42
43static void IRQHandler(void *param,int irq)
35void y8950_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
4436{
45   y8950_state *info = (y8950_state *)param;
46   if (!info->device->m_handler.isnull()) info->device->m_handler(irq ? ASSERT_LINE : CLEAR_LINE);
37   switch(id)
38   {
39   case 0:
40      y8950_timer_over(m_chip,0);
41      break;
42     
43   case 1:
44      y8950_timer_over(m_chip,1);
45      break;
46   }
4747}
48static TIMER_CALLBACK( timer_callback_0 )
48
49static void timer_handler(void *param, int c, attotime period)
4950{
50   y8950_state *info = (y8950_state *)ptr;
51   y8950_timer_over(info->chip,0);
51   y8950_device *y8950 = (y8950_device *) param;
52   y8950->_timer_handler(c, period);
5253}
53static TIMER_CALLBACK( timer_callback_1 )
54
55void y8950_device::_timer_handler(int c, attotime period)
5456{
55   y8950_state *info = (y8950_state *)ptr;
56   y8950_timer_over(info->chip,1);
57}
58static void TimerHandler(void *param,int c,attotime period)
59{
60   y8950_state *info = (y8950_state *)param;
6157   if( period == attotime::zero )
6258   {   /* Reset FM Timer */
63      info->timer[c]->enable(false);
59      m_timer[c]->enable(false);
6460   }
6561   else
6662   {   /* Start FM Timer */
67      info->timer[c]->adjust(period);
63      m_timer[c]->adjust(period);
6864   }
6965}
7066
7167
7268static unsigned char Y8950PortHandler_r(void *param)
7369{
74   y8950_state *info = (y8950_state *)param;
75   if (!info->device->m_portread.isnull())
76      return info->device->m_portread(0);
77   return 0;
70   y8950_device *y8950 = (y8950_device *) param;
71   return y8950->_Y8950PortHandler_r();
7872}
7973
74unsigned char y8950_device::_Y8950PortHandler_r()
75{
76   return m_io_read_handler(0);
77}
78
8079static void Y8950PortHandler_w(void *param,unsigned char data)
8180{
82   y8950_state *info = (y8950_state *)param;
83   if (!info->device->m_portwrite.isnull())
84      info->device->m_portwrite(0,data);
81   y8950_device *y8950 = (y8950_device *) param;
82   y8950->_Y8950PortHandler_w(data);
8583}
8684
85void y8950_device::_Y8950PortHandler_w(unsigned char data)
86{
87   m_io_write_handler((offs_t)0,data);
88}
89
8790static unsigned char Y8950KeyboardHandler_r(void *param)
8891{
89   y8950_state *info = (y8950_state *)param;
90   if (!info->device->m_keyboardread.isnull())
91      return info->device->m_keyboardread(0);
92   return 0;
92   y8950_device *y8950 = (y8950_device *) param;
93   return y8950->_Y8950KeyboardHandler_r();
9394}
9495
96unsigned char y8950_device::_Y8950KeyboardHandler_r()
97{
98   return m_keyboard_read_handler(0);
99}
100
95101static void Y8950KeyboardHandler_w(void *param,unsigned char data)
96102{
97   y8950_state *info = (y8950_state *)param;
98   if (!info->device->m_keyboardwrite.isnull())
99      info->device->m_keyboardwrite(0,data);
103   y8950_device *y8950 = (y8950_device *) param;
104   y8950->_Y8950KeyboardHandler_w(data);
100105}
101106
102static STREAM_UPDATE( y8950_stream_update )
107void y8950_device::_Y8950KeyboardHandler_w(unsigned char data)
103108{
104   y8950_state *info = (y8950_state *)param;
105   y8950_update_one(info->chip, outputs[0], samples);
109   m_keyboard_write_handler((offs_t)0,data);
106110}
107111
108static void _stream_update(void *param, int interval)
112//-------------------------------------------------
113//  sound_stream_update - handle a stream update
114//-------------------------------------------------
115
116void y8950_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
109117{
110   y8950_state *info = (y8950_state *)param;
111   info->stream->update();
118   y8950_update_one(m_chip, outputs[0], samples);
112119}
113120
121static void y8950_update_request(void *param, int interval)
122{
123   y8950_device *y8950 = (y8950_device *) param;
124   y8950->_y8950_update_request();
125}
114126
115static DEVICE_START( y8950 )
127void y8950_device::_y8950_update_request()
116128{
117   static const y8950_interface dummy = { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL };
118   y8950_state *info = get_safe_token(device);
119   int rate = device->clock()/72;
129   m_stream->update();
130}
120131
121   info->intf = device->static_config() ? (const y8950_interface *)device->static_config() : &dummy;
122   info->device = downcast<y8950_device *>(device);
123132
133//-------------------------------------------------
134//  device_start - device-specific startup
135//-------------------------------------------------
136
137void y8950_device::device_start()
138{
139   int rate = clock()/72;
140
141   m_irq_handler.resolve_safe();
142   m_keyboard_read_handler.resolve_safe(0);
143   m_keyboard_write_handler.resolve_safe();
144   m_io_read_handler.resolve_safe(0);
145   m_io_write_handler.resolve_safe();
146
124147   /* stream system initialize */
125   info->chip = y8950_init(device,device->clock(),rate);
126   assert_always(info->chip != NULL, "Error creating Y8950 chip");
148   m_chip = y8950_init(this,clock(),rate);
149   assert_always(m_chip != NULL, "Error creating Y8950 chip");
127150
128151   /* ADPCM ROM data */
129   y8950_set_delta_t_memory(info->chip, *device->region(), device->region()->bytes());
152   y8950_set_delta_t_memory(m_chip, *region(), region()->bytes());
130153
131   info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,y8950_stream_update);
154   m_stream = machine().sound().stream_alloc(*this,0,1,rate);
132155   /* port and keyboard handler */
133   y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info);
134   y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info);
156   y8950_set_port_handler(m_chip, Y8950PortHandler_w, Y8950PortHandler_r, this);
157   y8950_set_keyboard_handler(m_chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, this);
135158
136159   /* Y8950 setup */
137   y8950_set_timer_handler (info->chip, TimerHandler, info);
138   y8950_set_irq_handler   (info->chip, IRQHandler, info);
139   y8950_set_update_handler(info->chip, _stream_update, info);
160   y8950_set_timer_handler (m_chip, timer_handler, this);
161   y8950_set_irq_handler   (m_chip, IRQHandler, this);
162   y8950_set_update_handler(m_chip, y8950_update_request, this);
140163
141   info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info);
142   info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info);
164   m_timer[0] = timer_alloc(0);
165   m_timer[1] = timer_alloc(1);
143166}
144167
145static DEVICE_STOP( y8950 )
168//-------------------------------------------------
169//  device_stop - device-specific stop
170//-------------------------------------------------
171
172void y8950_device::device_stop()
146173{
147   y8950_state *info = get_safe_token(device);
148   y8950_shutdown(info->chip);
174   y8950_shutdown(m_chip);
149175}
150176
151static DEVICE_RESET( y8950 )
177//-------------------------------------------------
178//  device_reset - device-specific reset
179//-------------------------------------------------
180
181void y8950_device::device_reset()
152182{
153   y8950_state *info = get_safe_token(device);
154   y8950_reset_chip(info->chip);
183   y8950_reset_chip(m_chip);
155184}
156185
157186
158READ8_DEVICE_HANDLER( y8950_r )
187READ8_MEMBER( y8950_device::read )
159188{
160   y8950_state *info = get_safe_token(device);
161   return y8950_read(info->chip, offset & 1);
189   return y8950_read(m_chip, offset & 1);
162190}
163191
164WRITE8_DEVICE_HANDLER( y8950_w )
192WRITE8_MEMBER( y8950_device::write )
165193{
166   y8950_state *info = get_safe_token(device);
167   y8950_write(info->chip, offset & 1, data);
194   y8950_write(m_chip, offset & 1, data);
168195}
169196
170READ8_DEVICE_HANDLER( y8950_status_port_r ) { return y8950_r(device, space, 0); }
171READ8_DEVICE_HANDLER( y8950_read_port_r ) { return y8950_r(device, space, 1); }
172WRITE8_DEVICE_HANDLER( y8950_control_port_w ) { y8950_w(device, space, 0, data); }
173WRITE8_DEVICE_HANDLER( y8950_write_port_w ) { y8950_w(device, space, 1, data); }
197READ8_MEMBER( y8950_device::status_port_r ) { return read(space, 0); }
198READ8_MEMBER( y8950_device::read_port_r ) { return read(space, 1); }
199WRITE8_MEMBER( y8950_device::control_port_w ) { write(space, 0, data); }
200WRITE8_MEMBER( y8950_device::write_port_w ) { write(space, 1, data); }
174201
175202
176203const device_type Y8950 = &device_creator<y8950_device>;
177204
178205y8950_device::y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
179206   : device_t(mconfig, Y8950, "Y8950", tag, owner, clock),
180      device_sound_interface(mconfig, *this)
207      device_sound_interface(mconfig, *this),
208      m_irq_handler(*this),
209      m_keyboard_read_handler(*this),
210      m_keyboard_write_handler(*this),
211      m_io_read_handler(*this),
212      m_io_write_handler(*this)
181213{
182   m_token = global_alloc_clear(y8950_state);
183214}
184215
185216//-------------------------------------------------
r22790r22791
190221
191222void y8950_device::device_config_complete()
192223{
193   // inherit a copy of the static data
194   const y8950_interface *intf = reinterpret_cast<const y8950_interface *>(static_config());
195   if (intf != NULL)
196      *static_cast<y8950_interface *>(this) = *intf;
197
198   // or initialize to defaults if none provided
199   else
200   {
201      memset(&m_handler_cb, 0, sizeof(m_handler_cb));
202      memset(&m_keyboardread_cb, 0, sizeof(m_keyboardread_cb));
203      memset(&m_keyboardwrite_cb, 0, sizeof(m_keyboardwrite_cb));
204      memset(&m_portread_cb, 0, sizeof(m_portread_cb));
205      memset(&m_portwrite_cb, 0, sizeof(m_portwrite_cb));
206   }
207224}
208
209//-------------------------------------------------
210//  device_start - device-specific startup
211//-------------------------------------------------
212
213void y8950_device::device_start()
214{
215   m_handler.resolve(m_handler_cb, *this);
216   m_keyboardread.resolve(m_keyboardread_cb, *this);
217   m_keyboardwrite.resolve(m_keyboardwrite_cb, *this);
218   m_portread.resolve(m_portread_cb, *this);
219   m_portwrite.resolve(m_portwrite_cb, *this);
220
221   DEVICE_START_NAME( y8950 )(this);
222}
223
224//-------------------------------------------------
225//  device_reset - device-specific reset
226//-------------------------------------------------
227
228void y8950_device::device_reset()
229{
230   DEVICE_RESET_NAME( y8950 )(this);
231}
232
233//-------------------------------------------------
234//  device_stop - device-specific stop
235//-------------------------------------------------
236
237void y8950_device::device_stop()
238{
239   DEVICE_STOP_NAME( y8950 )(this);
240}
241
242//-------------------------------------------------
243//  sound_stream_update - handle a stream update
244//-------------------------------------------------
245
246void y8950_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
247{
248   // should never get here
249   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
250}
trunk/src/emu/sound/8950intf.h
r22790r22791
33#ifndef __8950INTF_H__
44#define __8950INTF_H__
55
6#include "devlegcy.h"
6#include "emu.h"
77
8struct y8950_interface
9{
10   devcb_write_line m_handler_cb;
11   devcb_read8 m_keyboardread_cb;
12   devcb_write8 m_keyboardwrite_cb;
13   devcb_read8 m_portread_cb;
14   devcb_write8 m_portwrite_cb;
15};
8#define MCFG_Y8950_IRQ_HANDLER(_devcb) \
9   devcb = &y8950_device::set_irq_handler(*device, DEVCB2_##_devcb);
1610
17DECLARE_READ8_DEVICE_HANDLER( y8950_r );
18DECLARE_WRITE8_DEVICE_HANDLER( y8950_w );
11#define MCFG_Y8950_KEYBOARD_READ_HANDLER(_devcb) \
12   devcb = &y8950_device::set_keyboard_read_handler(*device, DEVCB2_##_devcb);
1913
20DECLARE_READ8_DEVICE_HANDLER( y8950_status_port_r );
21DECLARE_READ8_DEVICE_HANDLER( y8950_read_port_r );
22DECLARE_WRITE8_DEVICE_HANDLER( y8950_control_port_w );
23DECLARE_WRITE8_DEVICE_HANDLER( y8950_write_port_w );
14#define MCFG_Y8950_KEYBOARD_WRITE_HANDLER(_devcb) \
15   devcb = &y8950_device::set_keyboard_write_handler(*device, DEVCB2_##_devcb);
2416
17#define MCFG_Y8950_IO_READ_HANDLER(_devcb) \
18   devcb = &y8950_device::set_io_read_handler(*device, DEVCB2_##_devcb);
19
20#define MCFG_Y8950_IO_WRITE_HANDLER(_devcb) \
21   devcb = &y8950_device::set_io_write_handler(*device, DEVCB2_##_devcb);
22
2523class y8950_device : public device_t,
26                  public device_sound_interface,
27                  public y8950_interface
24                  public device_sound_interface
2825{
2926public:
3027   y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31   ~y8950_device() { global_free(m_token); }
3228
33   // access to legacy token
34   void *token() const { assert(m_token != NULL); return m_token; }
29   // static configuration helpers
30   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<y8950_device &>(device).m_irq_handler.set_callback(object); }
31   template<class _Object> static devcb2_base &set_keyboard_read_handler(device_t &device, _Object object) { return downcast<y8950_device &>(device).m_keyboard_read_handler.set_callback(object); }
32   template<class _Object> static devcb2_base &set_keyboard_write_handler(device_t &device, _Object object) { return downcast<y8950_device &>(device).m_keyboard_write_handler.set_callback(object); }
33   template<class _Object> static devcb2_base &set_io_read_handler(device_t &device, _Object object) { return downcast<y8950_device &>(device).m_io_read_handler.set_callback(object); }
34   template<class _Object> static devcb2_base &set_io_write_handler(device_t &device, _Object object) { return downcast<y8950_device &>(device).m_io_write_handler.set_callback(object); }
35
36   DECLARE_READ8_MEMBER( read );
37   DECLARE_WRITE8_MEMBER( write );
38
39   DECLARE_READ8_MEMBER( status_port_r );
40   DECLARE_READ8_MEMBER( read_port_r );
41   DECLARE_WRITE8_MEMBER( control_port_w );
42   DECLARE_WRITE8_MEMBER( write_port_w );
43
44   void _IRQHandler(int irq);
45   void _timer_handler(int c,attotime period);
46   void _y8950_update_request();
47   unsigned char _Y8950PortHandler_r();
48   void _Y8950PortHandler_w(unsigned char data);
49   unsigned char _Y8950KeyboardHandler_r();
50   void _Y8950KeyboardHandler_w(unsigned char data);
51
3552protected:
3653   // device-level overrides
3754   virtual void device_config_complete();
r22790r22791
3956   virtual void device_stop();
4057   virtual void device_reset();
4158
59   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
60
4261   // sound stream update overrides
4362   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
63
4464private:
4565   // internal state
46   void *m_token;
47public:
48   devcb_resolved_write_line m_handler;
49   devcb_resolved_read8 m_keyboardread;
50   devcb_resolved_write8 m_keyboardwrite;
51   devcb_resolved_read8 m_portread;
52   devcb_resolved_write8 m_portwrite;
66   sound_stream *  m_stream;
67   emu_timer *     m_timer[2];
68   void *          m_chip;
69   devcb2_write_line m_irq_handler;
70   devcb2_read8 m_keyboard_read_handler;
71   devcb2_write8 m_keyboard_write_handler;
72   devcb2_read8 m_io_read_handler;
73   devcb2_write8 m_io_write_handler;
5374};
5475
5576extern const device_type Y8950;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team