Previous 199869 Revisions Next

r36778 Sunday 29th March, 2015 at 19:18:35 UTC by Jonathan Gevaryahu
tms5220: some preparation for a possible future merge of tms51xx and 52xx into one .c file (n/w)
[src/emu/sound]tms5220.c tms5220.h

trunk/src/emu/sound/tms5220.c
r245289r245290
322322#define TMS5220_IS_CD2501E  TMS5220_IS_5200
323323
324324#define TMS5220_HAS_RATE_CONTROL ((m_variant == TMS5220_IS_5220C) || (m_variant == TMS5220_IS_CD2501ECD))
325#define TMS5220_IS_52xx ((m_variant == TMS5220_IS_5220C) || (m_variant == TMS5220_IS_5200) || (m_variant == TMS5220_IS_5220) || (m_variant == TMS5220_IS_CD2501ECD))
325326
326327static const UINT8 reload_table[4] = { 0, 2, 4, 6 }; //sample count reload for 5220c and cd2501ecd only; 5200 and 5220 always reload with 0; keep in mind this is loaded on IP=0 PC=12 subcycle=1 so it immediately will increment after one sample, effectively being 1,3,5,7 as in the comments above.
327328
r245289r245290
474475#ifdef DEBUG_FIFO
475476         logerror("data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count);
476477#endif
477         update_status_and_ints();
478         update_fifo_status_and_ints();
478479         if ((m_talk_status == 0) && (m_buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero...
479480         {
480481         int i;
r245289r245290
514515
515516/**********************************************************************************************
516517
517     update_status_and_ints -- check to see if the various flags should be on or off
518     update_fifo_status_and_ints -- check to see if the various flags should be on or off
518519     Description of flags, and their position in the status register:
519520      From the data sheet:
520521        bit D0(bit 7) = TS - Talk Status is active (high) when the VSP is processing speech data.
r245289r245290
535536
536537***********************************************************************************************/
537538
538void tms5220_device::update_status_and_ints()
539void tms5220_device::update_fifo_status_and_ints()
539540{
540   /* update flags and set ints if needed */
541
541   /* update 52xx fifo flags and set ints if needed */
542   if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip
542543   update_ready_state();
543544
544545   /* BL is set if neither byte 9 nor 8 of the fifo are in use; this
r245289r245290
605606            m_fifo[m_fifo_head] = 0; // zero the newly depleted fifo head byte
606607            m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE;
607608            m_fifo_bits_taken = 0;
608            update_status_and_ints();
609            update_fifo_status_and_ints();
609610         }
610611      }
611612   }
r245289r245290
797798            {
798799               m_talk_status = m_speak_external = 0;
799800               set_interrupt_state(1);
800               update_status_and_ints();
801               update_fifo_status_and_ints();
801802            }
802803
803804         /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it.
r245289r245290
12501251   }
12511252
12521253   /* update the buffer low state */
1253   update_status_and_ints();
1254   update_fifo_status_and_ints();
12541255}
12551256
12561257/******************************************************************************************
r245289r245290
12791280   else // non-5220C and 5220C in fixed rate mode
12801281   m_IP = reload_table[m_c_variant_rate&0x3];
12811282
1282   update_status_and_ints();
1283   update_fifo_status_and_ints();
12831284   if (!m_talk_status) goto ranout;
12841285
12851286   // attempt to extract the energy index
r245289r245290
12881289   printbits(m_new_frame_energy_idx,m_coeff->energy_bits);
12891290   fprintf(stderr," ");
12901291#endif
1291   update_status_and_ints();
1292   update_fifo_status_and_ints();
12921293   if (!m_talk_status) goto ranout;
12931294   // if the energy index is 0 or 15, we're done
12941295   if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15))
r245289r245290
13081309   printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits);
13091310   fprintf(stderr," ");
13101311#endif
1311   update_status_and_ints();
1312   update_fifo_status_and_ints();
13121313   if (!m_talk_status) goto ranout;
13131314   // if this is a repeat frame, just do nothing, it will reuse the old coefficients
13141315   if (rep_flag)
r245289r245290
13221323      printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
13231324      fprintf(stderr," ");
13241325#endif
1325      update_status_and_ints();
1326      update_fifo_status_and_ints();
13261327      if (!m_talk_status) goto ranout;
13271328   }
13281329
r245289r245290
13411342      printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
13421343      fprintf(stderr," ");
13431344#endif
1344      update_status_and_ints();
1345      update_fifo_status_and_ints();
13451346      if (!m_talk_status) goto ranout;
13461347   }
13471348#ifdef VERBOSE
r245289r245290
13671368
13681369void tms5220_device::set_interrupt_state(int state)
13691370{
1371   if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip, since there's no int pin
13701372#ifdef DEBUG_PIN_READS
13711373   logerror("irq pin set to state %d\n", state);
13721374#endif
trunk/src/emu/sound/tms5220.h
r245289r245290
7373private:
7474   void register_for_save_states();
7575   void data_write(int data);
76   void update_status_and_ints();
76   void update_fifo_status_and_ints();
7777   int extract_bits(int count);
7878   int status_read();
7979   int ready_read();


Previous 199869 Revisions Next


© 1997-2024 The MAME Team