Previous 199869 Revisions Next

r22778 Sunday 12th May, 2013 at 00:47:48 UTC by smf
clears variables to avoid random crashing (nw)
[src/emu/sound]2203intf.c 2608intf.c ymf271.c ymf271.h ymz280b.c ymz280b.h

trunk/src/emu/sound/ymz280b.c
r22777r22778
648648
649649void ymz280b_device::device_reset()
650650{
651   int i;
652
653651   /* initial clear registers */
654   for (i = 0xff; i >= 0; i--)
652   for (int i = 0xff; i >= 0; i--)
655653   {
656654      m_current_register = i;
657655      write_to_register(0);
r22777r22778
662660   m_rom_readback_addr = 0;
663661
664662   /* clear other voice parameters */
665   for (i = 0; i < 8; i++)
663   for (int i = 0; i < 8; i++)
666664   {
667665      struct YMZ280BVoice *voice = &m_voice[i];
668666
r22777r22778
935933ymz280b_device::ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
936934   : device_t(mconfig, YMZ280B, "YMZ280B", tag, owner, clock),
937935      device_sound_interface(mconfig, *this),
936      m_current_register(0),
937      m_status_register(0),
938      m_irq_state(0),
939      m_irq_mask(0),
940      m_irq_enable(0),
941      m_keyon_enable(0),
942      m_ext_mem_enable(0),
943      m_rom_addr_hi(0),
944      m_rom_addr_mid(0),
945      m_rom_readback_addr(0),
938946      m_irq_handler(*this),
939947      m_ext_read_handler(*this),
940948      m_ext_write_handler(*this)
941949{
950   memset(m_voice, 0, sizeof(m_voice));
942951}
943952
944953//-------------------------------------------------
trunk/src/emu/sound/ymz280b.h
r22777r22778
9797   int compute_status();
9898
9999   // internal state
100   sound_stream * m_stream;          /* which stream are we using */
101   UINT8 *m_region_base;             /* pointer to the base of the region */
102   UINT32 m_region_size;
100   struct YMZ280BVoice m_voice[8];   /* the 8 voices */
103101   UINT8 m_current_register;         /* currently accessible register */
104102   UINT8 m_status_register;          /* current status register */
105103   UINT8 m_irq_state;                /* current IRQ state */
r22777r22778
107105   UINT8 m_irq_enable;               /* current IRQ enable */
108106   UINT8 m_keyon_enable;             /* key on enable */
109107   UINT8 m_ext_mem_enable;           /* external memory enable */
110   double m_master_clock;            /* master clock frequency */
111   devcb2_write_line m_irq_handler;  /* IRQ callback */
112   struct YMZ280BVoice m_voice[8];   /* the 8 voices */
113108   UINT32 m_rom_addr_hi;
114109   UINT32 m_rom_addr_mid;
115110   UINT32 m_rom_readback_addr;       /* where the CPU can read the ROM */
111
112   devcb2_write_line m_irq_handler;  /* IRQ callback */
116113   devcb2_read8 m_ext_read_handler;  /* external RAM read handler */
117114   devcb2_write8 m_ext_write_handler;/* external RAM write handler */
118115
116   double m_master_clock;            /* master clock frequency */
117   UINT8 *m_region_base;             /* pointer to the base of the region */
118   UINT32 m_region_size;
119   sound_stream *m_stream;           /* which stream are we using */
120   INT16 *m_scratch;
119121#if MAKE_WAVS
120   void * m_wavresample;             /* resampled waveform */
122   void *m_wavresample;              /* resampled waveform */
121123#endif
122
123   INT16 *m_scratch;
124124};
125125
126126extern const device_type YMZ280B;
trunk/src/emu/sound/2608intf.c
r22777r22778
205205ym2608_device::ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
206206   : device_t(mconfig, YM2608, "YM2608", tag, owner, clock),
207207      device_sound_interface(mconfig, *this),
208      m_irq_handler(*this)
208      m_irq_handler(*this),
209      m_ay8910_config(NULL)
209210{
210211}
211212
trunk/src/emu/sound/ymf271.c
r22777r22778
17111711
17121712void ymf271_device::device_reset()
17131713{
1714   int i;
1715
1716   for (i = 0; i < 48; i++)
1714   for (int i = 0; i < 48; i++)
17171715   {
17181716      m_slots[i].active = 0;
17191717      m_slots[i].volume = 0;
r22777r22778
17251723ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
17261724   : device_t(mconfig, YMF271, "YMF271", tag, owner, clock),
17271725      device_sound_interface(mconfig, *this),
1726      m_timerA(0),
1727      m_timerB(0),
1728      m_timerAVal(0),
1729      m_timerBVal(0),
1730      m_irqstate(0),
1731      m_status(0),
1732      m_enable(0),
1733      m_reg0(0),
1734      m_reg1(0),
1735      m_reg2(0),
1736      m_reg3(0),
1737      m_pcmreg(0),
1738      m_timerreg(0),
1739      m_ext_address(0),
1740      m_ext_read(0),
17281741      m_irq_handler(*this),
17291742      m_ext_read_handler(*this),
17301743      m_ext_write_handler(*this)
17311744{
1745   memset(m_slots, 0, sizeof(&m_slots));
1746   memset(m_groups, 0, sizeof(&m_groups));
17321747}
17331748
17341749//-------------------------------------------------
trunk/src/emu/sound/ymf271.h
r22777r22778
115115   YMF271Slot m_slots[48];
116116   YMF271Group m_groups[12];
117117
118   INT32 m_timerA, m_timerB;
119   INT32 m_timerAVal, m_timerBVal;
118   INT32 m_timerA;
119   INT32 m_timerB;
120   INT32 m_timerAVal;
121   INT32 m_timerBVal;
120122   INT32 m_irqstate;
121123   INT8  m_status;
122124   INT8  m_enable;
123125
124   emu_timer *m_timA, *m_timB;
125
126   INT8  m_reg0, m_reg1, m_reg2, m_reg3, m_pcmreg, m_timerreg;
126   INT8  m_reg0;
127   INT8  m_reg1;
128   INT8  m_reg2;
129   INT8  m_reg3;
130   INT8  m_pcmreg;
131   INT8  m_timerreg;
127132   UINT32 m_ext_address;
128133   UINT8 m_ext_read;
129134
130135   const UINT8 *m_rom;
136   UINT32 m_clock;
137
138   emu_timer *m_timA, *m_timB;
139   sound_stream *m_stream;
140
131141   devcb2_write_line m_irq_handler;
132142   devcb2_read8 m_ext_read_handler;
133143   devcb2_write8 m_ext_write_handler;
134
135   UINT32 m_clock;
136   sound_stream * m_stream;
137144};
138145
139146extern const device_type YMF271;
trunk/src/emu/sound/2203intf.c
r22777r22778
136136   const ay8910_interface *ay8910_config = m_ay8910_config != NULL ? m_ay8910_config : &default_ay8910_config;
137137
138138   m_irq_handler.resolve();
139   m_psg = ay8910_start_ym(NULL, YM2203, this, clock(), ay8910_config);
139   m_psg = ay8910_start_ym(NULL, type(), this, clock(), ay8910_config);
140140   assert_always(m_psg != NULL, "Error creating YM2203/AY8910 chip");
141141
142142   /* Timer Handler set */
r22777r22778
206206ym2203_device::ym2203_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
207207   : device_t(mconfig, YM2203, "YM2203", tag, owner, clock),
208208      device_sound_interface(mconfig, *this),
209      m_irq_handler(*this)
209      m_irq_handler(*this),
210      m_ay8910_config(NULL)
210211{
211212}
212213

Previous 199869 Revisions Next


© 1997-2024 The MAME Team