trunk/src/mess/machine/nes_jaleco.c
| r22602 | r22603 | |
| 434 | 434 | { |
| 435 | 435 | if (!(m_irq_count & 0x000f)) |
| 436 | 436 | { |
| 437 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 437 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 438 | 438 | m_irq_count = (m_irq_count & 0xfff0) | 0x000f; |
| 439 | 439 | } |
| 440 | 440 | else |
| r22602 | r22603 | |
| 444 | 444 | { |
| 445 | 445 | if (!(m_irq_count & 0x00ff)) |
| 446 | 446 | { |
| 447 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 447 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 448 | 448 | m_irq_count = (m_irq_count & 0xff00) | 0x00ff; |
| 449 | 449 | } |
| 450 | 450 | else |
| r22602 | r22603 | |
| 454 | 454 | { |
| 455 | 455 | if (!(m_irq_count & 0x0fff)) |
| 456 | 456 | { |
| 457 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 457 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 458 | 458 | m_irq_count = (m_irq_count & 0xf000) | 0x0fff; |
| 459 | 459 | } |
| 460 | 460 | else |
| r22602 | r22603 | |
| 464 | 464 | { |
| 465 | 465 | if (!m_irq_count) |
| 466 | 466 | { |
| 467 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 467 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 468 | 468 | m_irq_count = 0xffff; |
| 469 | 469 | } |
| 470 | 470 | else |
| r22602 | r22603 | |
| 536 | 536 | break; |
| 537 | 537 | case 0x7000: |
| 538 | 538 | m_irq_count = m_irq_count_latch; |
| 539 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 539 | 540 | break; |
| 540 | 541 | case 0x7001: |
| 541 | 542 | m_irq_enable = data & 0x01; |
| 542 | 543 | m_irq_mode = data & 0x0e; |
| 544 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 543 | 545 | break; |
| 544 | 546 | |
| 545 | 547 | case 0x7002: |
trunk/src/mess/machine/nes_konami.c
| r22602 | r22603 | |
| 371 | 371 | { |
| 372 | 372 | if ((m_irq_count & 0x00ff) == 0xff) |
| 373 | 373 | { |
| 374 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 374 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 375 | 375 | m_irq_count = m_irq_count_latch; |
| 376 | 376 | } |
| 377 | 377 | else |
| r22602 | r22603 | |
| 381 | 381 | { |
| 382 | 382 | if (m_irq_count == 0xffff) |
| 383 | 383 | { |
| 384 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 384 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 385 | 385 | m_irq_count = m_irq_count_latch; |
| 386 | 386 | } |
| 387 | 387 | else |
| r22602 | r22603 | |
| 415 | 415 | m_irq_enable_latch = data & 0x01; |
| 416 | 416 | if (data & 0x02) |
| 417 | 417 | m_irq_count = m_irq_count_latch; |
| 418 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 418 | 419 | break; |
| 419 | 420 | case 0x5000: |
| 420 | 421 | m_irq_enable = m_irq_enable_latch; |
| 422 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 421 | 423 | break; |
| 422 | 424 | case 0x7000: |
| 423 | 425 | prg16_89ab(data); |
| r22602 | r22603 | |
| 441 | 443 | if (m_irq_count == 0xff) |
| 442 | 444 | { |
| 443 | 445 | m_irq_count = m_irq_count_latch; |
| 444 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 446 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 445 | 447 | } |
| 446 | 448 | else |
| 447 | 449 | m_irq_count++; |
| r22602 | r22603 | |
| 538 | 540 | m_irq_count_latch = (m_irq_count_latch & 0x0f) | ((data & 0x0f) << 4); |
| 539 | 541 | break; |
| 540 | 542 | case 0x200: |
| 541 | | m_irq_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 543 | m_irq_mode = data & 0x04; |
| 542 | 544 | m_irq_enable = data & 0x02; |
| 543 | 545 | m_irq_enable_latch = data & 0x01; |
| 544 | 546 | if (data & 0x02) |
| 545 | 547 | m_irq_count = m_irq_count_latch; |
| 548 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 546 | 549 | break; |
| 547 | 550 | case 0x300: |
| 548 | 551 | m_irq_enable = m_irq_enable_latch; |
| 552 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 549 | 553 | break; |
| 550 | 554 | } |
| 551 | 555 | break; |
| r22602 | r22603 | |
| 614 | 618 | m_irq_count_latch = data; |
| 615 | 619 | break; |
| 616 | 620 | case 0x100: |
| 617 | | m_irq_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 621 | m_irq_mode = data & 0x04; |
| 618 | 622 | m_irq_enable = data & 0x02; |
| 619 | 623 | m_irq_enable_latch = data & 0x01; |
| 620 | 624 | if (data & 0x02) |
| 621 | 625 | m_irq_count = m_irq_count_latch; |
| 626 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 622 | 627 | break; |
| 623 | 628 | case 0x200: |
| 624 | 629 | m_irq_enable = m_irq_enable_latch; |
| 630 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 625 | 631 | break; |
| 626 | 632 | default: |
| 627 | 633 | logerror("VRC-6 write_h uncaught write, addr: %04x value: %02x\n", ((offset & 0x7000) | add_lines) + 0x8000, data); |
| r22602 | r22603 | |
| 727 | 733 | m_irq_count_latch = data; |
| 728 | 734 | break; |
| 729 | 735 | case 0x7000: |
| 730 | | m_irq_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 736 | m_irq_mode = data & 0x04; |
| 731 | 737 | m_irq_enable = data & 0x02; |
| 732 | 738 | m_irq_enable_latch = data & 0x01; |
| 733 | 739 | if (data & 0x02) |
| 734 | 740 | m_irq_count = m_irq_count_latch; |
| 741 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 735 | 742 | break; |
| 736 | 743 | case 0x7008: case 0x7010: case 0x7018: |
| 737 | 744 | m_irq_enable = m_irq_enable_latch; |
| 745 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 738 | 746 | break; |
| 739 | 747 | |
| 740 | 748 | default: |
| r22602 | r22603 | |
| 764 | 772 | |
| 765 | 773 | // FIXME: we currently emulate this as a base YM2413! |
| 766 | 774 | |
| 767 | | |
| 768 | | #define VRC7_NTSC_CLOCK (21477272.724 / 12) |
| 769 | | |
| 770 | 775 | static MACHINE_CONFIG_FRAGMENT( vrc7 ) |
| 771 | 776 | |
| 772 | 777 | // additional sound hardware |
| 773 | 778 | MCFG_SPEAKER_STANDARD_MONO("addon") |
| 774 | 779 | |
| 775 | | MCFG_SOUND_ADD("ym", YM2413, VRC7_NTSC_CLOCK) |
| 780 | MCFG_SOUND_ADD("ym", YM2413, N2A03_DEFAULTCLOCK) |
| 776 | 781 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.5) |
| 777 | 782 | MACHINE_CONFIG_END |
| 778 | 783 | |
trunk/src/mess/machine/nes_sunsoft.c
| r22602 | r22603 | |
| 272 | 272 | { |
| 273 | 273 | if (!m_irq_count) |
| 274 | 274 | { |
| 275 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 275 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 276 | 276 | m_irq_count = 0xffff; |
| 277 | 277 | m_irq_enable = 0; |
| 278 | 278 | } |
| r22602 | r22603 | |
| 311 | 311 | case 0x5800: |
| 312 | 312 | m_irq_enable = BIT(data, 4); |
| 313 | 313 | m_irq_toggle = 0; |
| 314 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 314 | 315 | break; |
| 315 | 316 | case 0x6800: |
| 316 | 317 | switch (data & 3) |
| r22602 | r22603 | |
| 466 | 467 | { |
| 467 | 468 | m_irq_count = 0xffff; |
| 468 | 469 | if (m_irq_enable & 0x01) // bit0, trigger enable |
| 469 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 470 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 470 | 471 | } |
| 471 | 472 | else |
| 472 | 473 | m_irq_count--; |
| r22602 | r22603 | |
| 514 | 515 | break; |
| 515 | 516 | case 0x0d: |
| 516 | 517 | m_irq_enable = data; |
| 518 | if (!(m_irq_enable & 1)) |
| 519 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 517 | 520 | break; |
| 518 | 521 | case 0x0e: |
| 519 | 522 | m_irq_count = (m_irq_count & 0xff00) | data; |
trunk/src/mess/machine/nes_namcot.c
| r22602 | r22603 | |
| 409 | 409 | if (m_irq_enable) |
| 410 | 410 | { |
| 411 | 411 | if (m_irq_count == 0x7fff) // counter does not wrap to 0! |
| 412 | | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE); |
| 412 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 413 | 413 | else |
| 414 | 414 | m_irq_count++; |
| 415 | 415 | } |
| r22602 | r22603 | |
| 425 | 425 | { |
| 426 | 426 | case 0x1000: /* low byte of IRQ */ |
| 427 | 427 | m_irq_count = (m_irq_count & 0x7f00) | data; |
| 428 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 428 | 429 | break; |
| 429 | 430 | case 0x1800: /* high byte of IRQ, IRQ enable in high bit */ |
| 430 | 431 | m_irq_count = (m_irq_count & 0xff) | ((data & 0x7f) << 8); |
| 431 | 432 | m_irq_enable = data & 0x80; |
| 433 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 432 | 434 | break; |
| 433 | 435 | } |
| 434 | 436 | } |
| r22602 | r22603 | |
| 442 | 444 | { |
| 443 | 445 | case 0x1000: |
| 444 | 446 | return m_irq_count & 0xff; |
| 447 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 445 | 448 | case 0x1800: |
| 446 | 449 | return (m_irq_count >> 8) & 0xff; |
| 450 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 447 | 451 | default: |
| 448 | 452 | return 0x00; |
| 449 | 453 | } |