trunk/src/emu/sound/tms5110.c
| r249025 | r249026 | |
| 14 | 14 | |
| 15 | 15 | Todo: |
| 16 | 16 | - implement CS |
| 17 | | - implement missing commands |
| 18 | 17 | - TMS5110_CMD_TEST_TALK is only partially implemented |
| 19 | 18 | |
| 20 | 19 | TMS5100: |
| r249025 | r249026 | |
| 212 | 211 | { |
| 213 | 212 | save_item(NAME(m_variant)); |
| 214 | 213 | |
| 215 | | save_item(NAME(m_fifo)); |
| 216 | | save_item(NAME(m_fifo_head)); |
| 217 | | save_item(NAME(m_fifo_tail)); |
| 218 | | save_item(NAME(m_fifo_count)); |
| 219 | | |
| 220 | 214 | save_item(NAME(m_PDC)); |
| 221 | 215 | save_item(NAME(m_CTL_pins)); |
| 222 | 216 | save_item(NAME(m_SPEN)); |
| r249025 | r249026 | |
| 240 | 234 | save_item(NAME(m_old_frame_energy_idx)); |
| 241 | 235 | save_item(NAME(m_old_frame_pitch_idx)); |
| 242 | 236 | save_item(NAME(m_old_frame_k_idx)); |
| 237 | save_item(NAME(m_old_zpar)); |
| 238 | save_item(NAME(m_old_uv_zpar)); |
| 243 | 239 | #endif |
| 244 | 240 | save_item(NAME(m_current_energy)); |
| 245 | 241 | save_item(NAME(m_current_pitch)); |
| r249025 | r249026 | |
| 309 | 305 | } |
| 310 | 306 | #endif |
| 311 | 307 | |
| 312 | | |
| 313 | 308 | /****************************************************************************************** |
| 314 | 309 | |
| 315 | | FIFO_data_write -- handle bit data write to the TMS5110 (as a result of toggling M0 pin) |
| 310 | extract_bits -- extract a specific number of bits from the VSM |
| 316 | 311 | |
| 317 | 312 | ******************************************************************************************/ |
| 318 | | void tms5110_device::FIFO_data_write(int data) |
| 319 | | { |
| 320 | | /* add this bit to the FIFO */ |
| 321 | | if (m_fifo_count < FIFO_SIZE) |
| 322 | | { |
| 323 | | m_fifo[m_fifo_tail] = (data&1); /* set bit to 1 or 0 */ |
| 324 | 313 | |
| 325 | | m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE; |
| 326 | | m_fifo_count++; |
| 327 | | |
| 328 | | if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", m_fifo_count); |
| 329 | | } |
| 330 | | else |
| 331 | | { |
| 332 | | if (DEBUG_5110) logerror("Ran out of room in the FIFO!\n"); |
| 333 | | } |
| 334 | | } |
| 335 | | |
| 336 | | /****************************************************************************************** |
| 337 | | |
| 338 | | extract_bits -- extract a specific number of bits from the FIFO |
| 339 | | |
| 340 | | ******************************************************************************************/ |
| 341 | | |
| 342 | 314 | int tms5110_device::extract_bits(int count) |
| 343 | 315 | { |
| 344 | 316 | int val = 0; |
| 345 | | if (DEBUG_5110) logerror("requesting %d bits from fifo: ", count); |
| 346 | | while (count--) |
| 317 | if (DEBUG_5110) logerror("requesting %d bits", count); |
| 318 | for (int i = 0; i < count; i++) |
| 347 | 319 | { |
| 348 | | val = (val << 1) | (m_fifo[m_fifo_head] & 1); |
| 349 | | m_fifo_count--; |
| 350 | | m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE; |
| 320 | val = (val<<1) | new_int_read(); |
| 321 | if (DEBUG_5110) logerror("bit read: %d\n", val&1); |
| 351 | 322 | } |
| 352 | 323 | if (DEBUG_5110) logerror("returning: %02x\n", val); |
| 353 | 324 | return val; |
| 354 | 325 | } |
| 355 | 326 | |
| 356 | | void tms5110_device::request_bits(int no) |
| 357 | | { |
| 358 | | for (int i = 0; i < no; i++) |
| 359 | | { |
| 360 | | UINT8 data = new_int_read(); |
| 361 | | if (DEBUG_5110) logerror("bit added to fifo: %d\n", data); |
| 362 | | FIFO_data_write(data); |
| 363 | | } |
| 364 | | } |
| 365 | 327 | |
| 366 | 328 | void tms5110_device::perform_dummy_read() |
| 367 | 329 | { |
| r249025 | r249026 | |
| 388 | 350 | int i, bitout; |
| 389 | 351 | INT32 this_sample; |
| 390 | 352 | |
| 391 | | /* if we're not speaking, fill with nothingness */ |
| 392 | | if (!m_TALKD) |
| 393 | | goto empty; |
| 394 | | |
| 395 | 353 | /* loop until the buffer is full or we've stopped speaking */ |
| 396 | | while ((size > 0) && m_TALKD) |
| 354 | while (size > 0) |
| 397 | 355 | { |
| 398 | | /* if it is the appropriate time to update the old energy/pitch indices, |
| 399 | | * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17 |
| 400 | | * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1), |
| 401 | | * which happens 4 T-cycles later), we change on the latter. |
| 402 | | * The indices are updated here ~12 PCs before the new frame is applied. |
| 403 | | */ |
| 404 | | /** TODO: the patents 4331836, 4335277, and 4419540 disagree about the timing of this **/ |
| 405 | | if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2)) |
| 356 | if(m_TALKD) // speaking |
| 406 | 357 | { |
| 407 | | m_OLDE = (m_new_frame_energy_idx == 0); |
| 408 | | m_OLDP = (m_new_frame_pitch_idx == 0); |
| 409 | | } |
| 358 | /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1 |
| 359 | * (In reality, the frame was really loaded incrementally during the entire IP=0 |
| 360 | * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens) |
| 361 | */ |
| 362 | if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1)) |
| 363 | { |
| 364 | // HACK for regression testing, be sure to comment out before release! |
| 365 | //m_RNG = 0x1234; |
| 366 | // end HACK |
| 410 | 367 | |
| 411 | | /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1 |
| 412 | | * (In reality, the frame was really loaded incrementally during the entire IP=0 |
| 413 | | * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens) |
| 414 | | */ |
| 415 | | if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1)) |
| 416 | | { |
| 417 | | // HACK for regression testing, be sure to comment out before release! |
| 418 | | //m_RNG = 0x1234; |
| 419 | | // end HACK |
| 420 | | |
| 421 | 368 | #ifdef PERFECT_INTERPOLATION_HACK |
| 422 | | /* remember previous frame energy, pitch, and coefficients */ |
| 423 | | m_old_frame_energy_idx = m_new_frame_energy_idx; |
| 424 | | m_old_frame_pitch_idx = m_new_frame_pitch_idx; |
| 425 | | for (i = 0; i < m_coeff->num_k; i++) |
| 426 | | m_old_frame_k_idx[i] = m_new_frame_k_idx[i]; |
| 369 | /* remember previous frame energy, pitch, and coefficients */ |
| 370 | m_old_frame_energy_idx = m_new_frame_energy_idx; |
| 371 | m_old_frame_pitch_idx = m_new_frame_pitch_idx; |
| 372 | for (i = 0; i < m_coeff->num_k; i++) |
| 373 | m_old_frame_k_idx[i] = m_new_frame_k_idx[i]; |
| 427 | 374 | #endif |
| 428 | 375 | |
| 429 | | /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */ |
| 430 | | parse_frame(); |
| 431 | | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 432 | | fprintf(stderr,"\n"); |
| 376 | /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */ |
| 377 | parse_frame(); |
| 378 | |
| 379 | // if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters |
| 380 | // NOTE: this is probably the bug the tms5100/tmc0280 has, pre-rev D, I think. |
| 381 | // GUESS: Pre-rev D versions start zeroing k5-k10 immediately upon new frame load regardless of interpolation inhibit |
| 382 | // I.e. ZPAR = /TALKD || (PC>5&&P=0) |
| 383 | // GUESS: D and later versions only start or stop zeroing k5-k10 at the IP7->IP0 transition AFTER the frame |
| 384 | // I.e. ZPAR = /TALKD || (PC>5&&OLDP) |
| 385 | #ifdef PERFECT_INTERPOLATION_HACK |
| 386 | m_old_uv_zpar = m_uv_zpar; |
| 387 | m_old_zpar = m_zpar; // unset old zpar on new frame |
| 433 | 388 | #endif |
| 434 | | /* if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters */ |
| 435 | | m_uv_zpar = NEW_FRAME_UNVOICED_FLAG | m_zpar; |
| 389 | m_zpar = 0; |
| 390 | //m_uv_zpar = (OLD_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: fixed version in tmc0280d/tms5100a/cd280x/tms5110 |
| 391 | m_uv_zpar = (NEW_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: buggy version in tmc0280/tms5100 |
| 436 | 392 | |
| 437 | | /* if the new frame is a stop frame, unset both TALK and SPEN. TALKD remains active while the energy is ramping to 0. */ |
| 438 | | if (NEW_FRAME_STOP_FLAG == 1) |
| 439 | | { |
| 440 | | m_TALK = m_SPEN = 0; |
| 441 | | } |
| 393 | /* if the new frame is a stop frame, unset both TALK and SPEN (via TCON). TALKD remains active while the energy is ramping to 0. */ |
| 394 | if (NEW_FRAME_STOP_FLAG == 1) |
| 395 | { |
| 396 | m_TALK = m_SPEN = 0; |
| 397 | } |
| 442 | 398 | |
| 443 | | /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. |
| 444 | | Interpolation inhibit cases: |
| 445 | | * Old frame was voiced, new is unvoiced |
| 446 | | * Old frame was silence/zero energy, new has nonzero energy |
| 447 | | * Old frame was unvoiced, new is voiced (note this is the case on the patent but may not be correct on the real final chip) |
| 448 | | */ |
| 449 | | if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1)) |
| 450 | | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) /* this line needs further investigation, starwars tie fighters may sound better without it */ |
| 451 | | || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) ) |
| 452 | | m_inhibit = 1; |
| 453 | | else // normal frame, normal interpolation |
| 454 | | m_inhibit = 0; |
| 399 | /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. |
| 400 | Interpolation inhibit cases: |
| 401 | * Old frame was voiced, new is unvoiced |
| 402 | * Old frame was silence/zero energy, new has nonzero energy |
| 403 | * Old frame was unvoiced, new is voiced (note this is the case on the patent but may not be correct on the real final chip) |
| 404 | */ |
| 405 | if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1)) |
| 406 | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) /* this line needs further investigation, starwars tie fighters may sound better without it */ |
| 407 | || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) ) |
| 408 | m_inhibit = 1; |
| 409 | else // normal frame, normal interpolation |
| 410 | m_inhibit = 0; |
| 455 | 411 | |
| 456 | 412 | #ifdef DEBUG_GENERATION |
| 457 | | /* Debug info for current parsed frame */ |
| 458 | | fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP); |
| 459 | | fprintf(stderr,"Processing frame: "); |
| 460 | | if (m_inhibit == 0) |
| 461 | | fprintf(stderr, "Normal Frame\n"); |
| 462 | | else |
| 463 | | fprintf(stderr,"Interpolation Inhibited\n"); |
| 464 | | fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]); |
| 465 | | fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n", |
| 466 | | (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)), |
| 467 | | m_new_frame_energy_idx, |
| 468 | | (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)), |
| 469 | | (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)), |
| 470 | | (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)), |
| 471 | | (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)), |
| 472 | | (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)), |
| 473 | | (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)), |
| 474 | | (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)), |
| 475 | | (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)), |
| 476 | | (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)), |
| 477 | | (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)), |
| 478 | | (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) ); |
| 413 | /* Debug info for current parsed frame */ |
| 414 | fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP); |
| 415 | fprintf(stderr,"Processing new frame: "); |
| 416 | if (m_inhibit == 0) |
| 417 | fprintf(stderr, "Normal Frame\n"); |
| 418 | else |
| 419 | fprintf(stderr,"Interpolation Inhibited\n"); |
| 420 | fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]); |
| 421 | fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n", |
| 422 | (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)), |
| 423 | m_new_frame_energy_idx, |
| 424 | (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)), |
| 425 | (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)), |
| 426 | (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)), |
| 427 | (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)), |
| 428 | (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)), |
| 429 | (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)), |
| 430 | (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)), |
| 431 | (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)), |
| 432 | (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)), |
| 433 | (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)), |
| 434 | (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) ); |
| 479 | 435 | #endif |
| 480 | 436 | |
| 481 | | } |
| 482 | | else // Not a new frame, just interpolate the existing frame. |
| 483 | | { |
| 484 | | int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value |
| 485 | | #ifdef PERFECT_INTERPOLATION_HACK |
| 486 | | int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW |
| 487 | | //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW |
| 488 | | int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7)); |
| 489 | | //fprintf(stderr, "CS: %03d", current_sample); |
| 490 | | // reset the current energy, pitch, etc to what it was at frame start |
| 491 | | m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_zpar)); |
| 492 | | m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar)); |
| 493 | | for (i = 0; i < 4; i++) |
| 494 | | m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-m_old_zpar)); |
| 495 | | for (i = 4; i < m_coeff->num_k; i++) |
| 496 | | m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-m_uv_zpar)); |
| 497 | | // now adjust each value to be exactly correct for each of the samples per frame |
| 498 | | if (m_IP != 0) // if we're still interpolating... |
| 499 | | { |
| 500 | | m_current_energy += ((((m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)) - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 501 | | m_current_pitch += ((((m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)) - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 502 | | for (i = 0; i < m_coeff->num_k; i++) |
| 503 | | m_current_k[i] += ((((m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar))) - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 504 | 437 | } |
| 505 | | else // we're done, play this frame for 1/8 frame. |
| 438 | else // Not a new frame, just interpolate the existing frame. |
| 506 | 439 | { |
| 507 | | m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)); |
| 508 | | m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)); |
| 440 | int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value |
| 441 | #ifdef PERFECT_INTERPOLATION_HACK |
| 442 | int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW |
| 443 | //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW |
| 444 | int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7)); |
| 445 | //fprintf(stderr, "CS: %03d", current_sample); |
| 446 | // reset the current energy, pitch, etc to what it was at frame start |
| 447 | m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_old_zpar)); |
| 448 | m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar)); |
| 509 | 449 | for (i = 0; i < m_coeff->num_k; i++) |
| 510 | | m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar))); |
| 511 | | } |
| 450 | m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-((i<4)?m_old_zpar:m_old_uv_zpar))); |
| 451 | // now adjust each value to be exactly correct for each of the samples per frame |
| 452 | if (m_IP != 0) // if we're still interpolating... |
| 453 | { |
| 454 | m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar); |
| 455 | m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar); |
| 456 | for (i = 0; i < m_coeff->num_k; i++) |
| 457 | m_current_k[i] = (m_current_k[i] + (((m_coeff->ktable[i][m_new_frame_k_idx[i]] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-((i<4)?m_zpar:m_uv_zpar)); |
| 458 | } |
| 459 | else // we're done, play this frame for 1/8 frame. |
| 460 | { |
| 461 | m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)); |
| 462 | m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)); |
| 463 | for (i = 0; i < m_coeff->num_k; i++) |
| 464 | m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar))); |
| 465 | } |
| 512 | 466 | #else |
| 513 | | //Updates to parameters only happen on subcycle '2' (B cycle) of PCs. |
| 514 | | if (m_subcycle == 2) |
| 515 | | { |
| 516 | | switch(m_PC) |
| 467 | //Updates to parameters only happen on subcycle '2' (B cycle) of PCs. |
| 468 | if (m_subcycle == 2) |
| 517 | 469 | { |
| 518 | | case 0: /* PC = 0, B cycle, write updated energy */ |
| 519 | | m_current_energy += ((((m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)) - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT); |
| 520 | | break; |
| 521 | | case 1: /* PC = 1, B cycle, write updated pitch */ |
| 522 | | m_current_pitch += ((((m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)) - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT); |
| 523 | | break; |
| 524 | | case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
| 525 | | /* PC = 2 through 11, B cycle, write updated K1 through K10 */ |
| 526 | | m_current_k[m_PC-2] += ((((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] * (1-(((m_PC-2)<4)?m_zpar:m_uv_zpar))) - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT); |
| 527 | | break; |
| 528 | | case 12: /* PC = 12, do nothing */ |
| 529 | | break; |
| 470 | switch(m_PC) |
| 471 | { |
| 472 | case 0: /* PC = 0, B cycle, write updated energy */ |
| 473 | m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar); |
| 474 | break; |
| 475 | case 1: /* PC = 1, B cycle, write updated pitch */ |
| 476 | m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar); |
| 477 | break; |
| 478 | case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
| 479 | /* PC = 2 through 11, B cycle, write updated K1 through K10 */ |
| 480 | m_current_k[m_PC-2] = (m_current_k[m_PC-2] + (((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT))*(((m_PC-2)>4)?(1-m_uv_zpar):(1-m_zpar)); |
| 481 | break; |
| 482 | case 12: /* PC = 12 */ |
| 483 | /* we should NEVER reach this point, PC=12 doesn't have a subcycle 2 */ |
| 484 | break; |
| 485 | } |
| 530 | 486 | } |
| 531 | | } |
| 532 | 487 | #endif |
| 533 | | } |
| 488 | } |
| 534 | 489 | |
| 535 | | // calculate the output |
| 536 | | if (OLD_FRAME_UNVOICED_FLAG == 1) |
| 537 | | { |
| 538 | | // generate unvoiced samples here |
| 539 | | if (m_RNG & 1) |
| 540 | | m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/ |
| 541 | | else |
| 542 | | m_excitation_data = 0x40; |
| 543 | | } |
| 544 | | else /* (OLD_FRAME_UNVOICED_FLAG == 0) */ |
| 545 | | { |
| 546 | | // generate voiced samples here |
| 547 | | /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp |
| 548 | | * function has a chirp/peak and then a long chain of zeroes. |
| 549 | | * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, |
| 550 | | * and if the address reaches that point the ADDRESS incrementer is |
| 551 | | * disabled, forcing all samples beyond 51d to be == 51d |
| 552 | | */ |
| 553 | | if (m_pitch_count >= 51) |
| 554 | | m_excitation_data = (INT8)m_coeff->chirptable[51]; |
| 555 | | else /*m_pitch_count < 51*/ |
| 556 | | m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; |
| 557 | | } |
| 490 | // calculate the output |
| 491 | if (OLD_FRAME_UNVOICED_FLAG == 1) |
| 492 | { |
| 493 | // generate unvoiced samples here |
| 494 | if (m_RNG & 1) |
| 495 | m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/ |
| 496 | else |
| 497 | m_excitation_data = 0x40; |
| 498 | } |
| 499 | else /* (OLD_FRAME_UNVOICED_FLAG == 0) */ |
| 500 | { |
| 501 | // generate voiced samples here |
| 502 | /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp |
| 503 | * function has a chirp/peak and then a long chain of zeroes. |
| 504 | * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, |
| 505 | * and if the address reaches that point the ADDRESS incrementer is |
| 506 | * disabled, forcing all samples beyond 51d to be == 51d |
| 507 | */ |
| 508 | if (m_pitch_count >= 51) |
| 509 | m_excitation_data = (INT8)m_coeff->chirptable[51]; |
| 510 | else /*m_pitch_count < 51*/ |
| 511 | m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; |
| 512 | } |
| 558 | 513 | |
| 559 | | // Update LFSR *20* times every sample (once per T cycle), like patent shows |
| 560 | | for (i=0; i<20; i++) |
| 561 | | { |
| 562 | | bitout = ((m_RNG >> 12) & 1) ^ |
| 563 | | ((m_RNG >> 3) & 1) ^ |
| 564 | | ((m_RNG >> 2) & 1) ^ |
| 565 | | ((m_RNG >> 0) & 1); |
| 566 | | m_RNG <<= 1; |
| 567 | | m_RNG |= bitout; |
| 568 | | } |
| 569 | | this_sample = lattice_filter(); /* execute lattice filter */ |
| 514 | // Update LFSR *20* times every sample (once per T cycle), like patent shows |
| 515 | for (i=0; i<20; i++) |
| 516 | { |
| 517 | bitout = ((m_RNG >> 12) & 1) ^ |
| 518 | ((m_RNG >> 3) & 1) ^ |
| 519 | ((m_RNG >> 2) & 1) ^ |
| 520 | ((m_RNG >> 0) & 1); |
| 521 | m_RNG <<= 1; |
| 522 | m_RNG |= bitout; |
| 523 | } |
| 524 | this_sample = lattice_filter(); /* execute lattice filter */ |
| 570 | 525 | #ifdef DEBUG_GENERATION_VERBOSE |
| 571 | | //fprintf(stderr,"C:%01d; ",m_subcycle); |
| 572 | | fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 573 | | //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 574 | | for (i=0; i<10; i++) |
| 575 | | fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]); |
| 576 | | fprintf(stderr,"Out:%06d", this_sample); |
| 577 | | fprintf(stderr,"\n"); |
| 526 | //fprintf(stderr,"C:%01d; ",m_subcycle); |
| 527 | fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 528 | //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 529 | for (i=0; i<10; i++) |
| 530 | fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]); |
| 531 | fprintf(stderr,"Out:%06d ", this_sample); |
| 532 | //#ifdef PERFECT_INTERPOLATION_HACK |
| 533 | // fprintf(stderr,"%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar); |
| 534 | //#else |
| 535 | // fprintf(stderr,"x%dx%d",m_zpar,m_uv_zpar); |
| 536 | //#endif |
| 537 | fprintf(stderr,"\n"); |
| 578 | 538 | #endif |
| 579 | | /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */ |
| 580 | | while (this_sample > 16383) this_sample -= 32768; |
| 581 | | while (this_sample < -16384) this_sample += 32768; |
| 582 | | if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping |
| 583 | | buffer[buf_count] = clip_analog(this_sample); |
| 584 | | else // digital I/O pin output is 12 bits |
| 585 | | { |
| 539 | /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */ |
| 540 | while (this_sample > 16383) this_sample -= 32768; |
| 541 | while (this_sample < -16384) this_sample += 32768; |
| 542 | if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping |
| 543 | buffer[buf_count] = clip_analog(this_sample); |
| 544 | else // digital I/O pin output is 12 bits |
| 545 | { |
| 586 | 546 | #ifdef ALLOW_4_LSB |
| 587 | | // input: ssss ssss ssss ssss ssnn nnnn nnnn nnnn |
| 588 | | // N taps: ^ = 0x2000; |
| 589 | | // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN |
| 590 | | buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13); |
| 547 | // input: ssss ssss ssss ssss ssnn nnnn nnnn nnnn |
| 548 | // N taps: ^ = 0x2000; |
| 549 | // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN |
| 550 | buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13); |
| 591 | 551 | #else |
| 592 | | this_sample &= ~0xF; |
| 593 | | // input: ssss ssss ssss ssss ssnn nnnn nnnn 0000 |
| 594 | | // N taps: ^^ ^^^ = 0x3E00; |
| 595 | | // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN |
| 596 | | buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9); |
| 552 | this_sample &= ~0xF; |
| 553 | // input: ssss ssss ssss ssss ssnn nnnn nnnn 0000 |
| 554 | // N taps: ^^ ^^^ = 0x3E00; |
| 555 | // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN |
| 556 | buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9); |
| 597 | 557 | #endif |
| 598 | | } |
| 599 | | // Update all counts |
| 558 | } |
| 559 | // Update all counts |
| 600 | 560 | |
| 601 | | m_subcycle++; |
| 602 | | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 603 | | { |
| 604 | | /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0 |
| 605 | | * if INHIBIT was true during the most recent frame transition. |
| 606 | | * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12 |
| 607 | | * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles, |
| 608 | | * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17 |
| 609 | | * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is |
| 610 | | * convenient and should make no difference in output. |
| 611 | | */ |
| 612 | | if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1; |
| 613 | | if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0; |
| 614 | | #ifdef PERFECT_INTERPOLATION_HACK |
| 615 | | m_old_zpar = m_zpar; |
| 616 | | #endif |
| 617 | | m_zpar = 0; /* this gets effectively reset by resetf3, same signal which resets m_PC to 0 */ |
| 618 | | if (m_IP == 7) // RESETL4 |
| 561 | m_subcycle++; |
| 562 | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 619 | 563 | { |
| 620 | | /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */ |
| 564 | /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0 |
| 565 | * if INHIBIT was true during the most recent frame transition. |
| 566 | * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12 |
| 567 | * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles, |
| 568 | * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17 |
| 569 | * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is |
| 570 | * convenient and should make no difference in output. |
| 571 | */ |
| 572 | if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1; |
| 573 | if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0; |
| 574 | if (m_IP == 7) // RESETL4 |
| 575 | { |
| 576 | // Latch OLDE and OLDP |
| 577 | OLD_FRAME_SILENCE_FLAG = NEW_FRAME_SILENCE_FLAG; // m_OLDE |
| 578 | OLD_FRAME_UNVOICED_FLAG = NEW_FRAME_UNVOICED_FLAG; // m_OLDP |
| 579 | /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */ |
| 621 | 580 | #ifdef DEBUG_GENERATION |
| 622 | | if (m_TALK == 0) |
| 623 | | fprintf(stderr,"tms5110_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n"); |
| 581 | if (m_TALK == 0) |
| 582 | fprintf(stderr,"tms5110_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n"); |
| 624 | 583 | #endif |
| 625 | | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 626 | | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 584 | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 585 | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 586 | } |
| 587 | m_subcycle = m_subc_reload; |
| 588 | m_PC = 0; |
| 589 | m_IP++; |
| 590 | m_IP&=0x7; |
| 627 | 591 | } |
| 628 | | m_subcycle = m_subc_reload; |
| 629 | | m_PC = 0; |
| 630 | | m_IP++; |
| 631 | | m_IP&=0x7; |
| 592 | else if (m_subcycle == 3) |
| 593 | { |
| 594 | m_subcycle = m_subc_reload; |
| 595 | m_PC++; |
| 596 | } |
| 597 | m_pitch_count++; |
| 598 | if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0; |
| 599 | m_pitch_count &= 0x1FF; |
| 632 | 600 | } |
| 633 | | else if (m_subcycle == 3) |
| 601 | else // m_TALKD == 0 |
| 634 | 602 | { |
| 635 | | m_subcycle = m_subc_reload; |
| 636 | | m_PC++; |
| 637 | | } |
| 638 | | m_pitch_count++; |
| 639 | | if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0; |
| 640 | | m_pitch_count &= 0x1FF; |
| 641 | | buf_count++; |
| 642 | | size--; |
| 643 | | } |
| 644 | | |
| 645 | | empty: |
| 646 | | |
| 647 | | while (size > 0) |
| 648 | | { |
| 649 | | m_subcycle++; |
| 650 | | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 651 | | { |
| 652 | | if (m_IP == 7) // RESETL4 |
| 603 | m_subcycle++; |
| 604 | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 653 | 605 | { |
| 654 | | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 655 | | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 606 | if (m_IP == 7) // RESETL4 |
| 607 | { |
| 608 | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 609 | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 610 | } |
| 611 | m_subcycle = m_subc_reload; |
| 612 | m_PC = 0; |
| 613 | m_IP++; |
| 614 | m_IP&=0x7; |
| 656 | 615 | } |
| 657 | | m_subcycle = m_subc_reload; |
| 658 | | m_PC = 0; |
| 659 | | m_IP++; |
| 660 | | m_IP&=0x7; |
| 616 | else if (m_subcycle == 3) |
| 617 | { |
| 618 | m_subcycle = m_subc_reload; |
| 619 | m_PC++; |
| 620 | } |
| 621 | buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */ |
| 661 | 622 | } |
| 662 | | else if (m_subcycle == 3) |
| 663 | | { |
| 664 | | m_subcycle = m_subc_reload; |
| 665 | | m_PC++; |
| 666 | | } |
| 667 | | buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */ |
| 668 | | buf_count++; |
| 669 | | size--; |
| 623 | buf_count++; |
| 624 | size--; |
| 670 | 625 | } |
| 671 | 626 | } |
| 672 | 627 | |
| r249025 | r249026 | |
| 898 | 853 | m_SPEN = 1; /* start immediately */ |
| 899 | 854 | /* clear out variables before speaking */ |
| 900 | 855 | m_zpar = 1; // zero all the parameters |
| 856 | m_uv_zpar = 1; // zero k4-k10 as well |
| 857 | m_OLDE = 1; // 'silence/zpar' frames are zero energy |
| 858 | m_OLDP = 1; // 'silence/zpar' frames are zero pitch |
| 859 | #ifdef PERFECT_INTERPOLATION_HACK |
| 860 | m_old_zpar = 1; // zero all the old parameters |
| 861 | m_old_uv_zpar = 1; // zero old k4-k10 as well |
| 862 | #endif |
| 901 | 863 | m_subc_reload = 0; // SPKSLOW means this is 0 |
| 902 | | m_subcycle = m_subc_reload; |
| 903 | | m_PC = 0; |
| 904 | | m_IP = 0; |
| 905 | 864 | break; |
| 906 | 865 | |
| 907 | 866 | case TMS5110_CMD_READ_BIT: |
| r249025 | r249026 | |
| 915 | 874 | #ifdef DEBUG_COMMAND_DUMP |
| 916 | 875 | fprintf(stderr,"actually reading a bit now\n"); |
| 917 | 876 | #endif |
| 918 | | request_bits(1); |
| 919 | 877 | m_CTL_buffer >>= 1; |
| 920 | 878 | m_CTL_buffer |= (extract_bits(1)<<3); |
| 921 | 879 | m_CTL_buffer &= 0xF; |
| r249025 | r249026 | |
| 930 | 888 | m_SPEN = 1; /* start immediately */ |
| 931 | 889 | /* clear out variables before speaking */ |
| 932 | 890 | m_zpar = 1; // zero all the parameters |
| 891 | m_uv_zpar = 1; // zero k4-k10 as well |
| 892 | m_OLDE = 1; // 'silence/zpar' frames are zero energy |
| 893 | m_OLDP = 1; // 'silence/zpar' frames are zero pitch |
| 894 | #ifdef PERFECT_INTERPOLATION_HACK |
| 895 | m_old_zpar = 1; // zero all the old parameters |
| 896 | m_old_uv_zpar = 1; // zero old k4-k10 as well |
| 897 | #endif |
| 933 | 898 | m_subc_reload = 1; // SPEAK means this is 1 |
| 934 | | m_subcycle = m_subc_reload; |
| 935 | | m_PC = 0; |
| 936 | | m_IP = 0; |
| 937 | 899 | break; |
| 938 | 900 | |
| 939 | 901 | case TMS5110_CMD_READ_BRANCH: |
| r249025 | r249026 | |
| 978 | 940 | |
| 979 | 941 | void tms5110_device::parse_frame() |
| 980 | 942 | { |
| 981 | | int bits, i, rep_flag; |
| 982 | | /** TODO: get rid of bits handling here and move into extract_bits (as in tms5220.c) **/ |
| 983 | | /* count the total number of bits available */ |
| 984 | | bits = m_fifo_count; |
| 943 | int i, rep_flag; |
| 985 | 944 | |
| 986 | | /* attempt to extract the energy index */ |
| 987 | | bits -= m_coeff->energy_bits; |
| 988 | | if (bits < 0) |
| 989 | | { |
| 990 | | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 991 | | bits = 0; |
| 992 | | } |
| 993 | 945 | // attempt to extract the energy index |
| 994 | 946 | m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits); |
| 995 | 947 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| r249025 | r249026 | |
| 997 | 949 | fprintf(stderr," "); |
| 998 | 950 | #endif |
| 999 | 951 | |
| 1000 | | /* if the energy index is 0 or 15, we're done |
| 1001 | | |
| 1002 | | if ((indx == 0) || (indx == 15)) |
| 1003 | | { |
| 1004 | | if (DEBUG_5110) logerror(" (4-bit energy=%d frame)\n",m_new_energy); |
| 1005 | | |
| 1006 | | // clear the k's |
| 1007 | | if (indx == 0) |
| 1008 | | { |
| 1009 | | for (i = 0; i < m_coeff->num_k; i++) |
| 1010 | | m_new_k[i] = 0; |
| 1011 | | } |
| 1012 | | |
| 1013 | | // clear fifo if stop frame encountered |
| 1014 | | if (indx == 15) |
| 1015 | | { |
| 1016 | | if (DEBUG_5110) logerror(" (4-bit energy=%d STOP frame)\n",m_new_energy); |
| 1017 | | m_fifo_head = m_fifo_tail = m_fifo_count = 0; |
| 1018 | | } |
| 1019 | | return; |
| 1020 | | }*/ |
| 1021 | 952 | // if the energy index is 0 or 15, we're done |
| 1022 | 953 | if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15)) |
| 1023 | 954 | return; |
| 1024 | 955 | |
| 1025 | | |
| 1026 | | /* attempt to extract the repeat flag */ |
| 1027 | | bits -= 1; |
| 1028 | | if (bits < 0) |
| 1029 | | { |
| 1030 | | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 1031 | | bits = 0; |
| 1032 | | } |
| 1033 | 956 | rep_flag = extract_bits(1); |
| 1034 | 957 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 1035 | 958 | printbits(rep_flag, 1); |
| 1036 | 959 | fprintf(stderr," "); |
| 1037 | 960 | #endif |
| 1038 | 961 | |
| 1039 | | /* attempt to extract the pitch */ |
| 1040 | | bits -= m_coeff->pitch_bits; |
| 1041 | | if (bits < 0) |
| 1042 | | { |
| 1043 | | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 1044 | | bits = 0; |
| 1045 | | } |
| 1046 | 962 | m_new_frame_pitch_idx = extract_bits(m_coeff->pitch_bits); |
| 1047 | 963 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 1048 | 964 | printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits); |
| r249025 | r249026 | |
| 1055 | 971 | // extract first 4 K coefficients |
| 1056 | 972 | for (i = 0; i < 4; i++) |
| 1057 | 973 | { |
| 1058 | | /* attempt to extract 4 K's */ |
| 1059 | | bits -= m_coeff->kbits[i]; |
| 1060 | | if (bits < 0) |
| 1061 | | { |
| 1062 | | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 1063 | | bits = 0; |
| 1064 | | } |
| 1065 | 974 | m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]); |
| 1066 | 975 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 1067 | 976 | printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); |
| r249025 | r249026 | |
| 1079 | 988 | // If we got here, we need the remaining 6 K's |
| 1080 | 989 | for (i = 4; i < m_coeff->num_k; i++) |
| 1081 | 990 | { |
| 1082 | | bits -= m_coeff->kbits[i]; |
| 1083 | | if (bits < 0) |
| 1084 | | { |
| 1085 | | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 1086 | | bits = 0; |
| 1087 | | } |
| 1088 | 991 | m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]); |
| 1089 | 992 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 1090 | 993 | printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); |
| 1091 | 994 | fprintf(stderr," "); |
| 1092 | 995 | #endif |
| 1093 | 996 | } |
| 997 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 998 | fprintf(stderr,"\n"); |
| 999 | #endif |
| 1094 | 1000 | #ifdef VERBOSE |
| 1095 | | if (m_speak_external) |
| 1096 | | logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken)); |
| 1097 | | else |
| 1098 | 1001 | logerror("Parsed a frame successfully in ROM\n"); |
| 1099 | 1002 | #endif |
| 1100 | 1003 | return; |
| r249025 | r249026 | |
| 1238 | 1141 | void tms5110_device::device_reset() |
| 1239 | 1142 | { |
| 1240 | 1143 | m_digital_select = FORCE_DIGITAL; // assume analog output |
| 1241 | | /* initialize the FIFO */ |
| 1242 | | memset(m_fifo, 0, sizeof(m_fifo)); |
| 1243 | | m_fifo_head = m_fifo_tail = m_fifo_count = 0; |
| 1244 | 1144 | |
| 1245 | 1145 | /* initialize the chip state */ |
| 1246 | 1146 | m_SPEN = m_TALK = m_TALKD = 0; |
| r249025 | r249026 | |
| 1253 | 1153 | #ifdef PERFECT_INTERPOLATION_HACK |
| 1254 | 1154 | m_old_frame_energy_idx = m_old_frame_pitch_idx = 0; |
| 1255 | 1155 | memset(m_old_frame_k_idx, 0, sizeof(m_old_frame_k_idx)); |
| 1256 | | m_old_zpar = 0; |
| 1156 | m_old_zpar = m_old_uv_zpar = 0; |
| 1257 | 1157 | #endif |
| 1258 | 1158 | m_new_frame_energy_idx = m_current_energy = m_previous_energy = 0; |
| 1259 | 1159 | m_new_frame_pitch_idx = m_current_pitch = 0; |
| r249025 | r249026 | |
| 1390 | 1290 | } |
| 1391 | 1291 | |
| 1392 | 1292 | |
| 1393 | | |
| 1394 | 1293 | /****************************************************************************** |
| 1395 | 1294 | |
| 1396 | | tms5110_ready_r -- return the not ready status from the sound chip |
| 1397 | | |
| 1398 | | ******************************************************************************/ |
| 1399 | | |
| 1400 | | int tms5110_device::ready_r() |
| 1401 | | { |
| 1402 | | /* bring up to date first */ |
| 1403 | | m_stream->update(); |
| 1404 | | return (m_fifo_count < FIFO_SIZE-1); |
| 1405 | | } |
| 1406 | | |
| 1407 | | |
| 1408 | | |
| 1409 | | /****************************************************************************** |
| 1410 | | |
| 1411 | 1295 | tms5110_update -- update the sound chip so that it is in sync with CPU execution |
| 1412 | 1296 | |
| 1413 | 1297 | ******************************************************************************/ |
trunk/src/emu/sound/tms5220.c
| r249025 | r249026 | |
| 271 | 271 | * or clip logic, even though the real hardware doesn't do this, partially verified by decap */ |
| 272 | 272 | #undef ALLOW_4_LSB |
| 273 | 273 | |
| 274 | /* forces m_TALK active instantly whenever m_SPEN would be activated, causing speech delay to be reduced by up to one frame time */ |
| 275 | /* for some reason, this hack makes victory behave better, though it does not match the patent */ |
| 276 | #define FAST_START_HACK 1 |
| 274 | 277 | |
| 278 | |
| 275 | 279 | /* *****configuration of chip connection stuff***** */ |
| 276 | 280 | /* must be defined; if 0, output the waveform as if it was tapped on the speaker pin as usual, if 1, output the waveform as if it was tapped on the i/o pin (volume is much lower in the latter case) */ |
| 277 | 281 | #define FORCE_DIGITAL 0 |
| r249025 | r249026 | |
| 361 | 365 | save_item(NAME(m_fifo_count)); |
| 362 | 366 | save_item(NAME(m_fifo_bits_taken)); |
| 363 | 367 | |
| 364 | | save_item(NAME(m_speaking_now)); |
| 365 | | save_item(NAME(m_speak_external)); |
| 366 | | save_item(NAME(m_talk_status)); |
| 368 | save_item(NAME(m_previous_TALK_STATUS)); |
| 369 | save_item(NAME(m_SPEN)); |
| 370 | save_item(NAME(m_DDIS)); |
| 371 | save_item(NAME(m_TALK)); |
| 372 | save_item(NAME(m_TALKD)); |
| 367 | 373 | save_item(NAME(m_buffer_low)); |
| 368 | 374 | save_item(NAME(m_buffer_empty)); |
| 369 | 375 | save_item(NAME(m_irq_pin)); |
| r249025 | r249026 | |
| 384 | 390 | save_item(NAME(m_current_pitch)); |
| 385 | 391 | save_item(NAME(m_current_k)); |
| 386 | 392 | |
| 387 | | save_item(NAME(m_target_energy)); |
| 388 | | save_item(NAME(m_target_pitch)); |
| 389 | | save_item(NAME(m_target_k)); |
| 390 | | |
| 391 | 393 | save_item(NAME(m_previous_energy)); |
| 392 | 394 | |
| 393 | 395 | save_item(NAME(m_subcycle)); |
| r249025 | r249026 | |
| 395 | 397 | save_item(NAME(m_PC)); |
| 396 | 398 | save_item(NAME(m_IP)); |
| 397 | 399 | save_item(NAME(m_inhibit)); |
| 400 | save_item(NAME(m_uv_zpar)); |
| 401 | save_item(NAME(m_zpar)); |
| 402 | save_item(NAME(m_pitch_zero)); |
| 398 | 403 | save_item(NAME(m_c_variant_rate)); |
| 399 | 404 | save_item(NAME(m_pitch_count)); |
| 400 | 405 | |
| r249025 | r249026 | |
| 465 | 470 | |
| 466 | 471 | void tms5220_device::data_write(int data) |
| 467 | 472 | { |
| 473 | int old_buffer_low = m_buffer_low; |
| 468 | 474 | #ifdef DEBUG_DUMP_INPUT_DATA |
| 469 | 475 | fprintf(stdout, "%c",data); |
| 470 | 476 | #endif |
| 471 | | if (m_speak_external) // If we're in speak external mode |
| 477 | if (m_DDIS) // If we're in speak external mode |
| 472 | 478 | { |
| 473 | 479 | // add this byte to the FIFO |
| 474 | 480 | if (m_fifo_count < FIFO_SIZE) |
| r249025 | r249026 | |
| 477 | 483 | m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE; |
| 478 | 484 | m_fifo_count++; |
| 479 | 485 | #ifdef DEBUG_FIFO |
| 480 | | logerror("data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count); |
| 486 | fprintf(stderr,"data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count); |
| 481 | 487 | #endif |
| 482 | 488 | update_fifo_status_and_ints(); |
| 483 | | if ((m_talk_status == 0) && (m_buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero... |
| 489 | // if we just unset buffer low with that last write, and SPEN *was* zero (see circuit 251, sheet 12) |
| 490 | if ((m_SPEN == 0) && ((old_buffer_low == 1) && (m_buffer_low == 0))) // MUST HAVE EDGE DETECT |
| 484 | 491 | { |
| 485 | | int i; |
| 492 | int i; |
| 486 | 493 | #ifdef DEBUG_FIFO |
| 487 | | logerror("data_write triggered talk status to go active!\n"); |
| 494 | fprintf(stderr,"data_write triggered SPEN to go active!\n"); |
| 488 | 495 | #endif |
| 489 | | // ...then we now have enough bytes to start talking; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) |
| 490 | | // TODO: the 3 lines below (and others) are needed for victory to not fail its selftest due to a sample ending too late, may require additional investigation |
| 491 | | m_subcycle = m_subc_reload; |
| 492 | | m_PC = 0; |
| 493 | | m_IP = reload_table[m_c_variant_rate&0x3]; // is this correct? should this be always 7 instead, so that the new frame is loaded quickly? |
| 496 | // ...then we now have enough bytes to start talking; set zpar and clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) |
| 497 | m_zpar = 1; |
| 498 | m_uv_zpar = 1; // zero k4-k10 as well |
| 499 | m_OLDE = 1; // 'silence/zpar' frames are zero energy |
| 500 | m_OLDP = 1; // 'silence/zpar' frames are zero pitch |
| 501 | #ifdef PERFECT_INTERPOLATION_HACK |
| 502 | m_old_zpar = 1; // zero all the old parameters |
| 503 | m_old_uv_zpar = 1; // zero old k4-k10 as well |
| 504 | #endif |
| 505 | m_SPEN = 1; |
| 506 | #ifdef FAST_START_HACK |
| 507 | m_TALK = 1; |
| 508 | #endif |
| 494 | 509 | m_new_frame_energy_idx = 0; |
| 495 | 510 | m_new_frame_pitch_idx = 0; |
| 496 | 511 | for (i = 0; i < 4; i++) |
| r249025 | r249026 | |
| 499 | 514 | m_new_frame_k_idx[i] = 0xF; |
| 500 | 515 | for (i = 7; i < m_coeff->num_k; i++) |
| 501 | 516 | m_new_frame_k_idx[i] = 0x7; |
| 502 | | m_talk_status = m_speaking_now = 1; |
| 517 | |
| 503 | 518 | } |
| 504 | 519 | } |
| 505 | 520 | else |
| 506 | 521 | { |
| 507 | 522 | #ifdef DEBUG_FIFO |
| 508 | | logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n"); |
| 523 | fprintf(stderr,"data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n"); |
| 509 | 524 | // at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it. |
| 510 | 525 | #endif |
| 511 | 526 | } |
| 512 | 527 | |
| 513 | 528 | |
| 514 | 529 | } |
| 515 | | else //(! m_speak_external) |
| 530 | else //(! m_DDIS) |
| 516 | 531 | // R Nabet : we parse commands at once. It is necessary for such commands as read. |
| 517 | 532 | process_command(data); |
| 518 | 533 | } |
| r249025 | r249026 | |
| 560 | 575 | m_buffer_low = 0; |
| 561 | 576 | |
| 562 | 577 | /* BE is set if neither byte 15 nor 14 of the fifo are in use; this |
| 563 | | translates to having fifo_count equal to exactly 0 */ |
| 578 | translates to having fifo_count equal to exactly 0 |
| 579 | */ |
| 564 | 580 | if (m_fifo_count == 0) |
| 565 | 581 | { |
| 566 | 582 | // generate an interrupt if necessary; if /BE was inactive and is now active, set int. |
| 567 | 583 | if (!m_buffer_empty) |
| 568 | 584 | set_interrupt_state(1); |
| 569 | 585 | m_buffer_empty = 1; |
| 586 | m_TALK = m_SPEN = 0; // /BE being active clears the TALK(TCON) status which in turn clears SPEN |
| 570 | 587 | } |
| 571 | 588 | else |
| 572 | 589 | m_buffer_empty = 0; |
| 573 | 590 | |
| 574 | | /* TS is talk status and is set elsewhere in the fifo parser and in |
| 575 | | the SPEAK command handler; however, if /BE is true during speak external |
| 576 | | mode, it is immediately unset here. */ |
| 577 | | if ((m_speak_external == 1) && (m_buffer_empty == 1)) |
| 591 | // generate an interrupt if /TS was active, and is now inactive. |
| 592 | // also, in this case, regardless if DDIS was set, unset it. |
| 593 | if (m_previous_TALK_STATUS == 1 && (TALK_STATUS == 0)) |
| 578 | 594 | { |
| 579 | | // generate an interrupt: /TS was active, and is now inactive. |
| 580 | | if (m_talk_status == 1) |
| 581 | | { |
| 582 | | m_talk_status = m_speak_external = 0; |
| 583 | | set_interrupt_state(1); |
| 584 | | } |
| 595 | #ifdef VERBOSE |
| 596 | fprintf(stderr,"Talk status WAS 1, is now 0, unsetting DDIS and firing an interrupt!\n"); |
| 597 | #endif |
| 598 | set_interrupt_state(1); |
| 599 | m_DDIS = 0; |
| 585 | 600 | } |
| 586 | | /* Note that TS being unset will also generate an interrupt when a STOP |
| 587 | | frame is encountered; this is handled in the sample generator code and not here */ |
| 601 | m_previous_TALK_STATUS = TALK_STATUS; |
| 602 | |
| 588 | 603 | } |
| 589 | 604 | |
| 590 | 605 | /********************************************************************************************** |
| r249025 | r249026 | |
| 597 | 612 | { |
| 598 | 613 | int val = 0; |
| 599 | 614 | |
| 600 | | if (m_speak_external) |
| 615 | if (m_DDIS) |
| 601 | 616 | { |
| 602 | 617 | // extract from FIFO |
| 603 | 618 | while (count--) |
| r249025 | r249026 | |
| 643 | 658 | /* clear the interrupt pin on status read */ |
| 644 | 659 | set_interrupt_state(0); |
| 645 | 660 | #ifdef DEBUG_PIN_READS |
| 646 | | logerror("Status read: TS=%d BL=%d BE=%d\n", m_talk_status, m_buffer_low, m_buffer_empty); |
| 661 | fprintf(stderr,"Status read: TS=%d BL=%d BE=%d\n", TALK_STATUS, m_buffer_low, m_buffer_empty); |
| 647 | 662 | #endif |
| 648 | 663 | |
| 649 | | return (m_talk_status << 7) | (m_buffer_low << 6) | (m_buffer_empty << 5); |
| 664 | return (TALK_STATUS << 7) | (m_buffer_low << 6) | (m_buffer_empty << 5); |
| 650 | 665 | } |
| 651 | 666 | } |
| 652 | 667 | |
| r249025 | r249026 | |
| 660 | 675 | int tms5220_device::ready_read() |
| 661 | 676 | { |
| 662 | 677 | #ifdef DEBUG_PIN_READS |
| 663 | | logerror("ready_read: ready pin read, io_ready is %d, fifo count is %d\n", m_io_ready, m_fifo_count); |
| 678 | fprintf(stderr,"ready_read: ready pin read, io_ready is %d, fifo count is %d, DDIS(speak external) is %d\n", m_io_ready, m_fifo_count, m_DDIS); |
| 664 | 679 | #endif |
| 665 | | return ((m_fifo_count < FIFO_SIZE)||(!m_speak_external)) && m_io_ready; |
| 680 | return ((m_fifo_count < FIFO_SIZE)||(!m_DDIS)) && m_io_ready; |
| 666 | 681 | } |
| 667 | 682 | |
| 668 | 683 | |
| r249025 | r249026 | |
| 718 | 733 | int tms5220_device::int_read() |
| 719 | 734 | { |
| 720 | 735 | #ifdef DEBUG_PIN_READS |
| 721 | | logerror("int_read: irq pin read, state is %d\n", m_irq_pin); |
| 736 | fprintf(stderr,"int_read: irq pin read, state is %d\n", m_irq_pin); |
| 722 | 737 | #endif |
| 723 | 738 | return m_irq_pin; |
| 724 | 739 | } |
| r249025 | r249026 | |
| 733 | 748 | void tms5220_device::process(INT16 *buffer, unsigned int size) |
| 734 | 749 | { |
| 735 | 750 | int buf_count=0; |
| 736 | | int i, bitout, zpar; |
| 751 | int i, bitout; |
| 737 | 752 | INT32 this_sample; |
| 738 | 753 | |
| 739 | | /* the following gotos are probably safe to remove */ |
| 740 | | /* if we're empty and still not speaking, fill with nothingness */ |
| 741 | | if (!m_speaking_now) |
| 742 | | goto empty; |
| 754 | #ifdef VERBOSE |
| 755 | fprintf(stderr,"process called with size of %d; IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", size, m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD); |
| 756 | #endif |
| 743 | 757 | |
| 744 | | /* if speak external is set, but talk status is not (yet) set, |
| 745 | | wait for buffer low to clear */ |
| 746 | | if (!m_talk_status && m_speak_external && m_buffer_low) |
| 747 | | goto empty; |
| 748 | | |
| 749 | 758 | /* loop until the buffer is full or we've stopped speaking */ |
| 750 | | while ((size > 0) && m_speaking_now) |
| 759 | while (size > 0) |
| 751 | 760 | { |
| 752 | | /* if it is the appropriate time to update the old energy/pitch indices, |
| 753 | | * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17 |
| 754 | | * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1), |
| 755 | | * which happens 4 T-cycles later), we change on the latter. |
| 756 | | * The indices are updated here ~12 PCs before the new frame is applied. |
| 757 | | */ |
| 758 | | /** TODO: the patents 4331836, 4335277, and 4419540 disagree about the timing of this **/ |
| 759 | | if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2)) |
| 761 | if(m_TALKD) // speaking |
| 760 | 762 | { |
| 761 | | m_OLDE = (m_new_frame_energy_idx == 0); |
| 762 | | m_OLDP = (m_new_frame_pitch_idx == 0); |
| 763 | | } |
| 763 | /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1 |
| 764 | * (In reality, the frame was really loaded incrementally during the entire IP=0 |
| 765 | * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens) |
| 766 | */ |
| 767 | if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1)) |
| 768 | { |
| 769 | // HACK for regression testing, be sure to comment out before release! |
| 770 | //m_RNG = 0x1234; |
| 771 | // end HACK |
| 764 | 772 | |
| 765 | | /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1 |
| 766 | | * (In reality, the frame was really loaded incrementally during the entire IP=0 |
| 767 | | * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens) |
| 768 | | */ |
| 769 | | if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1)) |
| 770 | | { |
| 771 | | // HACK for regression testing, be sure to comment out before release! |
| 772 | | //m_RNG = 0x1234; |
| 773 | | // end HACK |
| 773 | /* appropriately override the interp count if needed; this will be incremented after the frame parse! */ |
| 774 | m_IP = reload_table[m_c_variant_rate&0x3]; |
| 774 | 775 | |
| 775 | | /* appropriately override the interp count if needed; this will be incremented after the frame parse! */ |
| 776 | | m_IP = reload_table[m_c_variant_rate&0x3]; |
| 777 | | |
| 778 | 776 | #ifdef PERFECT_INTERPOLATION_HACK |
| 779 | | /* remember previous frame energy, pitch, and coefficients */ |
| 780 | | m_old_frame_energy_idx = m_new_frame_energy_idx; |
| 781 | | m_old_frame_pitch_idx = m_new_frame_pitch_idx; |
| 782 | | for (i = 0; i < m_coeff->num_k; i++) |
| 783 | | m_old_frame_k_idx[i] = m_new_frame_k_idx[i]; |
| 777 | /* remember previous frame energy, pitch, and coefficients */ |
| 778 | m_old_frame_energy_idx = m_new_frame_energy_idx; |
| 779 | m_old_frame_pitch_idx = m_new_frame_pitch_idx; |
| 780 | for (i = 0; i < m_coeff->num_k; i++) |
| 781 | m_old_frame_k_idx[i] = m_new_frame_k_idx[i]; |
| 784 | 782 | #endif |
| 785 | 783 | |
| 786 | | /* if the talk status was clear last frame, halt speech now. */ |
| 787 | | if (m_talk_status == 0) |
| 788 | | { |
| 789 | | #ifdef DEBUG_GENERATION |
| 790 | | fprintf(stderr,"tms5220_process: processing frame: talk status = 0 caused by stop frame or buffer empty, halting speech.\n"); |
| 791 | | #endif |
| 792 | | if (m_speaking_now == 1) // we're done, set all coeffs to idle state but keep going for a bit... |
| 793 | | { |
| 794 | | /**TODO: should index clearing be done here, or elsewhere? **/ |
| 795 | | m_new_frame_energy_idx = 0; |
| 796 | | m_new_frame_pitch_idx = 0; |
| 797 | | for (i = 0; i < 4; i++) |
| 798 | | m_new_frame_k_idx[i] = 0; |
| 799 | | for (i = 4; i < 7; i++) |
| 800 | | m_new_frame_k_idx[i] = 0xF; |
| 801 | | for (i = 7; i < m_coeff->num_k; i++) |
| 802 | | m_new_frame_k_idx[i] = 0x7; |
| 803 | | m_speaking_now = 2; // wait 8 extra interp periods before shutting down so we can interpolate everything to zero state |
| 804 | | } |
| 805 | | else // m_speaking_now == 2 // now we're really done. |
| 806 | | { |
| 807 | | m_speaking_now = 0; // finally halt speech |
| 808 | | goto empty; |
| 809 | | } |
| 810 | | } |
| 784 | /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */ |
| 785 | parse_frame(); |
| 811 | 786 | |
| 812 | | |
| 813 | | /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[], |
| 814 | | * but only if we're not just about to end speech */ |
| 815 | | if (m_speaking_now == 1) parse_frame(); |
| 816 | | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 817 | | fprintf(stderr,"\n"); |
| 787 | // if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters |
| 788 | // NOTE: this is probably the bug the tms5100/tmc0280 has, pre-rev D, I think. |
| 789 | // GUESS: Pre-rev D versions start zeroing k5-k10 immediately upon new frame load regardless of interpolation inhibit |
| 790 | // I.e. ZPAR = /TALKD || (PC>5&&P=0) |
| 791 | // GUESS: D and later versions only start or stop zeroing k5-k10 at the IP7->IP0 transition AFTER the frame |
| 792 | // I.e. ZPAR = /TALKD || (PC>5&&OLDP) |
| 793 | #ifdef PERFECT_INTERPOLATION_HACK |
| 794 | m_old_uv_zpar = m_uv_zpar; |
| 795 | m_old_zpar = m_zpar; // unset old zpar on new frame |
| 818 | 796 | #endif |
| 797 | m_zpar = 0; |
| 798 | //m_uv_zpar = (OLD_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: fixed version in tmc0280d/tms5100a/cd280x/tms5110 |
| 799 | m_uv_zpar = (NEW_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: buggy version in tmc0280/tms5100 |
| 819 | 800 | |
| 820 | | /* if the new frame is a stop frame, set an interrupt and set talk status to 0 */ |
| 821 | | /** TODO: investigate this later! **/ |
| 822 | | if (NEW_FRAME_STOP_FLAG == 1) |
| 801 | /* if the new frame is a stop frame, unset both TALK and SPEN (via TCON). TALKD remains active while the energy is ramping to 0. */ |
| 802 | if (NEW_FRAME_STOP_FLAG == 1) |
| 823 | 803 | { |
| 824 | | m_talk_status = m_speak_external = 0; |
| 825 | | set_interrupt_state(1); |
| 826 | | update_fifo_status_and_ints(); |
| 804 | m_TALK = m_SPEN = 0; |
| 827 | 805 | } |
| 828 | 806 | |
| 829 | | /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. |
| 830 | | Interpolation inhibit cases: |
| 831 | | * Old frame was voiced, new is unvoiced |
| 832 | | * Old frame was silence/zero energy, new has nonzero energy |
| 833 | | * Old frame was unvoiced, new is voiced |
| 834 | | * Old frame was unvoiced, new frame is silence/zero energy (unique to tms52xx) |
| 835 | | */ |
| 836 | | if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1)) |
| 837 | | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) |
| 838 | | || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) |
| 839 | | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) ) |
| 840 | | m_inhibit = 1; |
| 841 | | else // normal frame, normal interpolation |
| 842 | | m_inhibit = 0; |
| 807 | /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. |
| 808 | Interpolation inhibit cases: |
| 809 | * Old frame was voiced, new is unvoiced |
| 810 | * Old frame was silence/zero energy, new has nonzero energy |
| 811 | * Old frame was unvoiced, new is voiced |
| 812 | * Old frame was unvoiced, new frame is silence/zero energy (unique to tms52xx) |
| 813 | */ |
| 814 | if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1)) |
| 815 | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) |
| 816 | || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) |
| 817 | || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) ) |
| 818 | m_inhibit = 1; |
| 819 | else // normal frame, normal interpolation |
| 820 | m_inhibit = 0; |
| 843 | 821 | |
| 844 | | /* load new frame targets from tables, using parsed indices */ |
| 845 | | m_target_energy = m_coeff->energytable[m_new_frame_energy_idx]; |
| 846 | | m_target_pitch = m_coeff->pitchtable[m_new_frame_pitch_idx]; |
| 847 | | zpar = NEW_FRAME_UNVOICED_FLAG; // find out if parameters k5-k10 should be zeroed |
| 848 | | for (i = 0; i < 4; i++) |
| 849 | | m_target_k[i] = m_coeff->ktable[i][m_new_frame_k_idx[i]]; |
| 850 | | for (i = 4; i < m_coeff->num_k; i++) |
| 851 | | m_target_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-zpar)); |
| 852 | | |
| 853 | 822 | #ifdef DEBUG_GENERATION |
| 854 | | /* Debug info for current parsed frame */ |
| 855 | | fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP); |
| 856 | | fprintf(stderr,"Processing frame: "); |
| 857 | | if (m_inhibit == 0) |
| 858 | | fprintf(stderr, "Normal Frame\n"); |
| 859 | | else |
| 860 | | fprintf(stderr,"Interpolation Inhibited\n"); |
| 861 | | fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]); |
| 862 | | fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_target_energy, m_new_frame_energy_idx, m_target_pitch, m_target_k[0], m_target_k[1], m_target_k[2], m_target_k[3], m_target_k[4], m_target_k[5], m_target_k[6], m_target_k[7], m_target_k[8], m_target_k[9]); |
| 823 | /* Debug info for current parsed frame */ |
| 824 | fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP); |
| 825 | fprintf(stderr,"Processing new frame: "); |
| 826 | if (m_inhibit == 0) |
| 827 | fprintf(stderr, "Normal Frame\n"); |
| 828 | else |
| 829 | fprintf(stderr,"Interpolation Inhibited\n"); |
| 830 | fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]); |
| 831 | fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n", |
| 832 | (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)), |
| 833 | m_new_frame_energy_idx, |
| 834 | (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)), |
| 835 | (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)), |
| 836 | (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)), |
| 837 | (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)), |
| 838 | (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)), |
| 839 | (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)), |
| 840 | (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)), |
| 841 | (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)), |
| 842 | (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)), |
| 843 | (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)), |
| 844 | (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) ); |
| 863 | 845 | #endif |
| 864 | 846 | |
| 865 | | /* if TS is now 0, ramp the energy down to 0. Is this really correct to hardware? */ |
| 866 | | if (m_talk_status == 0) |
| 847 | } |
| 848 | else // Not a new frame, just interpolate the existing frame. |
| 867 | 849 | { |
| 868 | | #ifdef DEBUG_GENERATION |
| 869 | | fprintf(stderr,"Talk status is 0, forcing target energy to 0\n"); |
| 850 | int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value |
| 851 | #ifdef PERFECT_INTERPOLATION_HACK |
| 852 | int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW |
| 853 | //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW |
| 854 | int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7)); |
| 855 | //fprintf(stderr, "CS: %03d", current_sample); |
| 856 | // reset the current energy, pitch, etc to what it was at frame start |
| 857 | m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_old_zpar)); |
| 858 | m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar)); |
| 859 | for (i = 0; i < m_coeff->num_k; i++) |
| 860 | m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-((i<4)?m_old_zpar:m_old_uv_zpar))); |
| 861 | // now adjust each value to be exactly correct for each of the samples per frame |
| 862 | if (m_IP != 0) // if we're still interpolating... |
| 863 | { |
| 864 | m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar); |
| 865 | m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar); |
| 866 | for (i = 0; i < m_coeff->num_k; i++) |
| 867 | m_current_k[i] = (m_current_k[i] + (((m_coeff->ktable[i][m_new_frame_k_idx[i]] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-((i<4)?m_zpar:m_uv_zpar)); |
| 868 | } |
| 869 | else // we're done, play this frame for 1/8 frame. |
| 870 | { |
| 871 | m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)); |
| 872 | m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)); |
| 873 | for (i = 0; i < m_coeff->num_k; i++) |
| 874 | m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar))); |
| 875 | } |
| 876 | #else |
| 877 | //Updates to parameters only happen on subcycle '2' (B cycle) of PCs. |
| 878 | if (m_subcycle == 2) |
| 879 | { |
| 880 | switch(m_PC) |
| 881 | { |
| 882 | case 0: /* PC = 0, B cycle, write updated energy */ |
| 883 | m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar); |
| 884 | break; |
| 885 | case 1: /* PC = 1, B cycle, write updated pitch */ |
| 886 | m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar); |
| 887 | break; |
| 888 | case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
| 889 | /* PC = 2 through 11, B cycle, write updated K1 through K10 */ |
| 890 | m_current_k[m_PC-2] = (m_current_k[m_PC-2] + (((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT))*(((m_PC-2)>4)?(1-m_uv_zpar):(1-m_zpar)); |
| 891 | break; |
| 892 | case 12: /* PC = 12 */ |
| 893 | /* we should NEVER reach this point, PC=12 doesn't have a subcycle 2 */ |
| 894 | break; |
| 895 | } |
| 896 | } |
| 870 | 897 | #endif |
| 871 | | m_target_energy = 0; |
| 872 | 898 | } |
| 873 | | } |
| 874 | | else // Not a new frame, just interpolate the existing frame. |
| 875 | | { |
| 876 | | int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value |
| 877 | | #ifdef PERFECT_INTERPOLATION_HACK |
| 878 | | int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW |
| 879 | | //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW |
| 880 | | int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7)); |
| 881 | 899 | |
| 882 | | zpar = OLD_FRAME_UNVOICED_FLAG; |
| 883 | | //fprintf(stderr, "CS: %03d", current_sample); |
| 884 | | // reset the current energy, pitch, etc to what it was at frame start |
| 885 | | m_current_energy = m_coeff->energytable[m_old_frame_energy_idx]; |
| 886 | | m_current_pitch = m_coeff->pitchtable[m_old_frame_pitch_idx]; |
| 887 | | for (i = 0; i < 4; i++) |
| 888 | | m_current_k[i] = m_coeff->ktable[i][m_old_frame_k_idx[i]]; |
| 889 | | for (i = 4; i < m_coeff->num_k; i++) |
| 890 | | m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-zpar)); |
| 891 | | // now adjust each value to be exactly correct for each of the samples per frame |
| 892 | | if (m_IP != 0) // if we're still interpolating... |
| 900 | // calculate the output |
| 901 | if (OLD_FRAME_UNVOICED_FLAG == 1) |
| 893 | 902 | { |
| 894 | | m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 895 | | m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 896 | | for (i = 0; i < m_coeff->num_k; i++) |
| 897 | | m_current_k[i] += (((m_target_k[i] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame; |
| 903 | // generate unvoiced samples here |
| 904 | if (m_RNG & 1) |
| 905 | m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/ |
| 906 | else |
| 907 | m_excitation_data = 0x40; |
| 898 | 908 | } |
| 899 | | else // we're done, play this frame for 1/8 frame. |
| 909 | else /* (OLD_FRAME_UNVOICED_FLAG == 0) */ |
| 900 | 910 | { |
| 901 | | m_current_energy = m_target_energy; |
| 902 | | m_current_pitch = m_target_pitch; |
| 903 | | for (i = 0; i < m_coeff->num_k; i++) |
| 904 | | m_current_k[i] = m_target_k[i]; |
| 911 | // generate voiced samples here |
| 912 | /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp |
| 913 | * function has a chirp/peak and then a long chain of zeroes. |
| 914 | * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, |
| 915 | * and if the address reaches that point the ADDRESS incrementer is |
| 916 | * disabled, forcing all samples beyond 51d to be == 51d |
| 917 | */ |
| 918 | if (m_pitch_count >= 51) |
| 919 | m_excitation_data = (INT8)m_coeff->chirptable[51]; |
| 920 | else /*m_pitch_count < 51*/ |
| 921 | m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; |
| 905 | 922 | } |
| 906 | | #else |
| 907 | | //Updates to parameters only happen on subcycle '2' (B cycle) of PCs. |
| 908 | | if (m_subcycle == 2) |
| 923 | |
| 924 | // Update LFSR *20* times every sample (once per T cycle), like patent shows |
| 925 | for (i=0; i<20; i++) |
| 909 | 926 | { |
| 910 | | switch(m_PC) |
| 911 | | { |
| 912 | | case 0: /* PC = 0, B cycle, write updated energy */ |
| 913 | | m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT); |
| 914 | | break; |
| 915 | | case 1: /* PC = 1, B cycle, write updated pitch */ |
| 916 | | m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT); |
| 917 | | break; |
| 918 | | case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
| 919 | | /* PC = 2 through 11, B cycle, write updated K1 through K10 */ |
| 920 | | m_current_k[m_PC-2] += (((m_target_k[m_PC-2] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT); |
| 921 | | break; |
| 922 | | case 12: /* PC = 12, do nothing */ |
| 923 | | break; |
| 924 | | } |
| 927 | bitout = ((m_RNG >> 12) & 1) ^ |
| 928 | ((m_RNG >> 3) & 1) ^ |
| 929 | ((m_RNG >> 2) & 1) ^ |
| 930 | ((m_RNG >> 0) & 1); |
| 931 | m_RNG <<= 1; |
| 932 | m_RNG |= bitout; |
| 925 | 933 | } |
| 926 | | #endif |
| 927 | | } |
| 928 | | |
| 929 | | // calculate the output |
| 930 | | if (OLD_FRAME_UNVOICED_FLAG == 1) |
| 931 | | { |
| 932 | | // generate unvoiced samples here |
| 933 | | if (m_RNG & 1) |
| 934 | | m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/ |
| 935 | | else |
| 936 | | m_excitation_data = 0x40; |
| 937 | | } |
| 938 | | else /* (OLD_FRAME_UNVOICED_FLAG == 0) */ |
| 939 | | { |
| 940 | | // generate voiced samples here |
| 941 | | /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp |
| 942 | | * function has a chirp/peak and then a long chain of zeroes. |
| 943 | | * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, |
| 944 | | * and if the address reaches that point the ADDRESS incrementer is |
| 945 | | * disabled, forcing all samples beyond 51d to be == 51d |
| 946 | | */ |
| 947 | | if (m_pitch_count >= 51) |
| 948 | | m_excitation_data = (INT8)m_coeff->chirptable[51]; |
| 949 | | else /*m_pitch_count < 51*/ |
| 950 | | m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; |
| 951 | | } |
| 952 | | |
| 953 | | // Update LFSR *20* times every sample (once per T cycle), like patent shows |
| 954 | | for (i=0; i<20; i++) |
| 955 | | { |
| 956 | | bitout = ((m_RNG >> 12) & 1) ^ |
| 957 | | ((m_RNG >> 3) & 1) ^ |
| 958 | | ((m_RNG >> 2) & 1) ^ |
| 959 | | ((m_RNG >> 0) & 1); |
| 960 | | m_RNG <<= 1; |
| 961 | | m_RNG |= bitout; |
| 962 | | } |
| 963 | | this_sample = lattice_filter(); /* execute lattice filter */ |
| 934 | this_sample = lattice_filter(); /* execute lattice filter */ |
| 964 | 935 | #ifdef DEBUG_GENERATION_VERBOSE |
| 965 | | //fprintf(stderr,"C:%01d; ",m_subcycle); |
| 966 | | fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 967 | | //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 968 | | for (i=0; i<10; i++) |
| 969 | | fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]); |
| 970 | | fprintf(stderr,"Out:%06d", this_sample); |
| 971 | | fprintf(stderr,"\n"); |
| 936 | //fprintf(stderr,"C:%01d; ",m_subcycle); |
| 937 | fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 938 | //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); |
| 939 | for (i=0; i<10; i++) |
| 940 | fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]); |
| 941 | fprintf(stderr,"Out:%06d ", this_sample); |
| 942 | //#ifdef PERFECT_INTERPOLATION_HACK |
| 943 | // fprintf(stderr,"%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar); |
| 944 | //#else |
| 945 | // fprintf(stderr,"x%dx%d",m_zpar,m_uv_zpar); |
| 946 | //#endif |
| 947 | fprintf(stderr,"\n"); |
| 972 | 948 | #endif |
| 973 | | /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */ |
| 974 | | while (this_sample > 16383) this_sample -= 32768; |
| 975 | | while (this_sample < -16384) this_sample += 32768; |
| 976 | | if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping |
| 977 | | buffer[buf_count] = clip_analog(this_sample); |
| 978 | | else // digital I/O pin output is 12 bits |
| 979 | | { |
| 949 | /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */ |
| 950 | while (this_sample > 16383) this_sample -= 32768; |
| 951 | while (this_sample < -16384) this_sample += 32768; |
| 952 | if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping |
| 953 | buffer[buf_count] = clip_analog(this_sample); |
| 954 | else // digital I/O pin output is 12 bits |
| 955 | { |
| 980 | 956 | #ifdef ALLOW_4_LSB |
| 981 | | // input: ssss ssss ssss ssss ssnn nnnn nnnn nnnn |
| 982 | | // N taps: ^ = 0x2000; |
| 983 | | // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN |
| 984 | | buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13); |
| 957 | // input: ssss ssss ssss ssss ssnn nnnn nnnn nnnn |
| 958 | // N taps: ^ = 0x2000; |
| 959 | // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN |
| 960 | buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13); |
| 985 | 961 | #else |
| 986 | | this_sample &= ~0xF; |
| 987 | | // input: ssss ssss ssss ssss ssnn nnnn nnnn 0000 |
| 988 | | // N taps: ^^ ^^^ = 0x3E00; |
| 989 | | // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN |
| 990 | | buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9); |
| 962 | this_sample &= ~0xF; |
| 963 | // input: ssss ssss ssss ssss ssnn nnnn nnnn 0000 |
| 964 | // N taps: ^^ ^^^ = 0x3E00; |
| 965 | // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN |
| 966 | buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9); |
| 991 | 967 | #endif |
| 992 | | } |
| 993 | | // Update all counts |
| 968 | } |
| 969 | // Update all counts |
| 994 | 970 | |
| 995 | | m_subcycle++; |
| 996 | | if ((m_subcycle == 2) && (m_PC == 12)) |
| 997 | | { |
| 998 | | /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0 |
| 999 | | * if INHIBIT was true during the most recent frame transition. |
| 1000 | | * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12 |
| 1001 | | * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles, |
| 1002 | | * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17 |
| 1003 | | * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is |
| 1004 | | * convenient and should make no difference in output. |
| 1005 | | */ |
| 1006 | | if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_count = 0; |
| 1007 | | m_subcycle = m_subc_reload; |
| 1008 | | m_PC = 0; |
| 1009 | | m_IP++; |
| 1010 | | m_IP&=0x7; |
| 971 | m_subcycle++; |
| 972 | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 973 | { |
| 974 | /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0 |
| 975 | * if INHIBIT was true during the most recent frame transition. |
| 976 | * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12 |
| 977 | * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles, |
| 978 | * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17 |
| 979 | * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is |
| 980 | * convenient and should make no difference in output. |
| 981 | */ |
| 982 | if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1; |
| 983 | if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0; |
| 984 | if (m_IP == 7) // RESETL4 |
| 985 | { |
| 986 | // Latch OLDE and OLDP |
| 987 | OLD_FRAME_SILENCE_FLAG = NEW_FRAME_SILENCE_FLAG; // m_OLDE |
| 988 | OLD_FRAME_UNVOICED_FLAG = NEW_FRAME_UNVOICED_FLAG; // m_OLDP |
| 989 | /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */ |
| 990 | #ifdef DEBUG_GENERATION |
| 991 | fprintf(stderr,"RESETL4, about to update status: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD); |
| 992 | #endif |
| 993 | #ifdef DEBUG_GENERATION |
| 994 | if (m_TALK == 0) |
| 995 | fprintf(stderr,"tms5220_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n"); |
| 996 | #endif |
| 997 | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 998 | update_fifo_status_and_ints(); // to trigger an interrupt if TALK_STATUS is now inactive |
| 999 | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 1000 | #ifdef DEBUG_GENERATION |
| 1001 | fprintf(stderr,"RESETL4, status updated: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD); |
| 1002 | #endif |
| 1003 | } |
| 1004 | m_subcycle = m_subc_reload; |
| 1005 | m_PC = 0; |
| 1006 | m_IP++; |
| 1007 | m_IP&=0x7; |
| 1008 | } |
| 1009 | else if (m_subcycle == 3) |
| 1010 | { |
| 1011 | m_subcycle = m_subc_reload; |
| 1012 | m_PC++; |
| 1013 | } |
| 1014 | m_pitch_count++; |
| 1015 | if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0; |
| 1016 | m_pitch_count &= 0x1FF; |
| 1011 | 1017 | } |
| 1012 | | else if (m_subcycle == 3) |
| 1018 | else // m_TALKD == 0 |
| 1013 | 1019 | { |
| 1014 | | m_subcycle = m_subc_reload; |
| 1015 | | m_PC++; |
| 1020 | m_subcycle++; |
| 1021 | if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3 |
| 1022 | { |
| 1023 | if (m_IP == 7) // RESETL4 |
| 1024 | { |
| 1025 | m_TALKD = m_TALK; // TALKD is latched from TALK |
| 1026 | m_TALK = m_SPEN; // TALK is latched from SPEN |
| 1027 | } |
| 1028 | m_subcycle = m_subc_reload; |
| 1029 | m_PC = 0; |
| 1030 | m_IP++; |
| 1031 | m_IP&=0x7; |
| 1032 | } |
| 1033 | else if (m_subcycle == 3) |
| 1034 | { |
| 1035 | m_subcycle = m_subc_reload; |
| 1036 | m_PC++; |
| 1037 | } |
| 1038 | buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */ |
| 1016 | 1039 | } |
| 1017 | | m_pitch_count++; |
| 1018 | | if (m_pitch_count >= m_current_pitch) m_pitch_count = 0; |
| 1019 | | m_pitch_count &= 0x1FF; |
| 1020 | | buf_count++; |
| 1021 | | size--; |
| 1040 | buf_count++; |
| 1041 | size--; |
| 1022 | 1042 | } |
| 1023 | | |
| 1024 | | empty: |
| 1025 | | |
| 1026 | | while (size > 0) |
| 1027 | | { |
| 1028 | | m_subcycle++; |
| 1029 | | if ((m_subcycle == 2) && (m_PC == 12)) |
| 1030 | | { |
| 1031 | | m_subcycle = m_subc_reload; |
| 1032 | | m_PC = 0; |
| 1033 | | m_IP++; |
| 1034 | | m_IP&=0x7; |
| 1035 | | } |
| 1036 | | else if (m_subcycle == 3) |
| 1037 | | { |
| 1038 | | m_subcycle = m_subc_reload; |
| 1039 | | m_PC++; |
| 1040 | | } |
| 1041 | | buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */ |
| 1042 | | buf_count++; |
| 1043 | | size--; |
| 1044 | | } |
| 1045 | 1043 | } |
| 1046 | 1044 | |
| 1047 | 1045 | /********************************************************************************************** |
| r249025 | r249026 | |
| 1182 | 1180 | |
| 1183 | 1181 | void tms5220_device::process_command(unsigned char cmd) |
| 1184 | 1182 | { |
| 1183 | int i; |
| 1185 | 1184 | #ifdef DEBUG_COMMAND_DUMP |
| 1186 | 1185 | fprintf(stderr,"process_command called with parameter %02X\n",cmd); |
| 1187 | 1186 | #endif |
| r249025 | r249026 | |
| 1189 | 1188 | switch (cmd & 0x70) |
| 1190 | 1189 | { |
| 1191 | 1190 | case 0x10 : /* read byte */ |
| 1192 | | if (m_talk_status == 0) /* TALKST must be clear for RDBY */ |
| 1191 | if (TALK_STATUS == 0) /* TALKST must be clear for RDBY */ |
| 1193 | 1192 | { |
| 1194 | 1193 | if (m_schedule_dummy_read) |
| 1195 | 1194 | { |
| r249025 | r249026 | |
| 1211 | 1210 | break; |
| 1212 | 1211 | |
| 1213 | 1212 | case 0x30 : /* read and branch */ |
| 1214 | | if (m_talk_status == 0) /* TALKST must be clear for RB */ |
| 1213 | if (TALK_STATUS == 0) /* TALKST must be clear for RB */ |
| 1215 | 1214 | { |
| 1216 | 1215 | #ifdef VERBOSE |
| 1217 | | logerror("read and branch command received\n"); |
| 1216 | fprintf(stderr,"read and branch command received\n"); |
| 1218 | 1217 | #endif |
| 1219 | 1218 | m_RDB_flag = FALSE; |
| 1220 | 1219 | if (m_speechrom) |
| r249025 | r249026 | |
| 1223 | 1222 | break; |
| 1224 | 1223 | |
| 1225 | 1224 | case 0x40 : /* load address */ |
| 1226 | | if (m_talk_status == 0) /* TALKST must be clear for LA */ |
| 1225 | if (TALK_STATUS == 0) /* TALKST must be clear for LA */ |
| 1227 | 1226 | { |
| 1228 | 1227 | /* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work. |
| 1229 | 1228 | This code does not care about this. */ |
| r249025 | r249026 | |
| 1240 | 1239 | if (m_speechrom) |
| 1241 | 1240 | m_speechrom->read(1); |
| 1242 | 1241 | } |
| 1243 | | m_speaking_now = 1; |
| 1244 | | m_speak_external = 0; |
| 1245 | | m_talk_status = 1; /* start immediately */ |
| 1246 | | /* clear out variables before speaking */ |
| 1247 | | // TODO: similar to the victory case described above, but for VSM speech |
| 1248 | | m_subcycle = m_subc_reload; |
| 1249 | | m_PC = 0; |
| 1250 | | m_IP = reload_table[m_c_variant_rate&0x3]; |
| 1242 | m_SPEN = 1; |
| 1243 | #ifdef FAST_START_HACK |
| 1244 | m_TALK = 1; |
| 1245 | #endif |
| 1246 | m_DDIS = 0; |
| 1247 | m_zpar = 1; // zero all the parameters |
| 1248 | m_uv_zpar = 1; // zero k4-k10 as well |
| 1249 | m_OLDE = 1; // 'silence/zpar' frames are zero energy |
| 1250 | m_OLDP = 1; // 'silence/zpar' frames are zero pitch |
| 1251 | #ifdef PERFECT_INTERPOLATION_HACK |
| 1252 | m_old_zpar = 1; // zero all the old parameters |
| 1253 | m_old_uv_zpar = 1; // zero old k4-k10 as well |
| 1254 | #endif |
| 1255 | // following is semi-hack but matches idle state observed on chip |
| 1251 | 1256 | m_new_frame_energy_idx = 0; |
| 1252 | 1257 | m_new_frame_pitch_idx = 0; |
| 1253 | | int i; |
| 1254 | 1258 | for (i = 0; i < 4; i++) |
| 1255 | 1259 | m_new_frame_k_idx[i] = 0; |
| 1256 | 1260 | for (i = 4; i < 7; i++) |
| r249025 | r249026 | |
| 1260 | 1264 | break; |
| 1261 | 1265 | |
| 1262 | 1266 | case 0x60 : /* speak external */ |
| 1263 | | //SPKEXT going active activates SPKEE which clears the fifo |
| 1267 | // SPKEXT going active activates SPKEE which clears the fifo |
| 1264 | 1268 | m_fifo_head = m_fifo_tail = m_fifo_count = m_fifo_bits_taken = 0; |
| 1265 | | m_speak_external = 1; |
| 1269 | // SPEN is enabled when the fifo passes half full (falling edge of BL signal) |
| 1270 | m_DDIS = 1; |
| 1271 | m_zpar = 1; // zero all the parameters |
| 1272 | m_uv_zpar = 1; // zero k4-k10 as well |
| 1273 | m_OLDE = 1; // 'silence/zpar' frames are zero energy |
| 1274 | m_OLDP = 1; // 'silence/zpar' frames are zero pitch |
| 1275 | #ifdef PERFECT_INTERPOLATION_HACK |
| 1276 | m_old_zpar = 1; // zero all the old parameters |
| 1277 | m_old_uv_zpar = 1; // zero old k4-k10 as well |
| 1278 | #endif |
| 1279 | // following is semi-hack but matches idle state observed on chip |
| 1280 | m_new_frame_energy_idx = 0; |
| 1281 | m_new_frame_pitch_idx = 0; |
| 1282 | for (i = 0; i < 4; i++) |
| 1283 | m_new_frame_k_idx[i] = 0; |
| 1284 | for (i = 4; i < 7; i++) |
| 1285 | m_new_frame_k_idx[i] = 0xF; |
| 1286 | for (i = 7; i < m_coeff->num_k; i++) |
| 1287 | m_new_frame_k_idx[i] = 0x7; |
| 1266 | 1288 | m_RDB_flag = FALSE; |
| 1267 | 1289 | break; |
| 1268 | 1290 | |
| r249025 | r249026 | |
| 1308 | 1330 | m_IP = reload_table[m_c_variant_rate&0x3]; |
| 1309 | 1331 | |
| 1310 | 1332 | update_fifo_status_and_ints(); |
| 1311 | | if (!m_talk_status) goto ranout; |
| 1333 | if (m_DDIS && m_buffer_empty) goto ranout; |
| 1312 | 1334 | |
| 1313 | 1335 | // attempt to extract the energy index |
| 1314 | 1336 | m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits); |
| r249025 | r249026 | |
| 1317 | 1339 | fprintf(stderr," "); |
| 1318 | 1340 | #endif |
| 1319 | 1341 | update_fifo_status_and_ints(); |
| 1320 | | if (!m_talk_status) goto ranout; |
| 1342 | if (m_DDIS && m_buffer_empty) goto ranout; |
| 1321 | 1343 | // if the energy index is 0 or 15, we're done |
| 1322 | 1344 | if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15)) |
| 1323 | 1345 | return; |
| r249025 | r249026 | |
| 1337 | 1359 | fprintf(stderr," "); |
| 1338 | 1360 | #endif |
| 1339 | 1361 | update_fifo_status_and_ints(); |
| 1340 | | if (!m_talk_status) goto ranout; |
| 1362 | if (m_DDIS && m_buffer_empty) goto ranout; |
| 1341 | 1363 | // if this is a repeat frame, just do nothing, it will reuse the old coefficients |
| 1342 | 1364 | if (rep_flag) |
| 1343 | 1365 | return; |
| r249025 | r249026 | |
| 1351 | 1373 | fprintf(stderr," "); |
| 1352 | 1374 | #endif |
| 1353 | 1375 | update_fifo_status_and_ints(); |
| 1354 | | if (!m_talk_status) goto ranout; |
| 1376 | if (m_DDIS && m_buffer_empty) goto ranout; |
| 1355 | 1377 | } |
| 1356 | 1378 | |
| 1357 | 1379 | // if the pitch index was zero, we only need 4 K's... |
| r249025 | r249026 | |
| 1370 | 1392 | fprintf(stderr," "); |
| 1371 | 1393 | #endif |
| 1372 | 1394 | update_fifo_status_and_ints(); |
| 1373 | | if (!m_talk_status) goto ranout; |
| 1395 | if (m_DDIS && m_buffer_empty) goto ranout; |
| 1374 | 1396 | } |
| 1397 | #ifdef DEBUG_PARSE_FRAME_DUMP |
| 1398 | fprintf(stderr,"\n"); |
| 1399 | #endif |
| 1375 | 1400 | #ifdef VERBOSE |
| 1376 | | if (m_speak_external) |
| 1377 | | logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken)); |
| 1401 | if (m_DDIS) |
| 1402 | fprintf(stderr,"Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken)); |
| 1378 | 1403 | else |
| 1379 | | logerror("Parsed a frame successfully in ROM\n"); |
| 1404 | fprintf(stderr,"Parsed a frame successfully in ROM\n"); |
| 1380 | 1405 | #endif |
| 1381 | 1406 | return; |
| 1382 | 1407 | |
| 1383 | 1408 | ranout: |
| 1384 | 1409 | #ifdef DEBUG_FRAME_ERRORS |
| 1385 | | logerror("Ran out of bits on a parse!\n"); |
| 1410 | fprintf(stderr,"Ran out of bits on a parse!\n"); |
| 1386 | 1411 | #endif |
| 1387 | 1412 | return; |
| 1388 | 1413 | } |
| r249025 | r249026 | |
| 1397 | 1422 | { |
| 1398 | 1423 | if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip, since there's no int pin |
| 1399 | 1424 | #ifdef DEBUG_PIN_READS |
| 1400 | | logerror("irq pin set to state %d\n", state); |
| 1425 | fprintf(stderr,"irq pin set to state %d\n", state); |
| 1401 | 1426 | #endif |
| 1402 | 1427 | if (!m_irq_handler.isnull() && state != m_irq_pin) |
| 1403 | 1428 | m_irq_handler(!state); |
| r249025 | r249026 | |
| 1414 | 1439 | { |
| 1415 | 1440 | int state = ready_read(); |
| 1416 | 1441 | #ifdef DEBUG_PIN_READS |
| 1417 | | logerror("ready pin set to state %d\n", state); |
| 1442 | fprintf(stderr,"ready pin set to state %d\n", state); |
| 1418 | 1443 | #endif |
| 1419 | 1444 | if (!m_readyq_handler.isnull() && state != m_ready_pin) |
| 1420 | 1445 | m_readyq_handler(!state); |
| r249025 | r249026 | |
| 1514 | 1539 | |
| 1515 | 1540 | /* initialize the chip state */ |
| 1516 | 1541 | /* Note that we do not actually clear IRQ on start-up : IRQ is even raised if m_buffer_empty or m_buffer_low are 0 */ |
| 1517 | | m_speaking_now = m_speak_external = m_talk_status = m_irq_pin = m_ready_pin = 0; |
| 1542 | m_SPEN = m_DDIS = m_TALK = m_TALKD = m_previous_TALK_STATUS = m_irq_pin = m_ready_pin = 0; |
| 1518 | 1543 | set_interrupt_state(0); |
| 1519 | 1544 | update_ready_state(); |
| 1520 | 1545 | m_buffer_empty = m_buffer_low = 1; |
| r249025 | r249026 | |
| 1525 | 1550 | #ifdef PERFECT_INTERPOLATION_HACK |
| 1526 | 1551 | m_old_frame_energy_idx = m_old_frame_pitch_idx = 0; |
| 1527 | 1552 | memset(m_old_frame_k_idx, 0, sizeof(m_old_frame_k_idx)); |
| 1553 | m_old_zpar = 0; |
| 1528 | 1554 | #endif |
| 1529 | | m_new_frame_energy_idx = m_current_energy = m_target_energy = m_previous_energy = 0; |
| 1530 | | m_new_frame_pitch_idx = m_current_pitch = m_target_pitch = 0; |
| 1555 | m_new_frame_energy_idx = m_current_energy = m_previous_energy = 0; |
| 1556 | m_new_frame_pitch_idx = m_current_pitch = 0; |
| 1557 | m_zpar = m_uv_zpar = 0; |
| 1531 | 1558 | memset(m_new_frame_k_idx, 0, sizeof(m_new_frame_k_idx)); |
| 1532 | 1559 | memset(m_current_k, 0, sizeof(m_current_k)); |
| 1533 | | memset(m_target_k, 0, sizeof(m_target_k)); |
| 1534 | 1560 | |
| 1535 | 1561 | /* initialize the sample generators */ |
| 1536 | 1562 | m_inhibit = 1; |
| r249025 | r249026 | |
| 1574 | 1600 | /* Write */ |
| 1575 | 1601 | /* bring up to date first */ |
| 1576 | 1602 | #ifdef DEBUG_IO_READY |
| 1577 | | logerror("Serviced write: %02x\n", m_write_latch); |
| 1603 | fprintf(stderr,"Serviced write: %02x\n", m_write_latch); |
| 1578 | 1604 | //fprintf(stderr, "Processed write data: %02X\n", m_write_latch); |
| 1579 | 1605 | #endif |
| 1580 | 1606 | m_stream->update(); |
| r249025 | r249026 | |
| 1610 | 1636 | m_true_timing = 1; |
| 1611 | 1637 | state &= 0x01; |
| 1612 | 1638 | #ifdef DEBUG_RS_WS |
| 1613 | | logerror("/RS written with data: %d\n", state); |
| 1639 | fprintf(stderr,"/RS written with data: %d\n", state); |
| 1614 | 1640 | #endif |
| 1615 | 1641 | new_val = (m_rs_ws & 0x01) | (state<<1); |
| 1616 | 1642 | if (new_val != m_rs_ws) |
| r249025 | r249026 | |
| 1623 | 1649 | #ifdef DEBUG_RS_WS |
| 1624 | 1650 | else |
| 1625 | 1651 | /* illegal */ |
| 1626 | | logerror("tms5220_rs_w: illegal\n"); |
| 1652 | fprintf(stderr,"tms5220_rs_w: illegal\n"); |
| 1627 | 1653 | #endif |
| 1628 | 1654 | return; |
| 1629 | 1655 | } |
| r249025 | r249026 | |
| 1641 | 1667 | { |
| 1642 | 1668 | /* high to low - schedule ready cycle */ |
| 1643 | 1669 | #ifdef DEBUG_RS_WS |
| 1644 | | logerror("Scheduling ready cycle for /RS...\n"); |
| 1670 | fprintf(stderr,"Scheduling ready cycle for /RS...\n"); |
| 1645 | 1671 | #endif |
| 1646 | 1672 | /* upon /RS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */ |
| 1647 | 1673 | m_io_ready = 0; |
| r249025 | r249026 | |
| 1662 | 1688 | m_true_timing = 1; |
| 1663 | 1689 | state &= 0x01; |
| 1664 | 1690 | #ifdef DEBUG_RS_WS |
| 1665 | | logerror("/WS written with data: %d\n", state); |
| 1691 | fprintf(stderr,"/WS written with data: %d\n", state); |
| 1666 | 1692 | #endif |
| 1667 | 1693 | new_val = (m_rs_ws & 0x02) | (state<<0); |
| 1668 | 1694 | if (new_val != m_rs_ws) |
| r249025 | r249026 | |
| 1675 | 1701 | #ifdef DEBUG_RS_WS |
| 1676 | 1702 | else |
| 1677 | 1703 | /* illegal */ |
| 1678 | | logerror("tms5220_ws_w: illegal\n"); |
| 1704 | fprintf(stderr,"tms5220_ws_w: illegal\n"); |
| 1679 | 1705 | #endif |
| 1680 | 1706 | return; |
| 1681 | 1707 | } |
| r249025 | r249026 | |
| 1693 | 1719 | { |
| 1694 | 1720 | /* high to low - schedule ready cycle */ |
| 1695 | 1721 | #ifdef DEBUG_RS_WS |
| 1696 | | logerror("Scheduling ready cycle for /WS...\n"); |
| 1722 | fprintf(stderr,"Scheduling ready cycle for /WS...\n"); |
| 1697 | 1723 | #endif |
| 1698 | 1724 | /* upon /WS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */ |
| 1699 | 1725 | m_io_ready = 0; |
| r249025 | r249026 | |
| 1726 | 1752 | if (space.debugger_access()) return; |
| 1727 | 1753 | |
| 1728 | 1754 | #ifdef DEBUG_RS_WS |
| 1729 | | logerror("tms5220_data_w: data %02x\n", data); |
| 1755 | fprintf(stderr,"tms5220_data_w: data %02x\n", data); |
| 1730 | 1756 | #endif |
| 1731 | 1757 | if (!m_true_timing) |
| 1732 | 1758 | { |
| r249025 | r249026 | |
| 1739 | 1765 | /* actually in a write ? */ |
| 1740 | 1766 | #ifdef DEBUG_RS_WS |
| 1741 | 1767 | if (!(m_rs_ws == 0x02)) |
| 1742 | | logerror("tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws); |
| 1768 | fprintf(stderr,"tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws); |
| 1743 | 1769 | #endif |
| 1744 | 1770 | m_write_latch = data; |
| 1745 | 1771 | } |
| r249025 | r249026 | |
| 1771 | 1797 | return m_read_latch; |
| 1772 | 1798 | #ifdef DEBUG_RS_WS |
| 1773 | 1799 | else |
| 1774 | | logerror("tms5220_status_r: data read outside rs!\n"); |
| 1800 | fprintf(stderr,"tms5220_status_r: data read outside rs!\n"); |
| 1775 | 1801 | #endif |
| 1776 | 1802 | return 0xff; |
| 1777 | 1803 | } |
trunk/src/mame/drivers/chexx.c
| r0 | r249026 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Luca Elia |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | Electro-mechanical bubble hockey games: |
| 6 | |
| 7 | - Chexx (1983 version) by ICE |
| 8 | http://www.pinrepair.com/arcade/chexx.htm |
| 9 | |
| 10 | - Face-Off, an illegal? copy of Chexx |
| 11 | http://valker.us/gameroom/SegaFaceOff.htm |
| 12 | https://casetext.com/case/innovative-concepts-in-ent-v-entertainment-enter |
| 13 | |
| 14 | (Some sources indicate these may have been copied from a earlier Sega game called Face-Off) |
| 15 | |
| 16 | ***************************************************************************/ |
| 17 | |
| 18 | #include "emu.h" |
| 19 | #include "cpu/m6502/m6502.h" |
| 20 | #include "sound/ay8910.h" |
| 21 | #include "sound/digitalk.h" |
| 22 | #include "machine/6522via.h" |
| 23 | #include "chexx.lh" |
| 24 | |
| 25 | #define MAIN_CLOCK XTAL_4MHz |
| 26 | |
| 27 | class chexx_state : public driver_device |
| 28 | { |
| 29 | public: |
| 30 | chexx_state(const machine_config &mconfig, device_type type, const char *tag) |
| 31 | : driver_device(mconfig, type, tag), |
| 32 | m_maincpu(*this, "maincpu"), |
| 33 | m_via(*this, "via6522"), |
| 34 | m_digitalker(*this, "digitalker"), |
| 35 | m_aysnd(*this, "aysnd") |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | // devices |
| 40 | required_device<cpu_device> m_maincpu; |
| 41 | required_device<via6522_device> m_via; |
| 42 | required_device<digitalker_device> m_digitalker; |
| 43 | optional_device<ay8910_device> m_aysnd; // only faceoffh |
| 44 | |
| 45 | // vars |
| 46 | UINT8 m_port_a, m_port_b; |
| 47 | UINT8 m_bank; |
| 48 | UINT32 m_shift; |
| 49 | UINT8 m_lamp; |
| 50 | UINT8 m_ay_cmd, m_ay_data; |
| 51 | |
| 52 | // callbacks |
| 53 | TIMER_DEVICE_CALLBACK_MEMBER(update); |
| 54 | |
| 55 | // handlers |
| 56 | DECLARE_READ8_MEMBER(via_a_in); |
| 57 | DECLARE_READ8_MEMBER(via_b_in); |
| 58 | |
| 59 | DECLARE_WRITE8_MEMBER(via_a_out); |
| 60 | DECLARE_WRITE8_MEMBER(via_b_out); |
| 61 | |
| 62 | DECLARE_WRITE_LINE_MEMBER(via_ca2_out); |
| 63 | DECLARE_WRITE_LINE_MEMBER(via_cb1_out); |
| 64 | DECLARE_WRITE_LINE_MEMBER(via_cb2_out); |
| 65 | DECLARE_WRITE_LINE_MEMBER(via_irq_out); |
| 66 | |
| 67 | DECLARE_READ8_MEMBER(input_r); |
| 68 | |
| 69 | DECLARE_WRITE8_MEMBER(ay_w); |
| 70 | DECLARE_WRITE8_MEMBER(lamp_w); |
| 71 | |
| 72 | // digitalker |
| 73 | void digitalker_set_bank(UINT8 bank); |
| 74 | |
| 75 | // driver_device overrides |
| 76 | virtual void machine_start(); |
| 77 | virtual void machine_reset(); |
| 78 | }; |
| 79 | |
| 80 | |
| 81 | // VIA |
| 82 | |
| 83 | READ8_MEMBER(chexx_state::via_a_in) |
| 84 | { |
| 85 | UINT8 ret = 0; |
| 86 | logerror("%s: VIA read A: %02X\n", machine().describe_context(), ret); |
| 87 | return ret; |
| 88 | } |
| 89 | READ8_MEMBER(chexx_state::via_b_in) |
| 90 | { |
| 91 | UINT8 ret = 0; |
| 92 | logerror("%s: VIA read B: %02X\n", machine().describe_context(), ret); |
| 93 | return ret; |
| 94 | } |
| 95 | |
| 96 | WRITE8_MEMBER(chexx_state::via_a_out) |
| 97 | { |
| 98 | m_port_a = data; // multiplexer |
| 99 | |
| 100 | m_digitalker->digitalker_data_w(space, 0, data, 0); |
| 101 | |
| 102 | // logerror("%s: VIA write A = %02X\n", machine().describe_context(), data); |
| 103 | } |
| 104 | WRITE8_MEMBER(chexx_state::via_b_out) |
| 105 | { |
| 106 | m_port_b = data; |
| 107 | |
| 108 | digitalker_set_bank(data & 3); |
| 109 | m_digitalker->set_output_gain(0, BIT(data,2) ? 1.0f : 0.0f); // bit 2 controls the Digitalker output |
| 110 | coin_counter_w(machine(), 0, BIT(~data,3)); |
| 111 | // bit 4 is EJECT |
| 112 | // bit 7 is related to speaker out |
| 113 | |
| 114 | // logerror("%s: VIA write B = %02X\n", machine().describe_context(), data); |
| 115 | } |
| 116 | |
| 117 | WRITE_LINE_MEMBER(chexx_state::via_ca2_out) |
| 118 | { |
| 119 | m_digitalker->digitalker_0_cms_w(CLEAR_LINE); |
| 120 | m_digitalker->digitalker_0_cs_w(CLEAR_LINE); |
| 121 | m_digitalker->digitalker_0_wr_w(state ? ASSERT_LINE : CLEAR_LINE); |
| 122 | |
| 123 | // logerror("%s: VIA write CA2 = %02X\n", machine().describe_context(), state); |
| 124 | } |
| 125 | WRITE_LINE_MEMBER(chexx_state::via_cb1_out) |
| 126 | { |
| 127 | // logerror("%s: VIA write CB1 = %02X\n", machine().describe_context(), state); |
| 128 | } |
| 129 | WRITE_LINE_MEMBER(chexx_state::via_cb2_out) |
| 130 | { |
| 131 | m_shift = ((m_shift << 1) & 0xffffff) | state; |
| 132 | |
| 133 | // 7segs (score) |
| 134 | static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0, 0, 0, 0, 0, 0 }; // 4511 |
| 135 | |
| 136 | output_set_digit_value(0, patterns[(m_shift >> (16+4)) & 0xf]); |
| 137 | output_set_digit_value(1, patterns[(m_shift >> (16+0)) & 0xf]); |
| 138 | |
| 139 | output_set_digit_value(2, patterns[(m_shift >> (8+4)) & 0xf]); |
| 140 | output_set_digit_value(3, patterns[(m_shift >> (8+0)) & 0xf]); |
| 141 | |
| 142 | // Leds (period being played) |
| 143 | output_set_led_value(0, BIT(m_shift,2)); |
| 144 | output_set_led_value(1, BIT(m_shift,1)); |
| 145 | output_set_led_value(2, BIT(m_shift,0)); |
| 146 | |
| 147 | // logerror("%s: VIA write CB2 = %02X\n", machine().describe_context(), state); |
| 148 | } |
| 149 | WRITE_LINE_MEMBER(chexx_state::via_irq_out) |
| 150 | { |
| 151 | m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); |
| 152 | // logerror("%s: VIA write IRQ = %02X\n", machine().describe_context(), state); |
| 153 | } |
| 154 | |
| 155 | READ8_MEMBER(chexx_state::input_r) |
| 156 | { |
| 157 | UINT8 ret = ioport("DSW")->read(); // bits 0-3 |
| 158 | UINT8 inp = ioport("INPUT")->read(); // bit 7 (multiplexed) |
| 159 | |
| 160 | for (int i = 0; i < 8; ++i) |
| 161 | if ( ((~m_port_a) & (1 << i)) && ((~inp) & (1 << i)) ) |
| 162 | ret &= 0x7f; |
| 163 | |
| 164 | return ret; |
| 165 | } |
| 166 | |
| 167 | // Chexx Memory Map |
| 168 | |
| 169 | static ADDRESS_MAP_START( chexx83_map, AS_PROGRAM, 8, chexx_state ) |
| 170 | AM_RANGE(0x0000, 0x007f) AM_RAM AM_MIRROR(0x100) // 6810 - 128 x 8 static RAM |
| 171 | AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("via6522", via6522_device, read, write) |
| 172 | AM_RANGE(0x8000, 0x8000) AM_READ(input_r) |
| 173 | AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION("maincpu", 0) |
| 174 | ADDRESS_MAP_END |
| 175 | |
| 176 | // Face-Off Memory Map |
| 177 | |
| 178 | WRITE8_MEMBER(chexx_state::lamp_w) |
| 179 | { |
| 180 | m_lamp = data; |
| 181 | output_set_lamp_value(0, BIT(m_lamp,0)); |
| 182 | output_set_lamp_value(1, BIT(m_lamp,1)); |
| 183 | } |
| 184 | |
| 185 | WRITE8_MEMBER(chexx_state::ay_w) |
| 186 | { |
| 187 | if (offset) |
| 188 | { |
| 189 | m_ay_data = data; |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | if (m_ay_cmd == 0x00 && data == 0x03) |
| 194 | { |
| 195 | m_aysnd->address_w(space, offset, m_ay_data, mem_mask); |
| 196 | // logerror("%s: AY addr = %02X\n", machine().describe_context(), m_ay_data); |
| 197 | } |
| 198 | else if (m_ay_cmd == 0x00 && data == 0x02) |
| 199 | { |
| 200 | m_aysnd->data_w(space, offset, m_ay_data, mem_mask); |
| 201 | // logerror("%s: AY data = %02X\n", machine().describe_context(), m_ay_data); |
| 202 | } |
| 203 | m_ay_cmd = data; |
| 204 | } |
| 205 | |
| 206 | static ADDRESS_MAP_START( faceoffh_map, AS_PROGRAM, 8, chexx_state ) |
| 207 | AM_RANGE(0x0000, 0x007f) AM_RAM AM_MIRROR(0x100) // M58725P - 2KB |
| 208 | AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("via6522", via6522_device, read, write) |
| 209 | AM_RANGE(0x8000, 0x8000) AM_READ(input_r) |
| 210 | AM_RANGE(0xa000, 0xa001) AM_WRITE(ay_w) |
| 211 | AM_RANGE(0xc000, 0xc000) AM_WRITE(lamp_w) |
| 212 | AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("maincpu", 0) |
| 213 | ADDRESS_MAP_END |
| 214 | |
| 215 | // Inputs |
| 216 | |
| 217 | static INPUT_PORTS_START( chexx83 ) |
| 218 | PORT_START("COIN") |
| 219 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) // play anthem |
| 220 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) // play anthem |
| 221 | |
| 222 | PORT_START("INPUT") |
| 223 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 Goal Sensor") |
| 224 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Goal Sensor") |
| 225 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 ) PORT_NAME("Puck Near Goal Sensors") // play "ohh" sample |
| 226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Boo Button") // stop anthem, play "boo" sample, eject puck |
| 227 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Boo Button") // stop anthem, play "boo" sample, eject puck |
| 228 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Puck Eject Ready Sensor") |
| 229 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 230 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 231 | |
| 232 | PORT_START("DSW") |
| 233 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") |
| 234 | PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) ) |
| 235 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| 236 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| 237 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 238 | PORT_DIPNAME( 0x0c, 0x00, "Game Duration (mins)" ) PORT_DIPLOCATION("SW1:3,4") |
| 239 | PORT_DIPSETTING( 0x00, "2" ) // 40 |
| 240 | PORT_DIPSETTING( 0x04, "3" ) // 60 |
| 241 | PORT_DIPSETTING( 0x08, "4" ) // 80 |
| 242 | PORT_DIPSETTING( 0x0c, "5" ) // 100 |
| 243 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 244 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) // multiplexed inputs |
| 245 | INPUT_PORTS_END |
| 246 | |
| 247 | // Machine |
| 248 | |
| 249 | void chexx_state::machine_start() |
| 250 | { |
| 251 | } |
| 252 | |
| 253 | void chexx_state::digitalker_set_bank(UINT8 bank) |
| 254 | { |
| 255 | if (m_bank != bank) |
| 256 | { |
| 257 | UINT8 *src = memregion("samples")->base(); |
| 258 | UINT8 *dst = memregion("digitalker")->base(); |
| 259 | |
| 260 | memcpy(dst, src + bank * 0x4000, 0x4000); |
| 261 | |
| 262 | m_bank = bank; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | void chexx_state::machine_reset() |
| 267 | { |
| 268 | m_bank = -1; |
| 269 | digitalker_set_bank(0); |
| 270 | } |
| 271 | |
| 272 | TIMER_DEVICE_CALLBACK_MEMBER(chexx_state::update) |
| 273 | { |
| 274 | // NMI on coin-in |
| 275 | UINT8 coin = (~ioport("COIN")->read()) & 0x03; |
| 276 | m_maincpu->set_input_line(INPUT_LINE_NMI, coin ? ASSERT_LINE : CLEAR_LINE); |
| 277 | |
| 278 | // VIA CA1 connected to Digitalker INTR line |
| 279 | m_via->write_ca1(m_digitalker->digitalker_0_intr_r()); |
| 280 | |
| 281 | #if 0 |
| 282 | // Play the digitalker samples (it's not hooked up correctly yet) |
| 283 | static UINT8 sample = 0, bank = 0; |
| 284 | |
| 285 | if (machine().input().code_pressed_once(KEYCODE_Q)) |
| 286 | --bank; |
| 287 | if (machine().input().code_pressed_once(KEYCODE_W)) |
| 288 | ++bank; |
| 289 | bank %= 3; |
| 290 | digitalker_set_bank(bank); |
| 291 | |
| 292 | if (machine().input().code_pressed_once(KEYCODE_A)) |
| 293 | --sample; |
| 294 | if (machine().input().code_pressed_once(KEYCODE_S)) |
| 295 | ++sample; |
| 296 | |
| 297 | if (machine().input().code_pressed_once(KEYCODE_Z)) |
| 298 | { |
| 299 | m_digitalker->digitalker_0_cms_w(CLEAR_LINE); |
| 300 | m_digitalker->digitalker_0_cs_w(CLEAR_LINE); |
| 301 | |
| 302 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 303 | m_digitalker->digitalker_data_w(space, 0, sample, 0); |
| 304 | |
| 305 | m_digitalker->digitalker_0_wr_w(ASSERT_LINE); |
| 306 | m_digitalker->digitalker_0_wr_w(CLEAR_LINE); |
| 307 | m_digitalker->digitalker_0_wr_w(ASSERT_LINE); |
| 308 | } |
| 309 | #endif |
| 310 | } |
| 311 | |
| 312 | static MACHINE_CONFIG_START( chexx83, chexx_state ) |
| 313 | |
| 314 | // basic machine hardware |
| 315 | MCFG_CPU_ADD("maincpu", M6502, MAIN_CLOCK/2) |
| 316 | MCFG_CPU_PROGRAM_MAP(chexx83_map) |
| 317 | MCFG_TIMER_DRIVER_ADD_PERIODIC("update", chexx_state, update, attotime::from_hz(60)) |
| 318 | |
| 319 | // via |
| 320 | MCFG_DEVICE_ADD("via6522", VIA6522, MAIN_CLOCK/4) |
| 321 | |
| 322 | MCFG_VIA6522_READPA_HANDLER(READ8(chexx_state, via_a_in)) |
| 323 | MCFG_VIA6522_READPB_HANDLER(READ8(chexx_state, via_b_in)) |
| 324 | |
| 325 | MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(chexx_state, via_a_out)) |
| 326 | MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(chexx_state, via_b_out)) |
| 327 | |
| 328 | MCFG_VIA6522_CA2_HANDLER(WRITELINE(chexx_state, via_ca2_out)) |
| 329 | MCFG_VIA6522_CB1_HANDLER(WRITELINE(chexx_state, via_cb1_out)) |
| 330 | MCFG_VIA6522_CB2_HANDLER(WRITELINE(chexx_state, via_cb2_out)) |
| 331 | MCFG_VIA6522_IRQ_HANDLER(WRITELINE(chexx_state, via_irq_out)) |
| 332 | |
| 333 | // Layout |
| 334 | MCFG_DEFAULT_LAYOUT(layout_chexx) |
| 335 | |
| 336 | // sound hardware |
| 337 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 338 | MCFG_DIGITALKER_ADD("digitalker", MAIN_CLOCK) |
| 339 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.16) |
| 340 | MACHINE_CONFIG_END |
| 341 | |
| 342 | static MACHINE_CONFIG_DERIVED( faceoffh, chexx83 ) |
| 343 | MCFG_CPU_MODIFY("maincpu") |
| 344 | MCFG_CPU_PROGRAM_MAP(faceoffh_map) |
| 345 | |
| 346 | MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/2) |
| 347 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 348 | MACHINE_CONFIG_END |
| 349 | |
| 350 | // ROMs |
| 351 | |
| 352 | /*************************************************************************** |
| 353 | |
| 354 | Chexx Hockey (1983 version 1.1) |
| 355 | |
| 356 | The "long and skinny" Moog CPU board used a 6502 for the processor, |
| 357 | a 6522 for the PIA, a 6810 static RAM, eight 52164 64k bit sound ROM chips, |
| 358 | a 40 pin 54104 sound chip, and a single 2716 CPU EPROM |
| 359 | |
| 360 | ***************************************************************************/ |
| 361 | |
| 362 | ROM_START( chexx83 ) |
| 363 | ROM_REGION( 0x0800, "maincpu", 0 ) |
| 364 | ROM_LOAD( "chexx83.u4", 0x0000, 0x0800, CRC(a34abac1) SHA1(75a31670eb6d1b62ba984f0bac7c6e6067f6ae87) ) |
| 365 | |
| 366 | ROM_REGION( 0x4000, "digitalker", ROMREGION_ERASE00 ) |
| 367 | // bank switched (from samples region) |
| 368 | |
| 369 | ROM_REGION( 0x10000, "samples", ROMREGION_ERASE00 ) |
| 370 | ROM_LOAD( "chexx83.u12", 0x0000, 0x2000, NO_DUMP ) |
| 371 | ROM_LOAD( "chexx83.u13", 0x2000, 0x2000, NO_DUMP ) |
| 372 | ROM_LOAD( "chexx83.u14", 0x4000, 0x2000, NO_DUMP ) |
| 373 | ROM_LOAD( "chexx83.u15", 0x6000, 0x2000, NO_DUMP ) |
| 374 | ROM_LOAD( "chexx83.u16", 0x8000, 0x2000, NO_DUMP ) |
| 375 | ROM_LOAD( "chexx83.u17", 0xa000, 0x2000, NO_DUMP ) |
| 376 | ROM_LOAD( "chexx83.u18", 0xc000, 0x2000, NO_DUMP ) |
| 377 | ROM_LOAD( "chexx83.u19", 0xe000, 0x2000, NO_DUMP ) |
| 378 | ROM_END |
| 379 | |
| 380 | /*************************************************************************** |
| 381 | |
| 382 | Face-Off PCB? |
| 383 | |
| 384 | Entertainment Enterprises Ltd. 1983 (sticker) |
| 385 | Serial No. 025402 (sticker) |
| 386 | MADE IN JAPAN (etched) |
| 387 | |
| 388 | CPU: R6502P |
| 389 | RAM: M58725P (2KB) |
| 390 | I/O: R6522P (VIA) |
| 391 | Samples: Digitalker (MM54104) |
| 392 | Music: AY-3-8910 |
| 393 | Misc: XTAL 4MHz, DSW4, 42-pin connector |
| 394 | |
| 395 | ***************************************************************************/ |
| 396 | |
| 397 | ROM_START( faceoffh ) |
| 398 | ROM_REGION( 0x1000, "maincpu", 0 ) |
| 399 | // "Copyright (c) 1983 SoftLogic JAPAN" |
| 400 | ROM_LOAD( "1.5d", 0x0000, 0x1000, CRC(6ab050be) SHA1(ebecae855e22e9c3c46bdee51f84fd5352bf191a) ) |
| 401 | |
| 402 | ROM_REGION( 0x4000, "digitalker", ROMREGION_ERASE00 ) |
| 403 | // bank switched (from samples region) |
| 404 | |
| 405 | ROM_REGION( 0x10000, "samples", 0 ) |
| 406 | ROM_LOAD( "9.2a", 0x0000, 0x2000, CRC(059b3725) SHA1(5837bee1ef34ce19a3101b851ca55029776e4b3e) ) // digitalker header |
| 407 | ROM_LOAD( "8.2b", 0x2000, 0x2000, CRC(679da4e1) SHA1(01a5b9dd132c1b0de97c153d7de226f5bf357338) ) |
| 408 | |
| 409 | ROM_LOAD( "7.2c", 0x4000, 0x2000, CRC(f8461b33) SHA1(717a8842e0ce9ba94dd59504a324bede4844e389) ) // digitalker header |
| 410 | ROM_LOAD( "6.2d", 0x6000, 0x2000, CRC(156c91e0) SHA1(6017d4b5609b214a6e66dcd76493a7d1442c04d4) ) |
| 411 | |
| 412 | ROM_LOAD( "5.3a", 0x8000, 0x2000, CRC(19904604) SHA1(633c211a9a822cdf597a6f3c221ae9c8d6482e82) ) // digitalker header |
| 413 | ROM_LOAD( "4.3b", 0xa000, 0x2000, CRC(c3386d51) SHA1(7882e88db55ba914be81075e4b2d76e246c34d3b) ) |
| 414 | |
| 415 | ROM_FILL( 0xc000, 0x2000, 0xff ) // unpopulated |
| 416 | ROM_FILL( 0xe000, 0x2000, 0xff ) // unpopulated |
| 417 | ROM_END |
| 418 | |
| 419 | GAME( 1983, chexx83, 0, chexx83, chexx83, driver_device, 0, ROT270, "ICE", "Chexx (EM Bubble Hockey, 1983 1.1)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_NO_SOUND ) |
| 420 | GAME( 1983, faceoffh, chexx83, faceoffh, chexx83, driver_device, 0, ROT270, "SoftLogic (Entertainment Enterprises, Ltd. license)", "Face-Off (EM Bubble Hockey)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_IMPERFECT_SOUND ) |
trunk/src/mame/drivers/faceoffh.c
| r249025 | r249026 | |
| 1 | | // license:BSD-3-Clause |
| 2 | | // copyright-holders:Luca Elia |
| 3 | | /*************************************************************************** |
| 4 | | |
| 5 | | Sound board for an unknown game. Most probably a bubble hockey EM game |
| 6 | | titled "Face-Off", an illegal? copy of Chexx Hockey by ICE. See here: |
| 7 | | |
| 8 | | http://valker.us/gameroom/SegaFaceOff.htm |
| 9 | | https://casetext.com/case/innovative-concepts-in-ent-v-entertainment-enter |
| 10 | | http://www.pinrepair.com/arcade/chexx.htm |
| 11 | | |
| 12 | | "Copyright (c) 1983 SoftLogic JAPAN" in the program rom. |
| 13 | | |
| 14 | | The same PCB, with serial 025707, is allegedly for "Vampire" (prototype). |
| 15 | | |
| 16 | | PCB: |
| 17 | | |
| 18 | | Entertainment Enterprises Ltd. 1983 (sticker) |
| 19 | | Serial No. 025402 (sticker) |
| 20 | | MADE IN JAPAN (etched) |
| 21 | | |
| 22 | | CPU: R6502P |
| 23 | | RAM: M58725P (2KB) |
| 24 | | I/O: R6522P (VIA) |
| 25 | | Speech: Digitalker |
| 26 | | Sound: AY-3-8910 |
| 27 | | Misc: XTAL 4MHz, DSW4, 42-pin connector |
| 28 | | |
| 29 | | ***************************************************************************/ |
| 30 | | |
| 31 | | #include "emu.h" |
| 32 | | #include "cpu/m6502/m6502.h" |
| 33 | | #include "sound/ay8910.h" |
| 34 | | #include "sound/digitalk.h" |
| 35 | | #include "machine/6522via.h" |
| 36 | | |
| 37 | | #define MAIN_CLOCK XTAL_4MHz |
| 38 | | |
| 39 | | class faceoffh_state : public driver_device |
| 40 | | { |
| 41 | | public: |
| 42 | | faceoffh_state(const machine_config &mconfig, device_type type, const char *tag) |
| 43 | | : driver_device(mconfig, type, tag), |
| 44 | | m_audiocpu(*this, "audiocpu"), |
| 45 | | m_digitalker(*this, "digitalker"), |
| 46 | | m_aysnd(*this, "aysnd") |
| 47 | | { |
| 48 | | } |
| 49 | | |
| 50 | | // devices |
| 51 | | required_device<cpu_device> m_audiocpu; |
| 52 | | required_device<digitalker_device> m_digitalker; |
| 53 | | required_device<ay8910_device> m_aysnd; |
| 54 | | |
| 55 | | // vars |
| 56 | | UINT8 m_ay_cmd, m_ay_data; |
| 57 | | UINT8 m_port_a, m_port_b; |
| 58 | | UINT8 m_coin; |
| 59 | | UINT8 m_bank; |
| 60 | | UINT32 m_shift; |
| 61 | | |
| 62 | | // screen updates |
| 63 | | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 64 | | |
| 65 | | // handlers |
| 66 | | DECLARE_READ8_MEMBER(via_a_in); |
| 67 | | DECLARE_READ8_MEMBER(via_b_in); |
| 68 | | |
| 69 | | DECLARE_WRITE8_MEMBER(via_a_out); |
| 70 | | DECLARE_WRITE8_MEMBER(via_b_out); |
| 71 | | |
| 72 | | DECLARE_WRITE_LINE_MEMBER(via_ca2_out); |
| 73 | | DECLARE_WRITE_LINE_MEMBER(via_cb1_out); |
| 74 | | DECLARE_WRITE_LINE_MEMBER(via_cb2_out); |
| 75 | | DECLARE_WRITE_LINE_MEMBER(via_irq_out); |
| 76 | | |
| 77 | | DECLARE_WRITE8_MEMBER(faceoffh_ay_w); |
| 78 | | DECLARE_READ8_MEMBER(faceoffh_coin_r); |
| 79 | | DECLARE_WRITE8_MEMBER(faceoffh_coin_w); |
| 80 | | |
| 81 | | // digitalker |
| 82 | | void digitalker_set_bank(UINT8 bank); |
| 83 | | |
| 84 | | // driver_device overrides |
| 85 | | virtual void machine_start(); |
| 86 | | virtual void machine_reset(); |
| 87 | | |
| 88 | | virtual void video_start(); |
| 89 | | }; |
| 90 | | |
| 91 | | |
| 92 | | // VIA |
| 93 | | |
| 94 | | READ8_MEMBER(faceoffh_state::via_a_in) |
| 95 | | { |
| 96 | | UINT8 ret = 0; |
| 97 | | logerror("%s: VIA read A: %02X\n", machine().describe_context(), ret); |
| 98 | | return ret; |
| 99 | | } |
| 100 | | READ8_MEMBER(faceoffh_state::via_b_in) |
| 101 | | { |
| 102 | | UINT8 ret = 0; |
| 103 | | logerror("%s: VIA read B: %02X\n", machine().describe_context(), ret); |
| 104 | | return ret; |
| 105 | | } |
| 106 | | |
| 107 | | WRITE8_MEMBER(faceoffh_state::via_a_out) |
| 108 | | { |
| 109 | | m_port_a = data; // multiplexer |
| 110 | | // logerror("%s: VIA write A = %02X\n", machine().describe_context(), data); |
| 111 | | } |
| 112 | | WRITE8_MEMBER(faceoffh_state::via_b_out) |
| 113 | | { |
| 114 | | m_port_b = data; |
| 115 | | // logerror("%s: VIA write B = %02X\n", machine().describe_context(), data); |
| 116 | | } |
| 117 | | |
| 118 | | WRITE_LINE_MEMBER(faceoffh_state::via_ca2_out) |
| 119 | | { |
| 120 | | // logerror("%s: VIA write CA2 = %02X\n", machine().describe_context(), state); |
| 121 | | } |
| 122 | | WRITE_LINE_MEMBER(faceoffh_state::via_cb1_out) |
| 123 | | { |
| 124 | | // logerror("%s: VIA write CB1 = %02X\n", machine().describe_context(), state); |
| 125 | | } |
| 126 | | WRITE_LINE_MEMBER(faceoffh_state::via_cb2_out) |
| 127 | | { |
| 128 | | m_shift = ((m_shift << 1) & 0xffffff) | state; |
| 129 | | // logerror("%s: VIA write CB2 = %02X\n", machine().describe_context(), state); |
| 130 | | } |
| 131 | | WRITE_LINE_MEMBER(faceoffh_state::via_irq_out) |
| 132 | | { |
| 133 | | m_audiocpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); |
| 134 | | // logerror("%s: VIA write IRQ = %02X\n", machine().describe_context(), state); |
| 135 | | } |
| 136 | | |
| 137 | | // Video |
| 138 | | |
| 139 | | void faceoffh_state::video_start() |
| 140 | | { |
| 141 | | } |
| 142 | | |
| 143 | | UINT32 faceoffh_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 144 | | { |
| 145 | | // NMI on coin-in? |
| 146 | | UINT8 coin = (~ioport("INPUTS")->read()) & 0x03; |
| 147 | | m_audiocpu->set_input_line(INPUT_LINE_NMI, coin ? ASSERT_LINE : CLEAR_LINE); |
| 148 | | |
| 149 | | // Play the digitalker samples (it's not hooked up yet) |
| 150 | | static UINT8 sample = 0, bank = 0; |
| 151 | | |
| 152 | | if (screen.machine().input().code_pressed_once(KEYCODE_Q)) |
| 153 | | --bank; |
| 154 | | if (screen.machine().input().code_pressed_once(KEYCODE_W)) |
| 155 | | ++bank; |
| 156 | | bank %= 3; |
| 157 | | digitalker_set_bank(bank); |
| 158 | | |
| 159 | | if (screen.machine().input().code_pressed_once(KEYCODE_A)) |
| 160 | | --sample; |
| 161 | | if (screen.machine().input().code_pressed_once(KEYCODE_S)) |
| 162 | | ++sample; |
| 163 | | |
| 164 | | if (screen.machine().input().code_pressed_once(KEYCODE_Z)) |
| 165 | | { |
| 166 | | m_digitalker->digitalker_0_cms_w(CLEAR_LINE); |
| 167 | | m_digitalker->digitalker_0_cs_w(CLEAR_LINE); |
| 168 | | |
| 169 | | address_space &space = m_audiocpu->space(AS_PROGRAM); |
| 170 | | m_digitalker->digitalker_data_w(space, 0, sample, 0xff); |
| 171 | | |
| 172 | | m_digitalker->digitalker_0_wr_w(ASSERT_LINE); |
| 173 | | m_digitalker->digitalker_0_wr_w(CLEAR_LINE); |
| 174 | | m_digitalker->digitalker_0_wr_w(ASSERT_LINE); |
| 175 | | } |
| 176 | | |
| 177 | | popmessage("COIN: %02X VIAB: %02X\nCOUNT: %02X %02X LEDS: %02X\nSAMPLE: %02X (B%X)", |
| 178 | | m_coin, m_port_b, |
| 179 | | (m_shift >> 16) & 0xff, (m_shift >> 8) & 0xff, (m_shift >> 0) & 0xff, // 2 x 7-seg, 3 leds |
| 180 | | sample, bank |
| 181 | | ); |
| 182 | | return 0; |
| 183 | | } |
| 184 | | |
| 185 | | // Sound |
| 186 | | |
| 187 | | #if 0 |
| 188 | | READ8_MEMBER(scramble_state::faceoffh_digitalker_intr_r) |
| 189 | | { |
| 190 | | return m_digitalker->digitalker_0_intr_r(); |
| 191 | | } |
| 192 | | |
| 193 | | WRITE8_MEMBER(scramble_state::faceoffh_digitalker_control_w) |
| 194 | | { |
| 195 | | m_digitalker->digitalker_0_cs_w (data & 1 ? ASSERT_LINE : CLEAR_LINE); |
| 196 | | m_digitalker->digitalker_0_cms_w(data & 2 ? ASSERT_LINE : CLEAR_LINE); |
| 197 | | m_digitalker->digitalker_0_wr_w (data & 4 ? ASSERT_LINE : CLEAR_LINE); |
| 198 | | } |
| 199 | | #endif |
| 200 | | |
| 201 | | WRITE8_MEMBER(faceoffh_state::faceoffh_ay_w) |
| 202 | | { |
| 203 | | if (offset) |
| 204 | | { |
| 205 | | m_ay_data = data; |
| 206 | | return; |
| 207 | | } |
| 208 | | |
| 209 | | if (m_ay_cmd == 0x00 && data == 0x03) |
| 210 | | { |
| 211 | | m_aysnd->address_w(space, offset, m_ay_data, mem_mask); |
| 212 | | // logerror("%s: AY addr = %02X\n", machine().describe_context(), m_ay_data); |
| 213 | | } |
| 214 | | else if (m_ay_cmd == 0x00 && data == 0x02) |
| 215 | | { |
| 216 | | m_aysnd->data_w(space, offset, m_ay_data, mem_mask); |
| 217 | | // logerror("%s: AY data = %02X\n", machine().describe_context(), m_ay_data); |
| 218 | | } |
| 219 | | m_ay_cmd = data; |
| 220 | | } |
| 221 | | |
| 222 | | // Memory Map |
| 223 | | |
| 224 | | READ8_MEMBER(faceoffh_state::faceoffh_coin_r) |
| 225 | | { |
| 226 | | UINT8 ret = ioport("DSW")->read(); // bits 0-3 |
| 227 | | UINT8 inp = ioport("INPUTS")->read(); // bit 7 (multiplexed) |
| 228 | | |
| 229 | | for (int i = 0; i < 8; ++i) |
| 230 | | if ( ((~m_port_a) & (1 << i)) && ((~inp) & (1 << i)) ) |
| 231 | | ret &= 0x7f; |
| 232 | | |
| 233 | | return ret; |
| 234 | | } |
| 235 | | |
| 236 | | WRITE8_MEMBER(faceoffh_state::faceoffh_coin_w) |
| 237 | | { |
| 238 | | m_coin = data; |
| 239 | | // coin_counter_w(machine(), 0, data & 0x01); |
| 240 | | // coin_counter_w(machine(), 1, data & 0x02); |
| 241 | | coin_lockout_w(machine(), 0, data & 0x01); |
| 242 | | coin_lockout_w(machine(), 1, data & 0x02); |
| 243 | | } |
| 244 | | |
| 245 | | //M58725P - 2KB |
| 246 | | static ADDRESS_MAP_START( faceoffh_map, AS_PROGRAM, 8, faceoffh_state ) |
| 247 | | AM_RANGE(0x0000, 0x00ff) AM_RAM |
| 248 | | AM_RANGE(0x0100, 0x01ff) AM_RAM |
| 249 | | |
| 250 | | AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("via6522", via6522_device, read, write) |
| 251 | | |
| 252 | | AM_RANGE(0x8000, 0x8000) AM_READ(faceoffh_coin_r) |
| 253 | | |
| 254 | | AM_RANGE(0xa000, 0xa001) AM_WRITE(faceoffh_ay_w) |
| 255 | | |
| 256 | | AM_RANGE(0xc000, 0xc000) AM_WRITE(faceoffh_coin_w) |
| 257 | | |
| 258 | | AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("audiocpu", 0) |
| 259 | | ADDRESS_MAP_END |
| 260 | | |
| 261 | | // Inputs |
| 262 | | |
| 263 | | static INPUT_PORTS_START( faceoffh ) |
| 264 | | PORT_START("INPUTS") |
| 265 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) // coin 1 (start music) |
| 266 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) // coin 2 (start music) |
| 267 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) // ? |
| 268 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) // (stop music) |
| 269 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) // (stop music) |
| 270 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) // ? |
| 271 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 272 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) |
| 273 | | |
| 274 | | PORT_START("DSW") |
| 275 | | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") |
| 276 | | PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) ) |
| 277 | | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
| 278 | | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| 279 | | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 280 | | PORT_DIPNAME( 0x0c, 0x00, "Game Duration (mins)" ) PORT_DIPLOCATION("SW1:3,4") |
| 281 | | PORT_DIPSETTING( 0x00, "2" ) // 40 |
| 282 | | PORT_DIPSETTING( 0x04, "3" ) // 60 |
| 283 | | PORT_DIPSETTING( 0x08, "4" ) // 80 |
| 284 | | PORT_DIPSETTING( 0x0c, "5" ) // 100 |
| 285 | | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 286 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) // multiplexed inputs |
| 287 | | INPUT_PORTS_END |
| 288 | | |
| 289 | | // Machine |
| 290 | | |
| 291 | | void faceoffh_state::machine_start() |
| 292 | | { |
| 293 | | } |
| 294 | | |
| 295 | | void faceoffh_state::digitalker_set_bank(UINT8 bank) |
| 296 | | { |
| 297 | | if (m_bank != bank) |
| 298 | | { |
| 299 | | UINT8 *src = memregion("samples")->base(); |
| 300 | | UINT8 *dst = memregion("digitalker")->base(); |
| 301 | | |
| 302 | | memcpy(dst, src + bank * 0x4000, 0x4000); |
| 303 | | |
| 304 | | m_bank = bank; |
| 305 | | } |
| 306 | | } |
| 307 | | |
| 308 | | void faceoffh_state::machine_reset() |
| 309 | | { |
| 310 | | m_bank = -1; |
| 311 | | digitalker_set_bank(0); |
| 312 | | } |
| 313 | | |
| 314 | | static MACHINE_CONFIG_START( faceoffh, faceoffh_state ) |
| 315 | | |
| 316 | | // basic machine hardware |
| 317 | | MCFG_CPU_ADD("audiocpu", M6502, MAIN_CLOCK/2) |
| 318 | | MCFG_CPU_PROGRAM_MAP(faceoffh_map) |
| 319 | | // MCFG_CPU_VBLANK_INT_DRIVER("screen", faceoffh_state, irq0_line_hold) |
| 320 | | // MCFG_CPU_VBLANK_INT_DRIVER("screen", faceoffh_state, nmi_line_pulse) |
| 321 | | |
| 322 | | // via |
| 323 | | MCFG_DEVICE_ADD("via6522", VIA6522, MAIN_CLOCK/4) |
| 324 | | |
| 325 | | MCFG_VIA6522_READPA_HANDLER(READ8(faceoffh_state,via_a_in)) |
| 326 | | MCFG_VIA6522_READPB_HANDLER(READ8(faceoffh_state,via_b_in)) |
| 327 | | |
| 328 | | MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(faceoffh_state, via_a_out)) |
| 329 | | MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(faceoffh_state, via_b_out)) |
| 330 | | |
| 331 | | MCFG_VIA6522_CA2_HANDLER(WRITELINE(faceoffh_state, via_ca2_out)) |
| 332 | | MCFG_VIA6522_CB1_HANDLER(WRITELINE(faceoffh_state, via_cb1_out)) |
| 333 | | MCFG_VIA6522_CB2_HANDLER(WRITELINE(faceoffh_state, via_cb2_out)) |
| 334 | | MCFG_VIA6522_IRQ_HANDLER(WRITELINE(faceoffh_state, via_irq_out)/*DEVWRITELINE("audiocpu", m6502_device, write_irq4)*/) |
| 335 | | |
| 336 | | // video hardware |
| 337 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 338 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 339 | | MCFG_SCREEN_UPDATE_DRIVER(faceoffh_state, screen_update) |
| 340 | | MCFG_SCREEN_SIZE(256, 256) |
| 341 | | MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) |
| 342 | | MCFG_SCREEN_PALETTE("palette") |
| 343 | | |
| 344 | | MCFG_PALETTE_ADD("palette", 16) |
| 345 | | |
| 346 | | // sound hardware |
| 347 | | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 348 | | MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/2) |
| 349 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 350 | | |
| 351 | | MCFG_DIGITALKER_ADD("digitalker", MAIN_CLOCK) |
| 352 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.16) |
| 353 | | MACHINE_CONFIG_END |
| 354 | | |
| 355 | | // ROMs |
| 356 | | |
| 357 | | ROM_START( faceoffh ) |
| 358 | | ROM_REGION( 0x1000, "audiocpu", 0 ) |
| 359 | | ROM_LOAD( "1.5d", 0x0000, 0x1000, CRC(6ab050be) SHA1(ebecae855e22e9c3c46bdee51f84fd5352bf191a) ) |
| 360 | | |
| 361 | | ROM_REGION( 0x4000, "digitalker", ROMREGION_ERASE00 ) |
| 362 | | // bank switched (from samples region) |
| 363 | | |
| 364 | | ROM_REGION( 0xc000, "samples", 0 ) |
| 365 | | ROM_LOAD( "9.2a", 0x0000, 0x2000, CRC(059b3725) SHA1(5837bee1ef34ce19a3101b851ca55029776e4b3e) ) // digitalker header |
| 366 | | ROM_LOAD( "8.2b", 0x2000, 0x2000, CRC(679da4e1) SHA1(01a5b9dd132c1b0de97c153d7de226f5bf357338) ) |
| 367 | | |
| 368 | | ROM_LOAD( "7.2c", 0x4000, 0x2000, CRC(f8461b33) SHA1(717a8842e0ce9ba94dd59504a324bede4844e389) ) // digitalker header |
| 369 | | ROM_LOAD( "6.2d", 0x6000, 0x2000, CRC(156c91e0) SHA1(6017d4b5609b214a6e66dcd76493a7d1442c04d4) ) |
| 370 | | |
| 371 | | ROM_LOAD( "5.3a", 0x8000, 0x2000, CRC(19904604) SHA1(633c211a9a822cdf597a6f3c221ae9c8d6482e82) ) // digitalker header |
| 372 | | ROM_LOAD( "4.3b", 0xa000, 0x2000, CRC(c3386d51) SHA1(7882e88db55ba914be81075e4b2d76e246c34d3b) ) |
| 373 | | ROM_END |
| 374 | | |
| 375 | | GAME( 1983, faceoffh, 0, faceoffh, faceoffh, driver_device, 0, ROT270, "SoftLogic (Entertainment Enterprises, Ltd. license)", "Face-Off (EM Bubble Hockey)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_IMPERFECT_SOUND ) |
trunk/src/mame/drivers/seattle.c
| r249025 | r249026 | |
| 2756 | 2756 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version L1.2 (10/8/96) */ |
| 2757 | 2757 | ROM_LOAD( "wg3dh_12.u32", 0x000000, 0x80000, CRC(15e4cea2) SHA1(72c0db7dc53ce645ba27a5311b5ce803ad39f131) ) |
| 2758 | 2758 | |
| 2759 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2759 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2760 | 2760 | |
| 2761 | 2761 | DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.3 (Guts 10/15/96, Main 10/15/96) */ |
| 2762 | 2762 | DISK_IMAGE( "wg3dh", 0, SHA1(4fc6f25d7f043d9bcf8743aa8df1d9be3cbc375b) ) |
| r249025 | r249026 | |
| 2770 | 2770 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.0ce 7/2/97 */ |
| 2771 | 2771 | ROM_LOAD( "mace10ce.u32", 0x000000, 0x80000, CRC(7a50b37e) SHA1(33788835f84a9443566c80bee9f20a1691490c6d) ) |
| 2772 | 2772 | |
| 2773 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2773 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2774 | 2774 | |
| 2775 | 2775 | DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.0B 6/10/97 (Guts 7/2/97, Main 7/2/97) */ |
| 2776 | 2776 | DISK_IMAGE( "mace", 0, SHA1(96ec8d3ff5dd894e21aa81403bcdbeba44bb97ea) ) |
| r249025 | r249026 | |
| 2784 | 2784 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version ??? 5/7/97 */ |
| 2785 | 2785 | ROM_LOAD( "maceboot.u32", 0x000000, 0x80000, CRC(effe3ebc) SHA1(7af3ca3580d6276ffa7ab8b4c57274e15ee6bcbb) ) |
| 2786 | 2786 | |
| 2787 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2787 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2788 | 2788 | |
| 2789 | 2789 | DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.0a (Guts 6/9/97, Main 5/12/97) */ |
| 2790 | 2790 | DISK_IMAGE( "macea", 0, BAD_DUMP SHA1(9bd4a60627915d71932cab24f89c48ea21f4c1cb) ) |
| r249025 | r249026 | |
| 2798 | 2798 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version L1.0 */ |
| 2799 | 2799 | ROM_LOAD( "hdboot.u32", 0x000000, 0x80000, CRC(39a35f1b) SHA1(c46d83448399205d38e6e41dd56abbc362254254) ) |
| 2800 | 2800 | |
| 2801 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2801 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2802 | 2802 | |
| 2803 | 2803 | ROM_REGION32_LE( 0x200000, "cageboot", 0 ) /* TMS320C31 boot ROM Version L1.0 */ |
| 2804 | 2804 | ROM_LOAD32_BYTE( "sndboot.u69", 0x000000, 0x080000, CRC(7e52cdc7) SHA1(f735063e19d2ca672cef6d761a2a47df272e8c59) ) |
| r249025 | r249026 | |
| 2818 | 2818 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code */ |
| 2819 | 2819 | ROM_LOAD( "boot.bin", 0x000000, 0x080000, CRC(0555b3cf) SHA1(a48abd6d06a26f4f9b6c52d8c0af6095b6be57fd) ) |
| 2820 | 2820 | |
| 2821 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2821 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2822 | 2822 | |
| 2823 | 2823 | ROM_REGION32_LE( 0x200000, "cageboot", 0 ) /* TMS320C31 boot ROM */ |
| 2824 | 2824 | ROM_LOAD32_BYTE( "audboot.bin", 0x000000, 0x080000, CRC(c70c060d) SHA1(dd014bd13efdf5adc5450836bd4650351abefc46) ) |
| r249025 | r249026 | |
| 2838 | 2838 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ |
| 2839 | 2839 | ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) |
| 2840 | 2840 | |
| 2841 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2841 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2842 | 2842 | |
| 2843 | 2843 | DISK_REGION( "ide:0:hdd:image" ) /* Release version 2.1a (4/17/98) (Guts 1.25 4/17/98, Main 4/17/98) */ |
| 2844 | 2844 | DISK_IMAGE( "calspeed", 0, SHA1(08d411c591d4b8bbdd6437ea80d01c4cec8516f8) ) |
| r249025 | r249026 | |
| 2851 | 2851 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ |
| 2852 | 2852 | ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) |
| 2853 | 2853 | |
| 2854 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2854 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2855 | 2855 | |
| 2856 | 2856 | DISK_REGION( "ide:0:hdd:image" ) /* Release version 1.0r8a (4/10/98) (Guts 4/10/98, Main 4/10/98) */ |
| 2857 | 2857 | DISK_IMAGE( "cs_10r8a", 0, SHA1(ba4e7589740e0647938c81c5082bb71d8826bad4) ) |
| r249025 | r249026 | |
| 2864 | 2864 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ |
| 2865 | 2865 | ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) |
| 2866 | 2866 | |
| 2867 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2867 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2868 | 2868 | |
| 2869 | 2869 | DISK_REGION( "ide:0:hdd:image" ) /* Release version 1.0r7a (3/4/98) (Guts 3/3/98, Main 1/19/98) */ |
| 2870 | 2870 | DISK_IMAGE( "calspeda", 0, SHA1(6b1c3a7530195ef7309b06a651b01c8b3ece92c6) ) |
| r249025 | r249026 | |
| 2881 | 2881 | ROM_REGION32_LE( 0x80000, "user1", 0 ) |
| 2882 | 2882 | ROM_LOAD( "vtrxboot.bin", 0x000000, 0x80000, CRC(ee487a6c) SHA1(fb9efda85047cf615f24f7276a9af9fd542f3354) ) |
| 2883 | 2883 | |
| 2884 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2884 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2885 | 2885 | |
| 2886 | 2886 | DISK_REGION( "ide:0:hdd:image" ) |
| 2887 | 2887 | DISK_IMAGE( "vaportrx", 0, SHA1(fe53ca7643d2ed2745086abb7f2243c69678cab1) ) |
| r249025 | r249026 | |
| 2895 | 2895 | ROM_REGION32_LE( 0x80000, "user1", 0 ) |
| 2896 | 2896 | ROM_LOAD( "vtrxboot.bin", 0x000000, 0x80000, CRC(ee487a6c) SHA1(fb9efda85047cf615f24f7276a9af9fd542f3354) ) |
| 2897 | 2897 | |
| 2898 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2898 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2899 | 2899 | |
| 2900 | 2900 | DISK_REGION( "ide:0:hdd:image" ) /* Guts: Apr 10 1998 11:03:14 Main: Apr 10 1998 11:27:44 */ |
| 2901 | 2901 | DISK_IMAGE( "vaportrp", 0, SHA1(6c86637c442ebd6994eee8c0ae0dce343c35dbe9) ) |
| r249025 | r249026 | |
| 2909 | 2909 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2910 | 2910 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2911 | 2911 | |
| 2912 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2912 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2913 | 2913 | |
| 2914 | 2914 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Seattle System Boot ROM Version 0.1i Apr 14 1997 14:52:53 */ |
| 2915 | 2915 | ROM_LOAD( "biofreak.u32", 0x000000, 0x80000, CRC(cefa00bb) SHA1(7e171610ede1e8a448fb8d175f9cb9e7d549de28) ) |
| r249025 | r249026 | |
| 2923 | 2923 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2924 | 2924 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2925 | 2925 | |
| 2926 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2926 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2927 | 2927 | |
| 2928 | 2928 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 */ |
| 2929 | 2929 | ROM_LOAD( "blitz1_2.u32", 0x000000, 0x80000, CRC(38dbecf5) SHA1(7dd5a5b3baf83a7f8f877ff4cd3f5e8b5201b36f) ) |
| r249025 | r249026 | |
| 2937 | 2937 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2938 | 2938 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2939 | 2939 | |
| 2940 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2940 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2941 | 2941 | |
| 2942 | 2942 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.1 */ |
| 2943 | 2943 | ROM_LOAD( "blitz1_1.u32", 0x000000, 0x80000, CRC(8163ce02) SHA1(89b432d8879052f6c5534ee49599f667f50a010f) ) |
| r249025 | r249026 | |
| 2951 | 2951 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2952 | 2952 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2953 | 2953 | |
| 2954 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2954 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2955 | 2955 | |
| 2956 | 2956 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.0 */ |
| 2957 | 2957 | ROM_LOAD( "bltz9910.u32", 0x000000, 0x80000, CRC(777119b2) SHA1(40d255181c2f3a787919c339e83593fd506779a5) ) |
| r249025 | r249026 | |
| 2970 | 2970 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) // to use this rom run with -bios up130 and go into TEST mode to update. |
| 2971 | 2971 | ROM_SYSTEM_BIOS( 0, "noupdate", "No Update Rom" ) |
| 2972 | 2972 | ROM_SYSTEM_BIOS( 1, "up130", "Update to 1.30" ) |
| 2973 | | ROMX_LOAD( "rev.-1.3.u33", 0x000000, 0x100000, CRC(0a0fde5a) SHA1(1edb671c66819f634a9f1daa35331a99b2bda01a), ROM_BIOS(2) ) |
| 2973 | ROMX_LOAD( "rev.-1.3.u33", 0x000000, 0x100000, CRC(0a0fde5a) SHA1(1edb671c66819f634a9f1daa35331a99b2bda01a), ROM_BIOS(2) ) |
| 2974 | 2974 | |
| 2975 | 2975 | DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.30 */ |
| 2976 | 2976 | DISK_IMAGE( "blitz99a", 0, SHA1(43f834727ce01d7a63b482fc28cbf292477fc6f2) ) |
| r249025 | r249026 | |
| 2981 | 2981 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2982 | 2982 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2983 | 2983 | |
| 2984 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2984 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2985 | 2985 | |
| 2986 | 2986 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.4 */ |
| 2987 | 2987 | ROM_LOAD( "bltz2k14.u32", 0x000000, 0x80000, CRC(ac4f0051) SHA1(b8125c17370db7bfd9b783230b4ef3d5b22a2025) ) |
| r249025 | r249026 | |
| 2995 | 2995 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 2996 | 2996 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 2997 | 2997 | |
| 2998 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2998 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 2999 | 2999 | |
| 3000 | 3000 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 1.9 */ |
| 3001 | 3001 | ROM_LOAD( "carnevil1_9.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) ) |
| r249025 | r249026 | |
| 3009 | 3009 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 3010 | 3010 | ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 3011 | 3011 | |
| 3012 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 3012 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 3013 | 3013 | |
| 3014 | 3014 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 1.9 */ |
| 3015 | 3015 | ROM_LOAD( "carnevil1_9.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) ) |
| r249025 | r249026 | |
| 3023 | 3023 | ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ |
| 3024 | 3024 | ROM_LOAD16_BYTE( "seattle.snd", 0x000000, 0x8000, BAD_DUMP CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) |
| 3025 | 3025 | |
| 3026 | | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 3026 | ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) |
| 3027 | 3027 | |
| 3028 | 3028 | ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 9. */ |
| 3029 | 3029 | ROM_LOAD( "hyprdrve.u32", 0x000000, 0x80000, CRC(3e18cb80) SHA1(b18cc4253090ee1d65d72a7ec0c426ed08c4f238) ) |
trunk/src/mame/video/chihiro.c
| r249025 | r249026 | |
| 3 | 3 | #include "emu.h" |
| 4 | 4 | #include "video/poly.h" |
| 5 | 5 | #include "bitmap.h" |
| 6 | #include "machine/pic8259.h" |
| 6 | 7 | #include "includes/chihiro.h" |
| 7 | 8 | |
| 8 | 9 | //#define LOG_NV2A |
| r249025 | r249026 | |
| 945 | 946 | UINT32 nv2a_renderer::geforce_object_offset(UINT32 handle) |
| 946 | 947 | { |
| 947 | 948 | UINT32 h = ((((handle >> 11) ^ handle) >> 11) ^ handle) & 0x7ff; |
| 948 | | UINT32 o = (pfifo[0x210 / 4] & 0x1f) << 8; // or 12 ? |
| 949 | UINT32 o = (pfifo[0x210 / 4] & 0x1ff) << 8; // 0x1ff is not certain |
| 949 | 950 | UINT32 e = o + h * 8; // at 0xfd000000+0x00700000 |
| 950 | 951 | UINT32 w; |
| 951 | 952 | |
| 952 | | if (ramin[e / 4] != handle) |
| 953 | | e = 0; |
| 953 | if (ramin[e / 4] != handle) { |
| 954 | // this should never happen |
| 955 | for (UINT32 aa = o / 4; aa < (sizeof(ramin) / 4); aa = aa + 2) { |
| 956 | if (ramin[aa] == handle) { |
| 957 | e = aa * 4; |
| 958 | } |
| 959 | } |
| 960 | } |
| 954 | 961 | w = ramin[e / 4 + 1]; |
| 955 | | return (w & 0xffff) * 0x10; |
| 962 | return (w & 0xffff) * 0x10; // 0xffff is not certain |
| 956 | 963 | } |
| 957 | 964 | |
| 958 | 965 | void nv2a_renderer::geforce_read_dma_object(UINT32 handle, UINT32 &offset, UINT32 &size) |
| r249025 | r249026 | |
| 1246 | 1253 | addr = rendertarget + (dilated0[dilate_rendertarget][x] + dilated1[dilate_rendertarget][y]); |
| 1247 | 1254 | else // type_rendertarget == LINEAR*/ |
| 1248 | 1255 | addr = rendertarget + (pitch_rendertarget / 4)*y + x; |
| 1249 | | fbcolor = *addr; |
| 1256 | fbcolor = 0; |
| 1257 | if (color_mask != 0) |
| 1258 | fbcolor = *addr; |
| 1250 | 1259 | daddr=depthbuffer + (pitch_depthbuffer / 4)*y + x; |
| 1251 | 1260 | deptsten = *daddr; |
| 1252 | 1261 | c[3] = color >> 24; |
| r249025 | r249026 | |
| 1772 | 1781 | break; |
| 1773 | 1782 | } |
| 1774 | 1783 | } |
| 1775 | | fbcolor = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0]; |
| 1776 | | *addr = fbcolor; |
| 1784 | if (color_mask != 0) { |
| 1785 | UINT32 fbcolor_tmp; |
| 1786 | |
| 1787 | fbcolor_tmp = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0]; |
| 1788 | *addr = (fbcolor & ~color_mask) | (fbcolor_tmp & color_mask); |
| 1789 | } |
| 1777 | 1790 | if (depth_write_enabled) |
| 1778 | 1791 | dep = depth; |
| 1779 | 1792 | deptsten = (dep << 8) | sten; |
| r249025 | r249026 | |
| 2233 | 2246 | maddress = method * 4; |
| 2234 | 2247 | data = space.read_dword(address); |
| 2235 | 2248 | channel[chanel][subchannel].object.method[method] = data; |
| 2249 | #ifdef LOG_NV2A |
| 2250 | printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data); |
| 2251 | #endif |
| 2236 | 2252 | if (maddress == 0x17fc) { |
| 2237 | 2253 | indexesleft_count = 0; |
| 2238 | 2254 | indexesleft_first = 0; |
| r249025 | r249026 | |
| 2270 | 2286 | } |
| 2271 | 2287 | wait(); |
| 2272 | 2288 | } |
| 2289 | else if (type == nv2a_renderer::TRIANGLE_FAN) { |
| 2290 | vertex_nv vert[3]; |
| 2291 | vertex_t xy[3]; |
| 2292 | |
| 2293 | read_vertices_0x1810(space, vert, offset, 2); |
| 2294 | convert_vertices_poly(vert, xy, 2); |
| 2295 | count = count - 2; |
| 2296 | offset = offset + 2; |
| 2297 | for (n = 0; n <= count; n++) { |
| 2298 | read_vertices_0x1810(space, vert + (((n + 1) & 1) + 1), offset + n, 1); |
| 2299 | convert_vertices_poly(vert + (((n + 1) & 1) + 1), xy + (((n + 1) & 1) + 1), 1); |
| 2300 | render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[(~(n + 1) & 1) + 1], xy[((n + 1) & 1) + 1]); |
| 2301 | } |
| 2302 | wait(); |
| 2303 | } |
| 2273 | 2304 | else if (type == nv2a_renderer::TRIANGLE_STRIP) { |
| 2274 | 2305 | vertex_nv vert[4]; |
| 2275 | 2306 | vertex_t xy[4]; |
| r249025 | r249026 | |
| 2311 | 2342 | // each dword after 1800 contains two 16 bit index values to select the vartices |
| 2312 | 2343 | // each dword after 1808 contains a 32 bit index value to select the vartices |
| 2313 | 2344 | type = channel[chanel][subchannel].object.method[0x17fc / 4]; |
| 2314 | | #ifdef LOG_NV2A |
| 2315 | | printf("vertex %d %d %d\n\r", type, offset, count); |
| 2316 | | #endif |
| 2317 | 2345 | if (type == nv2a_renderer::QUADS) { |
| 2318 | 2346 | while (1) { |
| 2319 | 2347 | vertex_nv vert[4]; |
| r249025 | r249026 | |
| 2332 | 2360 | render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, xy); // 4 rgba, 4 texture units 2 uv |
| 2333 | 2361 | } |
| 2334 | 2362 | } |
| 2363 | else if (type == nv2a_renderer::TRIANGLE_FAN) { |
| 2364 | if ((countlen * mult + indexesleft_count) >= 3) { |
| 2365 | vertex_nv vert[3]; |
| 2366 | vertex_t xy[3]; |
| 2367 | int c, count; |
| 2368 | |
| 2369 | if (mult == 1) |
| 2370 | c = read_vertices_0x1808(space, vert, address, 2); |
| 2371 | else |
| 2372 | c = read_vertices_0x1800(space, vert, address, 2); |
| 2373 | convert_vertices_poly(vert, xy, 2); |
| 2374 | address = address + c * 4; |
| 2375 | countlen = countlen - c; |
| 2376 | count = countlen * mult + indexesleft_count; |
| 2377 | for (n = 1; n <= count; n++) { |
| 2378 | if (mult == 1) |
| 2379 | c = read_vertices_0x1808(space, vert + ((n & 1) + 1), address, 1); |
| 2380 | else |
| 2381 | c = read_vertices_0x1800(space, vert + ((n & 1) + 1), address, 1); |
| 2382 | |
| 2383 | convert_vertices_poly(vert + ((n & 1) + 1), xy + ((n & 1) + 1), 1); |
| 2384 | address = address + c * 4; |
| 2385 | countlen = countlen - c; |
| 2386 | render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[(~n & 1) + 1], xy[(n & 1) + 1]); |
| 2387 | } |
| 2388 | wait(); |
| 2389 | } |
| 2390 | } |
| 2335 | 2391 | else if (type == nv2a_renderer::TRIANGLES) { |
| 2336 | 2392 | while (1) { |
| 2337 | 2393 | vertex_nv vert[3]; |
| r249025 | r249026 | |
| 2446 | 2502 | } |
| 2447 | 2503 | wait(); |
| 2448 | 2504 | } |
| 2505 | else if (type == nv2a_renderer::TRIANGLES) { |
| 2506 | while (countlen > 0) { |
| 2507 | vertex_nv vert[3]; |
| 2508 | vertex_t xy[3]; |
| 2509 | int c; |
| 2510 | |
| 2511 | c = read_vertices_0x1818(space, vert, address, 3); |
| 2512 | convert_vertices_poly(vert, xy, 3); |
| 2513 | countlen = countlen - c; |
| 2514 | if (countlen < 0) { |
| 2515 | logerror("Method 0x1818 missing %d words to draw a complete primitive\n", -countlen); |
| 2516 | countlen = 0; |
| 2517 | break; |
| 2518 | } |
| 2519 | address = address + c * 3; |
| 2520 | render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[1], xy[2]); // 4 rgba, 4 texture units 2 uv |
| 2521 | } |
| 2522 | } |
| 2449 | 2523 | else if (type == nv2a_renderer::TRIANGLE_STRIP) { |
| 2450 | 2524 | vertex_nv vert[4]; |
| 2451 | 2525 | vertex_t xy[4]; |
| r249025 | r249026 | |
| 2613 | 2687 | // clear colors |
| 2614 | 2688 | UINT32 color = channel[chanel][subchannel].object.method[0x1d90 / 4]; |
| 2615 | 2689 | bm.fill(color); |
| 2616 | | //printf("clearscreen\n\r"); |
| 2690 | #ifdef LOG_NV2A |
| 2691 | printf("clearscreen\n\r"); |
| 2692 | #endif |
| 2617 | 2693 | } |
| 2618 | 2694 | if ((data & 0x03) == 3) { |
| 2619 | 2695 | bitmap_rgb32 bm(depthbuffer, (limits_rendertarget.right() + 1) * m, (limits_rendertarget.bottom() + 1) * m, pitch_rendertarget / 4); // why *2 ? |
| r249025 | r249026 | |
| 2649 | 2725 | dilate_rendertarget = dilatechose[(log2width_rendertarget << 4) + log2height_rendertarget]; |
| 2650 | 2726 | } |
| 2651 | 2727 | if (maddress == 0x020c) { |
| 2652 | | // line size ? |
| 2653 | 2728 | pitch_rendertarget=data & 0xffff; |
| 2654 | 2729 | pitch_depthbuffer=(data >> 16) & 0xffff; |
| 2655 | | //printf("Pitch color %04X zbuffer %04X\n\r",pitch_rendertarget,pitch_depthbuffer); |
| 2730 | #ifdef LOG_NV2A |
| 2731 | printf("Pitch color %04X zbuffer %04X\n\r",pitch_rendertarget,pitch_depthbuffer); |
| 2732 | #endif |
| 2656 | 2733 | countlen--; |
| 2657 | 2734 | } |
| 2658 | 2735 | if (maddress == 0x0100) { |
| 2659 | | // just temporarily |
| 2660 | | if ((data & 0x1f) == 1) { |
| 2661 | | data = data >> 5; |
| 2662 | | data = data & 0x0ffffff0; |
| 2663 | | displayedtarget = (UINT32 *)direct_access_ptr(data); |
| 2736 | countlen--; |
| 2737 | if (data != 0) { |
| 2738 | pgraph[0x704 / 4] = 0x100; |
| 2739 | pgraph[0x708 / 4] = data; |
| 2740 | pgraph[0x100 / 4] |= 1; |
| 2741 | pgraph[0x108 / 4] |= 1; |
| 2742 | if (update_interrupts() == true) |
| 2743 | interruptdevice->ir3_w(1); // IRQ 3 |
| 2744 | else |
| 2745 | interruptdevice->ir3_w(0); // IRQ 3 |
| 2746 | return 2; |
| 2664 | 2747 | } |
| 2748 | else |
| 2749 | return 0; |
| 2665 | 2750 | } |
| 2666 | 2751 | if (maddress == 0x0130) { |
| 2667 | 2752 | countlen--; |
| r249025 | r249026 | |
| 2670 | 2755 | else |
| 2671 | 2756 | return 0; |
| 2672 | 2757 | } |
| 2758 | if (maddress == 0x1d8c) { |
| 2759 | countlen--; |
| 2760 | // it is used to specify the clear value for the depth buffer (zbuffer) |
| 2761 | // but also as a parameter for interrupt routines |
| 2762 | pgraph[0x1a88 / 4] = data; |
| 2763 | } |
| 2764 | if (maddress == 0x1d90) { |
| 2765 | countlen--; |
| 2766 | // it is used to specify the clear value for the color buffer |
| 2767 | // but also as a parameter for interrupt routines |
| 2768 | pgraph[0x186c / 4] = data; |
| 2769 | } |
| 2673 | 2770 | if (maddress == 0x0210) { |
| 2674 | 2771 | // framebuffer offset ? |
| 2675 | 2772 | rendertarget = (UINT32 *)direct_access_ptr(data); |
| 2676 | | //printf("Render target at %08X\n\r",data); |
| 2773 | #ifdef LOG_NV2A |
| 2774 | printf("Render target at %08X\n\r", data); |
| 2775 | #endif |
| 2677 | 2776 | countlen--; |
| 2678 | 2777 | } |
| 2679 | 2778 | if (maddress == 0x0214) { |
| 2680 | 2779 | // zbuffer offset ? |
| 2681 | 2780 | depthbuffer = (UINT32 *)direct_access_ptr(data); |
| 2682 | | //printf("Depth buffer at %08X\n\r",data); |
| 2781 | #ifdef LOG_NV2A |
| 2782 | printf("Depth buffer at %08X\n\r",data); |
| 2783 | #endif |
| 2683 | 2784 | if ((data == 0) || (data > 0x7ffffffc)) |
| 2684 | 2785 | depth_write_enabled = false; |
| 2685 | 2786 | else if (channel[chanel][subchannel].object.method[0x035c / 4] != 0) |
| r249025 | r249026 | |
| 2709 | 2810 | if (maddress == 0x0354) { |
| 2710 | 2811 | depth_function = data; |
| 2711 | 2812 | } |
| 2813 | if (maddress == 0x0358) { |
| 2814 | //color_mask = data; |
| 2815 | if (data & 0x000000ff) |
| 2816 | data |= 0x000000ff; |
| 2817 | if (data & 0x0000ff00) |
| 2818 | data |= 0x0000ff00; |
| 2819 | if (data & 0x00ff0000) |
| 2820 | data |= 0x00ff0000; |
| 2821 | if (data & 0xff000000) |
| 2822 | data |= 0xff000000; |
| 2823 | color_mask = data; |
| 2824 | } |
| 2712 | 2825 | if (maddress == 0x035c) { |
| 2713 | 2826 | UINT32 g = channel[chanel][subchannel].object.method[0x0214 / 4]; |
| 2714 | 2827 | depth_write_enabled = data != 0; |
| r249025 | r249026 | |
| 3648 | 3761 | combiner.function_Aop3 = MAX(MIN((combiner.function_Aop3 + biasa) * scalea, 1.0f), -1.0f); |
| 3649 | 3762 | } |
| 3650 | 3763 | |
| 3651 | | bool nv2a_renderer::vblank_callback(screen_device &screen, bool state) |
| 3764 | void nv2a_renderer::vblank_callback(screen_device &screen, bool state) |
| 3652 | 3765 | { |
| 3653 | | //printf("vblank_callback\n\r"); |
| 3654 | | if (state == true) |
| 3766 | #ifdef LOG_NV2A |
| 3767 | printf("vblank_callback\n\r"); |
| 3768 | #endif |
| 3769 | if ((state == true) && (puller_waiting == 1)) { |
| 3770 | puller_waiting = 0; |
| 3771 | puller_timer_work(NULL, 0); |
| 3772 | } |
| 3773 | if (state == true) { |
| 3655 | 3774 | pcrtc[0x100 / 4] |= 1; |
| 3775 | pcrtc[0x808 / 4] |= 0x10000; |
| 3776 | } |
| 3777 | else { |
| 3778 | pcrtc[0x100 / 4] &= ~1; |
| 3779 | pcrtc[0x808 / 4] &= ~0x10000; |
| 3780 | } |
| 3781 | if (update_interrupts() == true) |
| 3782 | interruptdevice->ir3_w(1); // IRQ 3 |
| 3656 | 3783 | else |
| 3657 | | pcrtc[0x100 / 4] &= ~1; |
| 3784 | interruptdevice->ir3_w(0); // IRQ 3 |
| 3785 | } |
| 3786 | |
| 3787 | bool nv2a_renderer::update_interrupts() |
| 3788 | { |
| 3658 | 3789 | if (pcrtc[0x100 / 4] & pcrtc[0x140 / 4]) |
| 3659 | 3790 | pmc[0x100 / 4] |= 0x1000000; |
| 3660 | 3791 | else |
| 3661 | 3792 | pmc[0x100 / 4] &= ~0x1000000; |
| 3662 | | if ((state == true) && (puller_waiting == 1)) { |
| 3663 | | puller_waiting = 0; |
| 3664 | | puller_timer_work(NULL, 0); |
| 3665 | | } |
| 3666 | | if ((pmc[0x100 / 4] != 0) && (pmc[0x140 / 4] != 0)) { |
| 3793 | if (pgraph[0x100 / 4] & pgraph[0x140 / 4]) |
| 3794 | pmc[0x100 / 4] |= 0x1000; |
| 3795 | else |
| 3796 | pmc[0x100 / 4] &= ~0x1000; |
| 3797 | if (((pmc[0x100 / 4] & 0x7fffffff) && (pmc[0x140 / 4] & 1)) || ((pmc[0x100 / 4] & 0x80000000) && (pmc[0x140 / 4] & 2))) { |
| 3667 | 3798 | // send interrupt |
| 3668 | 3799 | return true; |
| 3669 | 3800 | } |
| r249025 | r249026 | |
| 3692 | 3823 | int countlen; |
| 3693 | 3824 | int ret; |
| 3694 | 3825 | address_space *space = puller_space; |
| 3826 | #ifdef LOG_NV2A |
| 3827 | UINT32 subch; |
| 3828 | #endif |
| 3695 | 3829 | |
| 3696 | 3830 | chanel = puller_channel; |
| 3697 | 3831 | subchannel = puller_subchannel; |
| r249025 | r249026 | |
| 3748 | 3882 | } |
| 3749 | 3883 | if (ret != 0) { |
| 3750 | 3884 | puller_timer->enable(false); |
| 3751 | | puller_waiting = 1; |
| 3885 | puller_waiting = ret; |
| 3752 | 3886 | return; |
| 3753 | 3887 | } |
| 3754 | 3888 | } |
| r249025 | r249026 | |
| 3847 | 3981 | //logerror("NV_2A: read PRAMIN[%06X] value %08X\n",offset*4-0x00700000,ret); |
| 3848 | 3982 | } |
| 3849 | 3983 | else if ((offset >= 0x00400000 / 4) && (offset < 0x00402000 / 4)) { |
| 3984 | ret = pgraph[offset - 0x00400000 / 4]; |
| 3850 | 3985 | //logerror("NV_2A: read PGRAPH[%06X] value %08X\n",offset*4-0x00400000,ret); |
| 3851 | 3986 | } |
| 3852 | 3987 | else if ((offset >= 0x00600000 / 4) && (offset < 0x00601000 / 4)) { |
| r249025 | r249026 | |
| 3870 | 4005 | //logerror("NV_2A: read channel[%02X,%d,%04X]=%08X\n",chanel,subchannel,suboffset*4,ret); |
| 3871 | 4006 | return ret; |
| 3872 | 4007 | } |
| 3873 | | else |
| 3874 | | { |
| 3875 | | /* nothing */ |
| 3876 | | } |
| 3877 | 4008 | //logerror("NV_2A: read at %08X mask %08X value %08X\n",0xfd000000+offset*4,mem_mask,ret); |
| 3878 | 4009 | return ret; |
| 3879 | 4010 | } |
| 3880 | 4011 | |
| 3881 | 4012 | WRITE32_MEMBER(nv2a_renderer::geforce_w) |
| 3882 | 4013 | { |
| 4014 | UINT32 old; |
| 4015 | bool update_int; |
| 4016 | |
| 4017 | update_int = false; |
| 3883 | 4018 | if ((offset >= 0x00101000 / 4) && (offset < 0x00102000 / 4)) { |
| 3884 | 4019 | //logerror("NV_2A: write STRAPS[%06X] mask %08X value %08X\n",offset*4-0x00101000,mem_mask,data); |
| 3885 | 4020 | } |
| r249025 | r249026 | |
| 3898 | 4033 | //logerror("NV_2A: write PRAMIN[%06X]=%08X\n",offset*4-0x00700000,data & mem_mask); |
| 3899 | 4034 | } |
| 3900 | 4035 | else if ((offset >= 0x00400000 / 4) && (offset < 0x00402000 / 4)) { |
| 4036 | int e = offset - 0x00400000 / 4; |
| 4037 | if (e >= (sizeof(pgraph) / sizeof(UINT32))) |
| 4038 | return; |
| 4039 | old = pgraph[e]; |
| 4040 | COMBINE_DATA(pgraph + e); |
| 4041 | if (e == 0x100 / 4) { |
| 4042 | pgraph[e] = old & ~data; |
| 4043 | if (data & 1) |
| 4044 | pgraph[0x108 / 4] = 0; |
| 4045 | update_int = true; |
| 4046 | } |
| 4047 | if (e == 0x140 / 4) |
| 4048 | update_int = true; |
| 4049 | if (e == 0x720 / 4) { |
| 4050 | if ((data & 1) && (puller_waiting == 2)) { |
| 4051 | puller_waiting = 0; |
| 4052 | puller_timer->enable(); |
| 4053 | puller_timer->adjust(attotime::zero); |
| 4054 | } |
| 4055 | } |
| 4056 | if ((e >= 0x900 / 4) && (e < 0xa00 / 4)) |
| 4057 | pgraph[e] = 0; |
| 3901 | 4058 | //logerror("NV_2A: write PGRAPH[%06X]=%08X\n",offset*4-0x00400000,data & mem_mask); |
| 3902 | 4059 | } |
| 3903 | 4060 | else if ((offset >= 0x00600000 / 4) && (offset < 0x00601000 / 4)) { |
| 3904 | 4061 | int e = offset - 0x00600000 / 4; |
| 3905 | 4062 | if (e >= (sizeof(pcrtc) / sizeof(UINT32))) |
| 3906 | 4063 | return; |
| 4064 | old = pcrtc[e]; |
| 3907 | 4065 | COMBINE_DATA(pcrtc + e); |
| 4066 | if (e == 0x100 / 4) { |
| 4067 | pcrtc[e] = old & ~data; |
| 4068 | update_int = true; |
| 4069 | } |
| 4070 | if (e == 0x140 / 4) |
| 4071 | update_int = true; |
| 3908 | 4072 | if (e == 0x800 / 4) { |
| 3909 | | displayedtarget = (UINT32 *)direct_access_ptr(data); |
| 3910 | | //printf("crtc buffer %08X\n\r", data); |
| 4073 | displayedtarget = (UINT32 *)direct_access_ptr(pcrtc[e]); |
| 4074 | #ifdef LOG_NV2A |
| 4075 | printf("crtc buffer %08X\n\r", data); |
| 4076 | #endif |
| 3911 | 4077 | } |
| 3912 | 4078 | //logerror("NV_2A: write PCRTC[%06X]=%08X\n",offset*4-0x00600000,data & mem_mask); |
| 3913 | 4079 | } |
| r249025 | r249026 | |
| 3922 | 4088 | // 32 channels size 0x10000 each, 8 subchannels per channel size 0x2000 each |
| 3923 | 4089 | int chanel, subchannel, suboffset; |
| 3924 | 4090 | //int method, count, handle, objclass; |
| 3925 | | #ifdef LOG_NV2A |
| 3926 | | int subch; |
| 3927 | | #endif |
| 3928 | 4091 | |
| 3929 | 4092 | suboffset = offset - 0x00800000 / 4; |
| 3930 | 4093 | chanel = (suboffset >> (16 - 2)) & 31; |
| r249025 | r249026 | |
| 3959 | 4122 | } |
| 3960 | 4123 | //else |
| 3961 | 4124 | // logerror("NV_2A: write at %08X mask %08X value %08X\n",0xfd000000+offset*4,mem_mask,data); |
| 4125 | if (update_int == true) { |
| 4126 | if (update_interrupts() == true) |
| 4127 | interruptdevice->ir3_w(1); // IRQ 3 |
| 4128 | else |
| 4129 | interruptdevice->ir3_w(0); // IRQ 3 |
| 4130 | } |
| 3962 | 4131 | } |
| 3963 | 4132 | |
| 3964 | 4133 | void nv2a_renderer::savestate_items() |
| r249025 | r249026 | |
| 3971 | 4140 | puller_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nv2a_renderer::puller_timer_work), this), (void *)"NV2A Puller Timer"); |
| 3972 | 4141 | puller_timer->enable(false); |
| 3973 | 4142 | } |
| 4143 | |
| 4144 | void nv2a_renderer::set_interrupt_device(pic8259_device *device) |
| 4145 | { |
| 4146 | interruptdevice = device; |
| 4147 | } |
trunk/src/mess/drivers/hp64k.c
| r249025 | r249026 | |
| 216 | 216 | |
| 217 | 217 | DECLARE_READ16_MEMBER(hp64k_usart_r); |
| 218 | 218 | DECLARE_WRITE16_MEMBER(hp64k_usart_w); |
| 219 | | DECLARE_WRITE_LINE_MEMBER(hp64k_rxrdy_w); |
| 220 | | DECLARE_WRITE_LINE_MEMBER(hp64k_txrdy_w); |
| 221 | | DECLARE_WRITE_LINE_MEMBER(hp64k_txd_w); |
| 222 | | DECLARE_WRITE_LINE_MEMBER(hp64k_dtr_w); |
| 223 | | DECLARE_WRITE_LINE_MEMBER(hp64k_rts_w); |
| 219 | DECLARE_WRITE_LINE_MEMBER(hp64k_rxrdy_w); |
| 220 | DECLARE_WRITE_LINE_MEMBER(hp64k_txrdy_w); |
| 221 | DECLARE_WRITE_LINE_MEMBER(hp64k_txd_w); |
| 222 | DECLARE_WRITE_LINE_MEMBER(hp64k_dtr_w); |
| 223 | DECLARE_WRITE_LINE_MEMBER(hp64k_rts_w); |
| 224 | 224 | DECLARE_WRITE16_MEMBER(hp64k_loopback_w); |
| 225 | | void hp64k_update_loopback(void); |
| 226 | | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_rxd_w); |
| 227 | | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_dcd_w); |
| 228 | | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_cts_w); |
| 229 | | |
| 225 | void hp64k_update_loopback(void); |
| 226 | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_rxd_w); |
| 227 | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_dcd_w); |
| 228 | DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_cts_w); |
| 229 | |
| 230 | 230 | DECLARE_WRITE16_MEMBER(hp64k_beep_w); |
| 231 | 231 | TIMER_DEVICE_CALLBACK_MEMBER(hp64k_beeper_off); |
| 232 | 232 | |
| 233 | | DECLARE_WRITE_LINE_MEMBER(hp64k_baud_clk_w); |
| 233 | DECLARE_WRITE_LINE_MEMBER(hp64k_baud_clk_w); |
| 234 | 234 | private: |
| 235 | 235 | required_device<hp_5061_3011_cpu_device> m_cpu; |
| 236 | 236 | required_device<i8275_device> m_crtc; |
| r249025 | r249026 | |
| 248 | 248 | required_ioport m_rs232_sw; |
| 249 | 249 | required_device<beep_device> m_beeper; |
| 250 | 250 | required_device<timer_device> m_beep_timer; |
| 251 | | required_device<clock_device> m_baud_rate; |
| 252 | | required_ioport m_s5_sw; |
| 253 | | required_device<i8251_device> m_uart; |
| 254 | | required_device<rs232_port_device> m_rs232; |
| 251 | required_device<clock_device> m_baud_rate; |
| 252 | required_ioport m_s5_sw; |
| 253 | required_device<i8251_device> m_uart; |
| 254 | required_device<rs232_port_device> m_rs232; |
| 255 | 255 | |
| 256 | 256 | // Character generator |
| 257 | 257 | const UINT8 *m_chargen; |
| r249025 | r249026 | |
| 302 | 302 | floppy_state_t m_floppy_if_state; |
| 303 | 303 | floppy_image_device *m_current_floppy; |
| 304 | 304 | |
| 305 | | // RS232 I/F |
| 306 | | bool m_16x_clk; |
| 307 | | bool m_baud_clk; |
| 308 | | UINT8 m_16x_div; |
| 309 | | bool m_loopback; |
| 310 | | bool m_txd_state; |
| 311 | | bool m_dtr_state; |
| 312 | | bool m_rts_state; |
| 305 | // RS232 I/F |
| 306 | bool m_16x_clk; |
| 307 | bool m_baud_clk; |
| 308 | UINT8 m_16x_div; |
| 309 | bool m_loopback; |
| 310 | bool m_txd_state; |
| 311 | bool m_dtr_state; |
| 312 | bool m_rts_state; |
| 313 | 313 | }; |
| 314 | 314 | |
| 315 | 315 | static ADDRESS_MAP_START(cpu_mem_map , AS_PROGRAM , 16 , hp64k_state) |
| r249025 | r249026 | |
| 329 | 329 | // PA = 4, IC = [0..3] |
| 330 | 330 | // Floppy I/F |
| 331 | 331 | AM_RANGE(HP_MAKE_IOADDR(4 , 0) , HP_MAKE_IOADDR(4 , 3)) AM_READWRITE(hp64k_flp_r , hp64k_flp_w) |
| 332 | | // PA = 5, IC = [0..3] |
| 333 | | // Write to USART |
| 334 | | AM_RANGE(HP_MAKE_IOADDR(5 , 0) , HP_MAKE_IOADDR(5 , 3)) AM_WRITE(hp64k_usart_w) |
| 332 | // PA = 5, IC = [0..3] |
| 333 | // Write to USART |
| 334 | AM_RANGE(HP_MAKE_IOADDR(5 , 0) , HP_MAKE_IOADDR(5 , 3)) AM_WRITE(hp64k_usart_w) |
| 335 | 335 | // PA = 6, IC = [0..3] |
| 336 | 336 | // Read from USART |
| 337 | 337 | AM_RANGE(HP_MAKE_IOADDR(6 , 0) , HP_MAKE_IOADDR(6 , 3)) AM_READ(hp64k_usart_r) |
| 338 | 338 | // PA = 7, IC = 2 |
| 339 | 339 | // Rear-panel switches and loopback relay control |
| 340 | | AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READWRITE(hp64k_rear_sw_r , hp64k_loopback_w) |
| 340 | AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READWRITE(hp64k_rear_sw_r , hp64k_loopback_w) |
| 341 | 341 | // PA = 9, IC = [0..3] |
| 342 | 342 | // Beeper control & interrupt status read |
| 343 | 343 | AM_RANGE(HP_MAKE_IOADDR(9 , 0) , HP_MAKE_IOADDR(9 , 3)) AM_WRITE(hp64k_beep_w) |
| r249025 | r249026 | |
| 366 | 366 | m_rear_panel_sw(*this , "rear_sw"), |
| 367 | 367 | m_rs232_sw(*this , "rs232_sw"), |
| 368 | 368 | m_beeper(*this , "beeper"), |
| 369 | | m_beep_timer(*this , "beep_timer"), |
| 370 | | m_baud_rate(*this , "baud_rate"), |
| 371 | | m_s5_sw(*this , "s5_sw"), |
| 372 | | m_uart(*this , "uart"), |
| 373 | | m_rs232(*this , "rs232") |
| 369 | m_beep_timer(*this , "beep_timer"), |
| 370 | m_baud_rate(*this , "baud_rate"), |
| 371 | m_s5_sw(*this , "s5_sw"), |
| 372 | m_uart(*this , "uart"), |
| 373 | m_rs232(*this , "rs232") |
| 374 | 374 | { |
| 375 | 375 | } |
| 376 | 376 | |
| r249025 | r249026 | |
| 387 | 387 | |
| 388 | 388 | // Divisors of K1135 baud rate generator |
| 389 | 389 | static unsigned baud_rate_divisors[] = { |
| 390 | | 6336, |
| 391 | | 4224, |
| 392 | | 2880, |
| 393 | | 2355, |
| 394 | | 2112, |
| 395 | | 1056, |
| 396 | | 528, |
| 397 | | 264, |
| 398 | | 176, |
| 399 | | 158, |
| 400 | | 132, |
| 401 | | 88, |
| 402 | | 66, |
| 403 | | 44, |
| 404 | | 33, |
| 405 | | 16 |
| 390 | 6336, |
| 391 | 4224, |
| 392 | 2880, |
| 393 | 2355, |
| 394 | 2112, |
| 395 | 1056, |
| 396 | 528, |
| 397 | 264, |
| 398 | 176, |
| 399 | 158, |
| 400 | 132, |
| 401 | 88, |
| 402 | 66, |
| 403 | 44, |
| 404 | 33, |
| 405 | 16 |
| 406 | 406 | }; |
| 407 | 407 | |
| 408 | 408 | void hp64k_state::machine_reset() |
| r249025 | r249026 | |
| 428 | 428 | m_floppy0_wpt = false; |
| 429 | 429 | m_floppy1_wpt = false; |
| 430 | 430 | m_beeper->set_state(0); |
| 431 | | m_baud_rate->set_unscaled_clock(BAUD_RATE_GEN_CLOCK / baud_rate_divisors[ (m_s5_sw->read() >> 1) & 0xf ]); |
| 432 | | m_16x_clk = (m_rs232_sw->read() & 0x02) != 0; |
| 433 | | m_loopback = false; |
| 434 | | m_txd_state = true; |
| 435 | | m_dtr_state = true; |
| 436 | | m_rts_state = true; |
| 437 | | |
| 431 | m_baud_rate->set_unscaled_clock(BAUD_RATE_GEN_CLOCK / baud_rate_divisors[ (m_s5_sw->read() >> 1) & 0xf ]); |
| 432 | m_16x_clk = (m_rs232_sw->read() & 0x02) != 0; |
| 433 | m_loopback = false; |
| 434 | m_txd_state = true; |
| 435 | m_dtr_state = true; |
| 436 | m_rts_state = true; |
| 437 | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | UINT8 hp64k_state::hp64k_crtc_filter(UINT8 data) |
| r249025 | r249026 | |
| 958 | 958 | |
| 959 | 959 | READ16_MEMBER(hp64k_state::hp64k_usart_r) |
| 960 | 960 | { |
| 961 | | UINT16 tmp; |
| 961 | UINT16 tmp; |
| 962 | 962 | |
| 963 | | if ((offset & 1) == 0) { |
| 964 | | tmp = m_uart->status_r(space , 0); |
| 965 | | } else { |
| 966 | | tmp = m_uart->data_r(space , 0); |
| 967 | | } |
| 968 | | |
| 963 | if ((offset & 1) == 0) { |
| 964 | tmp = m_uart->status_r(space , 0); |
| 965 | } else { |
| 966 | tmp = m_uart->data_r(space , 0); |
| 967 | } |
| 968 | |
| 969 | 969 | // bit 8 == bit 7 rear panel switches (modem/terminal) ??? |
| 970 | 970 | |
| 971 | | tmp |= (m_rs232_sw->read() << 8); |
| 971 | tmp |= (m_rs232_sw->read() << 8); |
| 972 | 972 | |
| 973 | | if (BIT(m_rear_panel_sw->read() , 7)) { |
| 974 | | BIT_SET(tmp , 8); |
| 975 | | } |
| 976 | | |
| 973 | if (BIT(m_rear_panel_sw->read() , 7)) { |
| 974 | BIT_SET(tmp , 8); |
| 975 | } |
| 976 | |
| 977 | 977 | return tmp; |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | WRITE16_MEMBER(hp64k_state::hp64k_usart_w) |
| 981 | 981 | { |
| 982 | | if ((offset & 1) == 0) { |
| 983 | | m_uart->control_w(space , 0 , (UINT8)(data & 0xff)); |
| 984 | | } else { |
| 985 | | m_uart->data_w(space , 0 , (UINT8)(data & 0xff)); |
| 986 | | } |
| 982 | if ((offset & 1) == 0) { |
| 983 | m_uart->control_w(space , 0 , (UINT8)(data & 0xff)); |
| 984 | } else { |
| 985 | m_uart->data_w(space , 0 , (UINT8)(data & 0xff)); |
| 986 | } |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | WRITE_LINE_MEMBER(hp64k_state::hp64k_rxrdy_w) |
| 990 | 990 | { |
| 991 | | if (state) { |
| 992 | | BIT_SET(m_irl_pending , 6); |
| 993 | | } else { |
| 994 | | BIT_CLR(m_irl_pending , 6); |
| 995 | | } |
| 991 | if (state) { |
| 992 | BIT_SET(m_irl_pending , 6); |
| 993 | } else { |
| 994 | BIT_CLR(m_irl_pending , 6); |
| 995 | } |
| 996 | 996 | |
| 997 | | hp64k_update_irl(); |
| 997 | hp64k_update_irl(); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | WRITE_LINE_MEMBER(hp64k_state::hp64k_txrdy_w) |
| 1001 | 1001 | { |
| 1002 | | if (state) { |
| 1003 | | BIT_SET(m_irl_pending , 5); |
| 1004 | | } else { |
| 1005 | | BIT_CLR(m_irl_pending , 5); |
| 1006 | | } |
| 1002 | if (state) { |
| 1003 | BIT_SET(m_irl_pending , 5); |
| 1004 | } else { |
| 1005 | BIT_CLR(m_irl_pending , 5); |
| 1006 | } |
| 1007 | 1007 | |
| 1008 | | hp64k_update_irl(); |
| 1008 | hp64k_update_irl(); |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | WRITE_LINE_MEMBER(hp64k_state::hp64k_txd_w) |
| 1012 | 1012 | { |
| 1013 | | m_txd_state = state; |
| 1014 | | if (m_loopback) { |
| 1015 | | m_uart->write_rxd(state); |
| 1016 | | } |
| 1017 | | m_rs232->write_txd(state); |
| 1013 | m_txd_state = state; |
| 1014 | if (m_loopback) { |
| 1015 | m_uart->write_rxd(state); |
| 1016 | } |
| 1017 | m_rs232->write_txd(state); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | WRITE_LINE_MEMBER(hp64k_state::hp64k_dtr_w) |
| 1021 | 1021 | { |
| 1022 | | m_dtr_state = state; |
| 1023 | | if (m_loopback) { |
| 1024 | | m_uart->write_dsr(state); |
| 1025 | | } |
| 1026 | | m_rs232->write_dtr(state); |
| 1022 | m_dtr_state = state; |
| 1023 | if (m_loopback) { |
| 1024 | m_uart->write_dsr(state); |
| 1025 | } |
| 1026 | m_rs232->write_dtr(state); |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | WRITE_LINE_MEMBER(hp64k_state::hp64k_rts_w) |
| 1030 | 1030 | { |
| 1031 | | if (BIT(m_s5_sw->read() , 0)) { |
| 1032 | | // Full duplex, RTS/ = 0 |
| 1033 | | state = 0; |
| 1034 | | } |
| 1035 | | m_rts_state = state; |
| 1036 | | if (m_loopback) { |
| 1037 | | m_uart->write_cts(state); |
| 1038 | | } |
| 1039 | | m_rs232->write_rts(state); |
| 1031 | if (BIT(m_s5_sw->read() , 0)) { |
| 1032 | // Full duplex, RTS/ = 0 |
| 1033 | state = 0; |
| 1034 | } |
| 1035 | m_rts_state = state; |
| 1036 | if (m_loopback) { |
| 1037 | m_uart->write_cts(state); |
| 1038 | } |
| 1039 | m_rs232->write_rts(state); |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | WRITE16_MEMBER(hp64k_state::hp64k_loopback_w) |
| 1043 | 1043 | { |
| 1044 | | m_loopback = BIT(data , 11); |
| 1045 | | hp64k_update_loopback(); |
| 1044 | m_loopback = BIT(data , 11); |
| 1045 | hp64k_update_loopback(); |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | void hp64k_state::hp64k_update_loopback(void) |
| 1049 | 1049 | { |
| 1050 | | if (m_loopback) { |
| 1051 | | m_uart->write_rxd(m_txd_state); |
| 1052 | | m_uart->write_dsr(m_dtr_state); |
| 1053 | | m_uart->write_cts(m_rts_state); |
| 1054 | | } else { |
| 1055 | | m_uart->write_rxd(m_rs232->rxd_r()); |
| 1056 | | m_uart->write_dsr(m_rs232->dcd_r()); |
| 1057 | | m_uart->write_cts(m_rs232->cts_r()); |
| 1058 | | } |
| 1050 | if (m_loopback) { |
| 1051 | m_uart->write_rxd(m_txd_state); |
| 1052 | m_uart->write_dsr(m_dtr_state); |
| 1053 | m_uart->write_cts(m_rts_state); |
| 1054 | } else { |
| 1055 | m_uart->write_rxd(m_rs232->rxd_r()); |
| 1056 | m_uart->write_dsr(m_rs232->dcd_r()); |
| 1057 | m_uart->write_cts(m_rs232->cts_r()); |
| 1058 | } |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_rxd_w) |
| 1062 | 1062 | { |
| 1063 | | if (!m_loopback) { |
| 1064 | | m_uart->write_rxd(state); |
| 1065 | | } |
| 1063 | if (!m_loopback) { |
| 1064 | m_uart->write_rxd(state); |
| 1065 | } |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_dcd_w) |
| 1069 | 1069 | { |
| 1070 | | if (!m_loopback) { |
| 1071 | | m_uart->write_dsr(state); |
| 1072 | | } |
| 1070 | if (!m_loopback) { |
| 1071 | m_uart->write_dsr(state); |
| 1072 | } |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_cts_w) |
| 1076 | 1076 | { |
| 1077 | | if (!m_loopback) { |
| 1078 | | m_uart->write_cts(state); |
| 1079 | | } |
| 1077 | if (!m_loopback) { |
| 1078 | m_uart->write_cts(state); |
| 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | WRITE16_MEMBER(hp64k_state::hp64k_beep_w) |
| r249025 | r249026 | |
| 1095 | 1095 | |
| 1096 | 1096 | WRITE_LINE_MEMBER(hp64k_state::hp64k_baud_clk_w) |
| 1097 | 1097 | { |
| 1098 | | if (!m_16x_clk) { |
| 1099 | | if (state && !m_baud_clk) { |
| 1100 | | m_16x_div++; |
| 1101 | | } |
| 1102 | | m_baud_clk = !!state; |
| 1103 | | state = BIT(m_16x_div , 3); |
| 1104 | | } |
| 1105 | | m_uart->write_txc(state); |
| 1106 | | m_uart->write_rxc(state); |
| 1098 | if (!m_16x_clk) { |
| 1099 | if (state && !m_baud_clk) { |
| 1100 | m_16x_div++; |
| 1101 | } |
| 1102 | m_baud_clk = !!state; |
| 1103 | state = BIT(m_16x_div , 3); |
| 1104 | } |
| 1105 | m_uart->write_txc(state); |
| 1106 | m_uart->write_rxc(state); |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | static INPUT_PORTS_START(hp64k) |
| r249025 | r249026 | |
| 1321 | 1321 | PORT_DIPSETTING(0x00 , "1x") |
| 1322 | 1322 | PORT_DIPSETTING(0x02 , "16x") |
| 1323 | 1323 | |
| 1324 | | PORT_START("s5_sw") |
| 1325 | | PORT_DIPNAME(0x01 , 0x00 , "Duplex") |
| 1326 | | PORT_DIPLOCATION("S5 IO:!1") |
| 1327 | | PORT_DIPSETTING(0x00 , "Half duplex") |
| 1328 | | PORT_DIPSETTING(0x01 , "Full duplex") |
| 1329 | | PORT_DIPNAME(0x1e , 0x00 , "Baud rate") |
| 1330 | | PORT_DIPLOCATION("S5 IO:!5,!4,!3,!2") |
| 1331 | | PORT_DIPSETTING(0x00 , "50") |
| 1332 | | PORT_DIPSETTING(0x02 , "75") |
| 1333 | | PORT_DIPSETTING(0x04 , "110") |
| 1334 | | PORT_DIPSETTING(0x06 , "134.5") |
| 1335 | | PORT_DIPSETTING(0x08 , "150") |
| 1336 | | PORT_DIPSETTING(0x0a , "300") |
| 1337 | | PORT_DIPSETTING(0x0c , "600") |
| 1338 | | PORT_DIPSETTING(0x0e , "1200") |
| 1339 | | PORT_DIPSETTING(0x10 , "1800") |
| 1340 | | PORT_DIPSETTING(0x12 , "2000") |
| 1341 | | PORT_DIPSETTING(0x14 , "2400") |
| 1342 | | PORT_DIPSETTING(0x16 , "3600") |
| 1343 | | PORT_DIPSETTING(0x18 , "4800") |
| 1344 | | PORT_DIPSETTING(0x1a , "7200") |
| 1345 | | PORT_DIPSETTING(0x1c , "9600") |
| 1346 | | PORT_DIPSETTING(0x1e , "19200") |
| 1324 | PORT_START("s5_sw") |
| 1325 | PORT_DIPNAME(0x01 , 0x00 , "Duplex") |
| 1326 | PORT_DIPLOCATION("S5 IO:!1") |
| 1327 | PORT_DIPSETTING(0x00 , "Half duplex") |
| 1328 | PORT_DIPSETTING(0x01 , "Full duplex") |
| 1329 | PORT_DIPNAME(0x1e , 0x00 , "Baud rate") |
| 1330 | PORT_DIPLOCATION("S5 IO:!5,!4,!3,!2") |
| 1331 | PORT_DIPSETTING(0x00 , "50") |
| 1332 | PORT_DIPSETTING(0x02 , "75") |
| 1333 | PORT_DIPSETTING(0x04 , "110") |
| 1334 | PORT_DIPSETTING(0x06 , "134.5") |
| 1335 | PORT_DIPSETTING(0x08 , "150") |
| 1336 | PORT_DIPSETTING(0x0a , "300") |
| 1337 | PORT_DIPSETTING(0x0c , "600") |
| 1338 | PORT_DIPSETTING(0x0e , "1200") |
| 1339 | PORT_DIPSETTING(0x10 , "1800") |
| 1340 | PORT_DIPSETTING(0x12 , "2000") |
| 1341 | PORT_DIPSETTING(0x14 , "2400") |
| 1342 | PORT_DIPSETTING(0x16 , "3600") |
| 1343 | PORT_DIPSETTING(0x18 , "4800") |
| 1344 | PORT_DIPSETTING(0x1a , "7200") |
| 1345 | PORT_DIPSETTING(0x1c , "9600") |
| 1346 | PORT_DIPSETTING(0x1e , "19200") |
| 1347 | 1347 | |
| 1348 | 1348 | INPUT_PORTS_END |
| 1349 | 1349 | |
| r249025 | r249026 | |
| 1366 | 1366 | |
| 1367 | 1367 | // Clock = 25 MHz / 9 * (112/114) |
| 1368 | 1368 | MCFG_DEVICE_ADD("crtc" , I8275 , 2729045) |
| 1369 | | MCFG_VIDEO_SET_SCREEN("screen") |
| 1369 | MCFG_VIDEO_SET_SCREEN("screen") |
| 1370 | 1370 | MCFG_I8275_CHARACTER_WIDTH(9) |
| 1371 | 1371 | MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(hp64k_state , crtc_display_pixels) |
| 1372 | 1372 | MCFG_I8275_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_drq_w)) |
| r249025 | r249026 | |
| 1375 | 1375 | MCFG_SCREEN_ADD("screen" , RASTER) |
| 1376 | 1376 | MCFG_SCREEN_UPDATE_DEVICE("crtc" , i8275_device , screen_update) |
| 1377 | 1377 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1378 | | MCFG_SCREEN_SIZE(720 , 390) |
| 1378 | MCFG_SCREEN_SIZE(720 , 390) |
| 1379 | 1379 | MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") |
| 1380 | 1380 | |
| 1381 | | MCFG_FD1791_ADD("fdc" , XTAL_4MHz / 4) |
| 1381 | MCFG_FD1791_ADD("fdc" , XTAL_4MHz / 4) |
| 1382 | 1382 | MCFG_WD_FDC_FORCE_READY |
| 1383 | 1383 | MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_intrq_w)) |
| 1384 | 1384 | MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_drq_w)) |
| r249025 | r249026 | |
| 1410 | 1410 | |
| 1411 | 1411 | MCFG_TIMER_DRIVER_ADD("beep_timer" , hp64k_state , hp64k_beeper_off); |
| 1412 | 1412 | |
| 1413 | | MCFG_DEVICE_ADD("baud_rate" , CLOCK , 0) |
| 1414 | | MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(hp64k_state , hp64k_baud_clk_w)); |
| 1413 | MCFG_DEVICE_ADD("baud_rate" , CLOCK , 0) |
| 1414 | MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(hp64k_state , hp64k_baud_clk_w)); |
| 1415 | 1415 | |
| 1416 | | MCFG_DEVICE_ADD("uart" , I8251 , 0) |
| 1417 | | MCFG_I8251_RXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_rxrdy_w)); |
| 1418 | | MCFG_I8251_TXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_txrdy_w)); |
| 1419 | | MCFG_I8251_TXD_HANDLER(WRITELINE(hp64k_state , hp64k_txd_w)); |
| 1420 | | MCFG_I8251_DTR_HANDLER(WRITELINE(hp64k_state , hp64k_dtr_w)); |
| 1421 | | MCFG_I8251_RTS_HANDLER(WRITELINE(hp64k_state , hp64k_rts_w)); |
| 1416 | MCFG_DEVICE_ADD("uart" , I8251 , 0) |
| 1417 | MCFG_I8251_RXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_rxrdy_w)); |
| 1418 | MCFG_I8251_TXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_txrdy_w)); |
| 1419 | MCFG_I8251_TXD_HANDLER(WRITELINE(hp64k_state , hp64k_txd_w)); |
| 1420 | MCFG_I8251_DTR_HANDLER(WRITELINE(hp64k_state , hp64k_dtr_w)); |
| 1421 | MCFG_I8251_RTS_HANDLER(WRITELINE(hp64k_state , hp64k_rts_w)); |
| 1422 | 1422 | |
| 1423 | | MCFG_RS232_PORT_ADD("rs232" , default_rs232_devices , NULL) |
| 1424 | | MCFG_RS232_RXD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_rxd_w)) |
| 1425 | | MCFG_RS232_DCD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_dcd_w)) |
| 1426 | | MCFG_RS232_CTS_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_cts_w)) |
| 1427 | | |
| 1423 | MCFG_RS232_PORT_ADD("rs232" , default_rs232_devices , NULL) |
| 1424 | MCFG_RS232_RXD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_rxd_w)) |
| 1425 | MCFG_RS232_DCD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_dcd_w)) |
| 1426 | MCFG_RS232_CTS_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_cts_w)) |
| 1427 | |
| 1428 | 1428 | MACHINE_CONFIG_END |
| 1429 | 1429 | |
| 1430 | 1430 | ROM_START(hp64k) |