Previous 199869 Revisions Next

r36956 Sunday 5th April, 2015 at 18:07:50 UTC by Angelo Salese
Part I of refactoring, nw
[src/emu/sound]l7a1045_l6028_dsp_a.c l7a1045_l6028_dsp_a.h

trunk/src/emu/sound/l7a1045_l6028_dsp_a.c
r245467r245468
11/***************************************************************************
22
3    L7A1045 L6028 DSP-A
3    L7A1045 L6028 DSP-A
44   (QFP120 package)
55
66   this is the audio chip used on the following
r245467r245468
4444
4545   7  ----------------   ----------------   llllllllrrrrrrrr left/right volume
4646
47   8  ----------------   ----------------   ---------------- (read only?)                                                       
47   8  ----------------   ----------------   ---------------- (read only?)
4848
4949   9  ----------------   ----------------   ---------------- (read only?)
5050
r245467r245468
149149            if ((start + pos) >= end)
150150            {
151151               m_key &= ~(1 << i);
152           
152
153153            }
154154
155155            sample = (INT8)m_rom[(start + pos) & (m_rom_size-1)];
r245467r245468
168168
169169WRITE16_MEMBER( l7a1045_sound_device::l7a1045_sound_w )
170170{
171   m_stream->update();
171   m_stream->update(); // TODO
172172
173   switch (offset)
174   {
175   case 0x00:l7a1045_sound_select_w(space, offset, data, mem_mask); break;
176   case 0x01:l7a1045_sound_data_02_w(space, offset, data, mem_mask); break;
177   case 0x02:l7a1045_sound_data_04_w(space, offset, data, mem_mask); break;
178   case 0x03:l7a1045_sound_data_06_w(space, offset, data, mem_mask); break;
179   }
180
173   if(offset == 0)
174      sound_select_w(space, offset, data, mem_mask);
175   else
176      sound_data_w(space,offset - 1,data,mem_mask);
181177}
182178
183179
r245467r245468
199195}
200196
201197
202WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_select_w)
198WRITE16_MEMBER(l7a1045_sound_device::sound_select_w)
203199{
204200   // I'm guessing these addresses are the sound chip / DSP?
205201
r245467r245468
222218
223219}
224220
225WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_02_w) // upper? word of various registers?
221WRITE16_MEMBER(l7a1045_sound_device::sound_data_w)
226222{
227   m_audiodat[m_audioregister][m_audiochannel].dat[2] = data;
223//   if(m_audioregister == 0)
224//      printf("%04x %04x (%04x|%04x %04x)\n",offset,data,offset ^ 2,m_audioregister,m_audiochannel);
228225
229   // write with registers 00, 01, 04, 06, 05, 03, 07, 02 on startup
230   // groups writes of register 0a per channel
226   m_audiodat[m_audioregister][m_audiochannel].dat[offset] = data;
231227
232   // register 08 / 09 not written?
233   switch (m_audioregister)
228   if(offset == 0)
234229   {
235   default:
236230
237   case 0x08:
238   case 0x09:
239      printf("%08x: unexpected write port 0x0002 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
240      break;
241
242//   case 0x00:
243   case 0x01:
244   case 0x04:
245   case 0x06:
246   case 0x05:
247   case 0x03:
248   case 0x02:
249   case 0x07:
250
251   case 0x0a:
252   //   printf("%08x: write port 0x0002 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
253      break;
254
231   switch (m_audioregister)
232   {
255233   case 0x00:
256234      // hack
257      l7a1045_voice *vptr = &m_voice[m_audiochannel];   
235      l7a1045_voice *vptr = &m_voice[m_audiochannel];
258236
259237      m_key |= 1 << m_audiochannel;
260238
261239      vptr->frac = 0;
262240      vptr->pos = 0;
263241
264      vptr->start = (m_audiodat[0][m_audiochannel].dat[0] & 0x000f) << (16 + 4);
265      vptr->start |=   (m_audiodat[0][m_audiochannel].dat[1] & 0xffff) << (4);
266      vptr->start |=   (m_audiodat[0][m_audiochannel].dat[2] & 0xf000) >> (12);
242      vptr->start = (m_audiodat[0][m_audiochannel].dat[2] & 0x000f) << (16 + 4);
243      vptr->start |= (m_audiodat[0][m_audiochannel].dat[1] & 0xffff) << (4);
244      vptr->start |= (m_audiodat[0][m_audiochannel].dat[0] & 0xf000) >> (12);
267245
268246      vptr->start &= m_rom_size - 1;
269247
270248      //printf("%08x: REGISTER 00 write port 0x0002 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
271249      break;
272250   }
273
274251}
275
276WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_04_w) // lower? word of various registers?
277{
278   m_audiodat[m_audioregister][m_audiochannel].dat[1] = data;
279
280   // write with registers 00, 04, 06, 05, 03, 07, 02, 01 on startup
281   // groups writes of register 0a per channel
282
283   // register 08 / 09 not written?
284
285   switch (m_audioregister)
286   {
287   default:
288
289   case 0x08:
290   case 0x09:
291      printf("%08x: unexpected write port 0x0004 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
292      break;
293
294//   case 0x00:
295   case 0x04:
296   case 0x06:
297   case 0x05:
298   case 0x03:
299   case 0x07:
300   case 0x01:
301   case 0x02:
302
303   case 0x0a:
304      //printf("%08x: write port 0x0004 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
305      break;
306
307   case 0x00:
308      //printf("%08x: REGISTER 00 write port 0x0004 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
309      break;
310   }
311
312252}
313WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_06_w) // other part? of various registers.. less used than 02/04, maybe flags?
314{
315   // 00 / 01 written at startup
316   // nothing else used?
317253
318   m_audiodat[m_audioregister][m_audiochannel].dat[0] = data;
319   switch (m_audioregister)
320   {
321   default:
322254
323   case 0x02:
324   case 0x03:
325   case 0x04:
326   case 0x05:
327   case 0x06:
328   case 0x07:
329   case 0x08:
330   case 0x09:
331   case 0x0a:
332      printf("%08x: unexpected write port 0x0006 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
333      break;
334
335//   case 0x00:
336   case 0x01:
337      //printf("%08x: unexpected write port 0x0006 register %02x chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
338      break;
339
340   case 0x00:
341
342      // it writes 2 values here for each sample
343      // the 2nd one seems to contain the upper 4 bits of the sample address
344      // so why does it write different data first?
345      //printf("%08x: REGISTER 00 write port 0x0006 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]);
346      break;
347
348   }
349}
350
351
352255READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0004_r)
353256{
354257   // it writes the channel select before reading this.. so either it works on channels, or the command..
trunk/src/emu/sound/l7a1045_l6028_dsp_a.h
r245467r245468
1515   UINT32 start;
1616   UINT32 pos;
1717   UINT32 frac;
18   
18
1919};
2020
2121// ======================> l7a1045_sound_device
r245467r245468
5555
5656   l7a1045_48bit_data m_audiodat[0x10][0x20];
5757
58   DECLARE_WRITE16_MEMBER(l7a1045_sound_select_w);
59   DECLARE_WRITE16_MEMBER(l7a1045_sound_data_02_w);
60   DECLARE_WRITE16_MEMBER(l7a1045_sound_data_04_w);
61   DECLARE_WRITE16_MEMBER(l7a1045_sound_data_06_w);
58   DECLARE_WRITE16_MEMBER(sound_select_w);
59   DECLARE_WRITE16_MEMBER(sound_data_w);
6260
6361   DECLARE_READ16_MEMBER(l7a1045_sound_port_0004_r);
6462   DECLARE_READ16_MEMBER(l7a1045_sound_port_0006_r);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team