trunk/src/emu/sound/tms5220.c
| r245289 | r245290 | |
| 322 | 322 | #define TMS5220_IS_CD2501E TMS5220_IS_5200 |
| 323 | 323 | |
| 324 | 324 | #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)) |
| 325 | 326 | |
| 326 | 327 | static 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. |
| 327 | 328 | |
| r245289 | r245290 | |
| 474 | 475 | #ifdef DEBUG_FIFO |
| 475 | 476 | logerror("data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count); |
| 476 | 477 | #endif |
| 477 | | update_status_and_ints(); |
| 478 | update_fifo_status_and_ints(); |
| 478 | 479 | if ((m_talk_status == 0) && (m_buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero... |
| 479 | 480 | { |
| 480 | 481 | int i; |
| r245289 | r245290 | |
| 514 | 515 | |
| 515 | 516 | /********************************************************************************************** |
| 516 | 517 | |
| 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 |
| 518 | 519 | Description of flags, and their position in the status register: |
| 519 | 520 | From the data sheet: |
| 520 | 521 | bit D0(bit 7) = TS - Talk Status is active (high) when the VSP is processing speech data. |
| r245289 | r245290 | |
| 535 | 536 | |
| 536 | 537 | ***********************************************************************************************/ |
| 537 | 538 | |
| 538 | | void tms5220_device::update_status_and_ints() |
| 539 | void tms5220_device::update_fifo_status_and_ints() |
| 539 | 540 | { |
| 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 |
| 542 | 543 | update_ready_state(); |
| 543 | 544 | |
| 544 | 545 | /* BL is set if neither byte 9 nor 8 of the fifo are in use; this |
| r245289 | r245290 | |
| 605 | 606 | m_fifo[m_fifo_head] = 0; // zero the newly depleted fifo head byte |
| 606 | 607 | m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE; |
| 607 | 608 | m_fifo_bits_taken = 0; |
| 608 | | update_status_and_ints(); |
| 609 | update_fifo_status_and_ints(); |
| 609 | 610 | } |
| 610 | 611 | } |
| 611 | 612 | } |
| r245289 | r245290 | |
| 797 | 798 | { |
| 798 | 799 | m_talk_status = m_speak_external = 0; |
| 799 | 800 | set_interrupt_state(1); |
| 800 | | update_status_and_ints(); |
| 801 | update_fifo_status_and_ints(); |
| 801 | 802 | } |
| 802 | 803 | |
| 803 | 804 | /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. |
| r245289 | r245290 | |
| 1250 | 1251 | } |
| 1251 | 1252 | |
| 1252 | 1253 | /* update the buffer low state */ |
| 1253 | | update_status_and_ints(); |
| 1254 | update_fifo_status_and_ints(); |
| 1254 | 1255 | } |
| 1255 | 1256 | |
| 1256 | 1257 | /****************************************************************************************** |
| r245289 | r245290 | |
| 1279 | 1280 | else // non-5220C and 5220C in fixed rate mode |
| 1280 | 1281 | m_IP = reload_table[m_c_variant_rate&0x3]; |
| 1281 | 1282 | |
| 1282 | | update_status_and_ints(); |
| 1283 | update_fifo_status_and_ints(); |
| 1283 | 1284 | if (!m_talk_status) goto ranout; |
| 1284 | 1285 | |
| 1285 | 1286 | // attempt to extract the energy index |
| r245289 | r245290 | |
| 1288 | 1289 | printbits(m_new_frame_energy_idx,m_coeff->energy_bits); |
| 1289 | 1290 | fprintf(stderr," "); |
| 1290 | 1291 | #endif |
| 1291 | | update_status_and_ints(); |
| 1292 | update_fifo_status_and_ints(); |
| 1292 | 1293 | if (!m_talk_status) goto ranout; |
| 1293 | 1294 | // if the energy index is 0 or 15, we're done |
| 1294 | 1295 | if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15)) |
| r245289 | r245290 | |
| 1308 | 1309 | printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits); |
| 1309 | 1310 | fprintf(stderr," "); |
| 1310 | 1311 | #endif |
| 1311 | | update_status_and_ints(); |
| 1312 | update_fifo_status_and_ints(); |
| 1312 | 1313 | if (!m_talk_status) goto ranout; |
| 1313 | 1314 | // if this is a repeat frame, just do nothing, it will reuse the old coefficients |
| 1314 | 1315 | if (rep_flag) |
| r245289 | r245290 | |
| 1322 | 1323 | printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); |
| 1323 | 1324 | fprintf(stderr," "); |
| 1324 | 1325 | #endif |
| 1325 | | update_status_and_ints(); |
| 1326 | update_fifo_status_and_ints(); |
| 1326 | 1327 | if (!m_talk_status) goto ranout; |
| 1327 | 1328 | } |
| 1328 | 1329 | |
| r245289 | r245290 | |
| 1341 | 1342 | printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); |
| 1342 | 1343 | fprintf(stderr," "); |
| 1343 | 1344 | #endif |
| 1344 | | update_status_and_ints(); |
| 1345 | update_fifo_status_and_ints(); |
| 1345 | 1346 | if (!m_talk_status) goto ranout; |
| 1346 | 1347 | } |
| 1347 | 1348 | #ifdef VERBOSE |
| r245289 | r245290 | |
| 1367 | 1368 | |
| 1368 | 1369 | void tms5220_device::set_interrupt_state(int state) |
| 1369 | 1370 | { |
| 1371 | if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip, since there's no int pin |
| 1370 | 1372 | #ifdef DEBUG_PIN_READS |
| 1371 | 1373 | logerror("irq pin set to state %d\n", state); |
| 1372 | 1374 | #endif |