trunk/src/emu/bus/a2bus/a2mcms.c
| r31137 | r31138 | |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | | class mcms_device : public device_t, public device_sound_interface |
| 26 | | { |
| 27 | | public: |
| 28 | | // construction/destruction |
| 29 | | mcms_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 30 | | |
| 31 | | DECLARE_WRITE8_MEMBER(voiceregs_w); |
| 32 | | DECLARE_WRITE8_MEMBER(control_w); |
| 33 | | UINT8 get_pen_rand(void) { m_stream->update(); return m_rand; } |
| 34 | | |
| 35 | | template<class _Object> static devcb_base &set_irq_cb(device_t &device, _Object wr) { return downcast<mcms_device &>(device).m_write_irq.set_callback(wr); } |
| 36 | | devcb_write_line m_write_irq; |
| 37 | | |
| 38 | | protected: |
| 39 | | // device-level overrides |
| 40 | | virtual void device_start(); |
| 41 | | virtual void device_reset(); |
| 42 | | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 43 | | |
| 44 | | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 45 | | |
| 46 | | private: |
| 47 | | sound_stream *m_stream; |
| 48 | | address_space *m_6502space; |
| 49 | | emu_timer *m_timer, *m_clrtimer; |
| 50 | | bool m_enabled; |
| 51 | | UINT8 m_vols[16]; |
| 52 | | UINT8 m_table[16]; |
| 53 | | UINT16 m_freq[16]; |
| 54 | | UINT16 m_acc[16]; |
| 55 | | UINT8 m_mastervol; |
| 56 | | UINT8 m_rand; |
| 57 | | }; |
| 58 | | |
| 59 | 25 | const device_type MCMS = &device_creator<mcms_device>; |
| 60 | 26 | |
| 61 | 27 | /*************************************************************************** |
trunk/src/emu/bus/a2bus/a2mcms.h
| r31137 | r31138 | |
| 20 | 20 | // TYPE DEFINITIONS |
| 21 | 21 | //************************************************************************** |
| 22 | 22 | |
| 23 | | // forward declaration |
| 24 | | class mcms_device; |
| 23 | class mcms_device : public device_t, public device_sound_interface |
| 24 | { |
| 25 | public: |
| 26 | // construction/destruction |
| 27 | mcms_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 25 | 28 | |
| 29 | DECLARE_WRITE8_MEMBER(voiceregs_w); |
| 30 | DECLARE_WRITE8_MEMBER(control_w); |
| 31 | UINT8 get_pen_rand(void) { m_stream->update(); return m_rand; } |
| 32 | |
| 33 | template<class _Object> static devcb_base &set_irq_cb(device_t &device, _Object wr) { return downcast<mcms_device &>(device).m_write_irq.set_callback(wr); } |
| 34 | devcb_write_line m_write_irq; |
| 35 | |
| 36 | protected: |
| 37 | // device-level overrides |
| 38 | virtual void device_start(); |
| 39 | virtual void device_reset(); |
| 40 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 41 | |
| 42 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 43 | |
| 44 | private: |
| 45 | sound_stream *m_stream; |
| 46 | address_space *m_6502space; |
| 47 | emu_timer *m_timer, *m_clrtimer; |
| 48 | bool m_enabled; |
| 49 | UINT8 m_vols[16]; |
| 50 | UINT8 m_table[16]; |
| 51 | UINT16 m_freq[16]; |
| 52 | UINT16 m_acc[16]; |
| 53 | UINT8 m_mastervol; |
| 54 | UINT8 m_rand; |
| 55 | }; |
| 56 | |
| 26 | 57 | // card 1 |
| 27 | 58 | class a2bus_mcms1_device: |
| 28 | 59 | public device_t, |
| r31137 | r31138 | |
| 76 | 107 | |
| 77 | 108 | private: |
| 78 | 109 | a2bus_mcms1_device *m_card1; // card 1 for passthrough |
| 79 | | class mcms_device *m_engine; |
| 110 | mcms_device *m_engine; |
| 80 | 111 | }; |
| 81 | 112 | |
| 82 | 113 | // device type definition |