Previous 15994 Revisions Next

r9432 Friday 22nd October, 2010 at 02:31:46 UTC by R. Belmont
Re-commit ASC changes that 0.140 update wiped out, plus note them in messnew.
[docs]messnew.txt
[src/emu/sound]asc.c asc.h

src/emu/sound/asc.c
r9431r9432
44
55    Apple Sound Chip (ASC) 344S0063
66    Enhanced Apple Sound Chip (EASC) 343S1063
7
7   
88    Emulation by R. Belmont
99
1010    Registers:
r9431r9432
101101//  LIVE DEVICE
102102//**************************************************************************
103103
104// does nothing, this timer exists only to make MAME sync itself at our audio rate
105static TIMER_CALLBACK( sync_timer_cb )
106{
107   asc_device *pDevice = (asc_device *)ptr;
108
109   stream_update(pDevice->m_stream);
110}
111
104112//-------------------------------------------------
105113//  asc_device - constructor
106114//-------------------------------------------------
r9431r9432
125133   m_stream = stream_create(this, 0, 2, 22257, this, static_stream_generate);
126134
127135   memset(m_regs, 0, sizeof(m_regs));
136
137   m_sync_timer = timer_alloc(this->machine, sync_timer_cb, this);
128138}
129139
130140
r9431r9432
190200               m_fifo_a_rdptr &= 0x3ff;
191201               m_fifo_cap_a--;
192202            }
193
203           
194204            if (m_fifo_cap_b)
195205            {
196206               m_fifo_b_rdptr++;
r9431r9432
198208               m_fifo_cap_b--;
199209            }
200210
201            if ((m_fifo_cap_a) || (m_fifo_cap_b))
211            switch (m_chip_type)
202212            {
203               switch (m_chip_type)
204               {
205                  case ASC_TYPE_SONORA:
206                     if (m_fifo_cap_a <= 0x200)
213               case ASC_TYPE_SONORA:
214                  if (m_fifo_cap_a < 0x200)
215                  {
216                     m_regs[R_FIFOSTAT-0x800] |= 0x4;   // fifo less than half full
217                     m_regs[R_FIFOSTAT-0x800] |= 0x8;   // just pass the damn test
218                     if (m_irq_cb)
207219                     {
208                        m_regs[R_FIFOSTAT-0x800] |= 0x4;   // fifo less than half full
209                        m_regs[R_FIFOSTAT-0x800] |= 0x8;   // just pass the damn test
210                        if (m_irq_cb)
211                        {
212                           m_irq_cb(this, 1);
213                        }
220                        m_irq_cb(this, 1);
214221                     }
215                     break;
222                  }
223                  break;
216224
217                  default:
218                     if (m_fifo_cap_a <= 0x200)
225               default:
226                  if (m_fifo_cap_a == 0x1ff)
227                  {
228                     m_regs[R_FIFOSTAT-0x800] |= 1;   // fifo A half-empty
229                     if (m_irq_cb)
219230                     {
220                        m_regs[R_FIFOSTAT-0x800] |= 1;   // fifo A half-empty
221                        if (m_irq_cb)
222                        {
223                           m_irq_cb(this, 1);
224                        }
231                        m_irq_cb(this, 1);
225232                     }
233                  }
234                  else if (m_fifo_cap_a == 0x1)   // fifo A fully empty
235                  {
236                     m_regs[R_FIFOSTAT-0x800] |= 2;   // fifo A empty
237                     if (m_irq_cb)
238                     {
239                        m_irq_cb(this, 1);
240                     }
241                  }
226242
227                     // don't update for non-(E)ASC
228                     if (m_fifo_cap_b <= 0x200)
243                  if (m_fifo_cap_b == 0x1ff)
244                  {
245                     m_regs[R_FIFOSTAT-0x800] |= 4;   // fifo B half-empty
246                     if (m_irq_cb)
229247                     {
230                        m_regs[R_FIFOSTAT-0x800] |= 4;   // fifo B half-empty
231                        if (m_irq_cb)
232                        {
233                           m_irq_cb(this, 1);
234                        }
248                        m_irq_cb(this, 1);
235249                     }
236                     break;
237               }
250                  }
251                  else if (m_fifo_cap_b == 0x1)   // fifo B fully empty
252                  {
253                     m_regs[R_FIFOSTAT-0x800] |= 8;   // fifo B empty
254                     if (m_irq_cb)
255                     {
256                        m_irq_cb(this, 1);
257                     }
258                  }
259                  break;
238260            }
239261
240262            outL[i] = smpll * 64;
r9431r9432
249271            INT8 smpl;
250272
251273            mixL = mixR = 0;
252
274         
253275            // update channel pointers
254276            for (ch = 0; ch < 4; ch++)
255277            {
r9431r9432
274296         }
275297         break;
276298   }
299
300//   printf("rdA %04x rdB %04x wrA %04x wrB %04x (capA %04x B %04x)\n", m_fifo_a_rdptr, m_fifo_b_rdptr, m_fifo_a_wrptr, m_fifo_b_wrptr, m_fifo_cap_a, m_fifo_cap_b);
277301}
278302
279303//-------------------------------------------------
r9431r9432
284308{
285309   UINT8 rv;
286310
287//  printf("ASC: read at %x\n", offset);
311//   printf("ASC: read at %x\n", offset);
288312
289313   // not sure what actually happens when the CPU reads the FIFO...
290314   if (offset < 0x400)
r9431r9432
358382               rv = m_regs[R_FIFOSTAT-0x800];
359383            }
360384
385//            printf("Read FIFO stat = %02x\n", rv);
386
361387            // reading this register clears all bits
362388            m_regs[R_FIFOSTAT-0x800] = 0;
363389
364            // reading this clears interrupts?
390            // reading this clears interrupts
365391            if (m_irq_cb)
366392            {
367393               m_irq_cb(this, 0);
r9431r9432
416442
417443void asc_device::write(UINT16 offset, UINT8 data)
418444{
419//  printf("ASC: write %02x to %x\n", data, offset);
445//   printf("ASC: write %02x to %x\n", data, offset);
420446
421447   if (offset < 0x400)
422448   {
r9431r9432
425451         m_fifo_a[m_fifo_a_wrptr++] = data;
426452         m_fifo_cap_a++;
427453
428         if (m_fifo_cap_a == 0x800)
454         if (m_fifo_cap_a == 0x3ff)
429455         {
430456            m_regs[R_FIFOSTAT-0x800] |= 2;   // fifo A full
431457         }
r9431r9432
444470         m_fifo_b[m_fifo_b_wrptr++] = data;
445471         m_fifo_cap_b++;
446472
447         if (m_fifo_cap_b == 0x800)
473         if (m_fifo_cap_b == 0x3ff)
448474         {
449475            m_regs[R_FIFOSTAT-0x800] |= 8;   // fifo B full
450476         }
451477
452478         m_fifo_b_wrptr &= 0x3ff;
453      }
479      }   
454480      else
455481      {
456482         m_fifo_b[offset-0x400] = data;
r9431r9432
458484   }
459485   else
460486   {
461//      printf("ASC: %02x to %x (was %x)\n", data, offset, m_regs[offset-0x800]);
487//      printf("ASC: %02x to %x (was %x)\n", data, offset, m_regs[offset-0x800]);
462488
463489      stream_update(m_stream);
464490      switch (offset)
r9431r9432
471497               m_fifo_a_rdptr = m_fifo_b_rdptr = 0;
472498               m_fifo_a_wrptr = m_fifo_b_wrptr = 0;
473499               m_fifo_cap_a = m_fifo_cap_b = 0;
500
501               if (data != 0)
502               {
503                  timer_adjust_periodic(m_sync_timer, attotime_zero, 0, ATTOTIME_IN_HZ(22257/4));
504               }
505               else
506               {
507                  timer_adjust_oneshot(m_sync_timer, attotime_never, 0);
508               }
474509            }
475510            break;
476511
r9431r9432
484519            break;
485520
486521         case R_WTCONTROL:
487//              printf("One-shot wavetable %02x\n", data);
522//            printf("One-shot wavetable %02x\n", data);
488523            break;
489524
490         case 0x811:
525         case 0x811:
491526            m_phase[0] &= 0x00ffff;
492527            m_phase[0] |= data<<16;
493528            break;
r9431r9432
502537            m_phase[0] |= data;
503538            break;
504539
505         case 0x815:
540         case 0x815:
506541            m_incr[0] &= 0x00ffff;
507542            m_incr[0] |= data<<16;
508543            break;
r9431r9432
517552            m_incr[0] |= data;
518553            break;
519554
520         case 0x819:
555         case 0x819:
521556            m_phase[1] &= 0x00ffff;
522557            m_phase[1] |= data<<16;
523558            break;
r9431r9432
532567            m_phase[1] |= data;
533568            break;
534569
535         case 0x81d:
570         case 0x81d:
536571            m_incr[1] &= 0x00ffff;
537572            m_incr[1] |= data<<16;
538573            break;
r9431r9432
547582            m_incr[1] |= data;
548583            break;
549584
550         case 0x821:
585         case 0x821:
551586            m_phase[2] &= 0x00ffff;
552587            m_phase[2] |= data<<16;
553588            break;
r9431r9432
562597            m_phase[2] |= data;
563598            break;
564599
565         case 0x825:
600         case 0x825:
566601            m_incr[2] &= 0x00ffff;
567602            m_incr[2] |= data<<16;
568603            break;
r9431r9432
577612            m_incr[2] |= data;
578613            break;
579614
580         case 0x829:
615         case 0x829:
581616            m_phase[3] &= 0x00ffff;
582617            m_phase[3] |= data<<16;
583618            break;
r9431r9432
592627            m_phase[3] |= data;
593628            break;
594629
595         case 0x82d:
630         case 0x82d:
596631            m_incr[3] &= 0x00ffff;
597632            m_incr[3] |= data<<16;
598633            break;
src/emu/sound/asc.h
r9431r9432
9999   UINT8 read(UINT16 offset);
100100   void write(UINT16 offset, UINT8 data);
101101
102   sound_stream *m_stream;
103
102104protected:
103105   enum
104106   {
r9431r9432
133135
134136   UINT8   m_chip_type;
135137   void (*m_irq_cb)(running_device *device, int state);
136   sound_stream *m_stream;
137138
138139   UINT8   m_fifo_a[0x400];
139140   UINT8   m_fifo_b[0x400];
r9431r9432
145146   int   m_fifo_a_rdptr, m_fifo_b_rdptr;
146147   int   m_fifo_a_wrptr, m_fifo_b_wrptr;
147148   int    m_fifo_cap_a, m_fifo_cap_b;
149
150   emu_timer *m_sync_timer;
148151};
149152
150153
docs/messnew.txt
r9431r9432
6969
7070- [HECTOR] Added initial support for DISK II unit [JJ Stacino]
7171
72- [MAC] Macintosh IIci now boots, promoted to working [R. Belmont]
72- [MAC] Macintosh IIci now boots, promoted to working. [R. Belmont]
7373
7474- [MAC] Improvements to PMU and Egret MCU emulation. [R. Belmont]
7575
76- [MAC] Greatly improved Apple Sound Chip emulation for Mac II, IIx,
77  IIcx, and SE/30. [R. Belmont]
78
7679- [MBEE] Added Chess rom. [Robbbert]
7780
7881- [POFO] Refactored driver to define ADDRESS_MAP_MODERN. [Curt Coder]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team