trunk/src/mame/drivers/ssv.c
| r21140 | r21141 | |
| 162 | 162 | #include "emu.h" |
| 163 | 163 | #include "cpu/v810/v810.h" |
| 164 | 164 | #include "cpu/v60/v60.h" |
| 165 | | #include "machine/eeprom.h" |
| 166 | 165 | #include "machine/nvram.h" |
| 167 | 166 | #include "sound/es5506.h" |
| 168 | 167 | #include "includes/ssv.h" |
| r21140 | r21141 | |
| 178 | 177 | /* Update the IRQ state based on all possible causes */ |
| 179 | 178 | void ssv_state::update_irq_state() |
| 180 | 179 | { |
| 181 | | machine().device("maincpu")->execute().set_input_line(0, (m_requested_int & m_irq_enable)? ASSERT_LINE : CLEAR_LINE); |
| 180 | m_maincpu->set_input_line(0, (m_requested_int & m_irq_enable)? ASSERT_LINE : CLEAR_LINE); |
| 182 | 181 | } |
| 183 | 182 | |
| 184 | 183 | IRQ_CALLBACK_MEMBER(ssv_state::ssv_irq_callback) |
| r21140 | r21141 | |
| 317 | 316 | void ssv_state::machine_reset() |
| 318 | 317 | { |
| 319 | 318 | m_requested_int = 0; |
| 320 | | machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(ssv_state::ssv_irq_callback),this)); |
| 319 | m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(ssv_state::ssv_irq_callback),this)); |
| 321 | 320 | membank("bank1")->set_base(memregion("user1")->base()); |
| 322 | 321 | } |
| 323 | 322 | |
| r21140 | r21141 | |
| 444 | 443 | |
| 445 | 444 | READ16_MEMBER(ssv_state::gdfs_eeprom_r) |
| 446 | 445 | { |
| 447 | | device_t *device = machine().device("eeprom"); |
| 448 | | static const char *const gunnames[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2" }; |
| 446 | ioport_port *gun[] = { m_io_gunx1, m_io_guny1, m_io_gunx2, m_io_guny2 }; |
| 449 | 447 | |
| 450 | | eeprom_device *eeprom = downcast<eeprom_device *>(device); |
| 451 | | return (((m_gdfs_lightgun_select & 1) ? 0 : 0xff) ^ ioport(gunnames[m_gdfs_lightgun_select])->read()) | (eeprom->read_bit() << 8); |
| 448 | return (((m_gdfs_lightgun_select & 1) ? 0 : 0xff) ^ gun[m_gdfs_lightgun_select]->read()) | (m_eeprom->read_bit() << 8); |
| 452 | 449 | } |
| 453 | 450 | |
| 454 | 451 | WRITE16_MEMBER(ssv_state::gdfs_eeprom_w) |
| 455 | 452 | { |
| 456 | | device_t *device = machine().device("eeprom"); |
| 457 | | |
| 458 | 453 | if (data & ~0x7b00) |
| 459 | 454 | logerror("%s - Unknown EEPROM bit written %04X\n",machine().describe_context(),data); |
| 460 | 455 | |
| r21140 | r21141 | |
| 464 | 459 | // data & 0x0001 ? |
| 465 | 460 | |
| 466 | 461 | // latch the bit |
| 467 | | eeprom_device *eeprom = downcast<eeprom_device *>(device); |
| 468 | | eeprom->write_bit(data & 0x4000); |
| 462 | m_eeprom->write_bit(data & 0x4000); |
| 469 | 463 | |
| 470 | 464 | // reset line asserted: reset. |
| 471 | | eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE ); |
| 465 | m_eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE ); |
| 472 | 466 | |
| 473 | 467 | // clock line asserted: write latch or select next bit to read |
| 474 | | eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE ); |
| 468 | m_eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE ); |
| 475 | 469 | |
| 476 | 470 | if (!(m_gdfs_eeprom_old & 0x0800) && (data & 0x0800)) // rising clock |
| 477 | 471 | m_gdfs_lightgun_select = (data & 0x0300) >> 8; |
| r21140 | r21141 | |
| 511 | 505 | { |
| 512 | 506 | UINT16 input_sel = *m_input_sel; |
| 513 | 507 | |
| 514 | | if (input_sel & 0x0001) return ioport("KEY0")->read(); |
| 515 | | if (input_sel & 0x0002) return ioport("KEY1")->read(); |
| 516 | | if (input_sel & 0x0004) return ioport("KEY2")->read(); |
| 517 | | if (input_sel & 0x0008) return ioport("KEY3")->read(); |
| 508 | if (input_sel & 0x0001) return m_io_key0->read(); |
| 509 | if (input_sel & 0x0002) return m_io_key1->read(); |
| 510 | if (input_sel & 0x0004) return m_io_key2->read(); |
| 511 | if (input_sel & 0x0008) return m_io_key3->read(); |
| 518 | 512 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); |
| 519 | 513 | return 0xffff; |
| 520 | 514 | } |
| r21140 | r21141 | |
| 634 | 628 | { |
| 635 | 629 | UINT16 input_sel = *m_input_sel; |
| 636 | 630 | |
| 637 | | if (input_sel & 0x0002) return ioport("KEY0")->read(); |
| 638 | | if (input_sel & 0x0004) return ioport("KEY1")->read(); |
| 639 | | if (input_sel & 0x0008) return ioport("KEY2")->read(); |
| 640 | | if (input_sel & 0x0010) return ioport("KEY3")->read(); |
| 631 | if (input_sel & 0x0002) return m_io_key0->read(); |
| 632 | if (input_sel & 0x0004) return m_io_key1->read(); |
| 633 | if (input_sel & 0x0008) return m_io_key2->read(); |
| 634 | if (input_sel & 0x0010) return m_io_key3->read(); |
| 641 | 635 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); |
| 642 | 636 | return 0xffff; |
| 643 | 637 | } |
| r21140 | r21141 | |
| 669 | 663 | { |
| 670 | 664 | if (ACCESSING_BITS_0_7) |
| 671 | 665 | { |
| 672 | | device_t *device = machine().device("ensoniq"); |
| 673 | 666 | int bank = 0x400000/2 * (data & 1); // UINT16 address |
| 674 | 667 | int voice; |
| 675 | 668 | for (voice = 0; voice < 32; voice++) |
| 676 | | es5506_voice_bank_w(device, voice, bank); |
| 669 | es5506_voice_bank_w(m_ensoniq, voice, bank); |
| 677 | 670 | } |
| 678 | 671 | // popmessage("%04X",data); |
| 679 | 672 | } |
| r21140 | r21141 | |
| 682 | 675 | { |
| 683 | 676 | UINT16 input_sel = *m_input_sel; |
| 684 | 677 | |
| 685 | | if (input_sel & 0x0002) return ioport("KEY0")->read(); |
| 686 | | if (input_sel & 0x0004) return ioport("KEY1")->read(); |
| 687 | | if (input_sel & 0x0008) return ioport("KEY2")->read(); |
| 688 | | if (input_sel & 0x0010) return ioport("KEY3")->read(); |
| 678 | if (input_sel & 0x0002) return m_io_key0->read(); |
| 679 | if (input_sel & 0x0004) return m_io_key1->read(); |
| 680 | if (input_sel & 0x0008) return m_io_key2->read(); |
| 681 | if (input_sel & 0x0010) return m_io_key3->read(); |
| 689 | 682 | logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); |
| 690 | 683 | return 0xffff; |
| 691 | 684 | } |
| r21140 | r21141 | |
| 728 | 721 | |
| 729 | 722 | READ16_MEMBER(ssv_state::sxyreact_ballswitch_r) |
| 730 | 723 | { |
| 731 | | return ioport("SERVICE")->read_safe(0); |
| 724 | if ( m_io_service ) |
| 725 | { |
| 726 | return m_io_service->read(); |
| 727 | } |
| 728 | return 0; |
| 732 | 729 | } |
| 733 | 730 | |
| 734 | 731 | READ16_MEMBER(ssv_state::sxyreact_dial_r) |
| r21140 | r21141 | |
| 742 | 739 | if (ACCESSING_BITS_0_7) |
| 743 | 740 | { |
| 744 | 741 | if (data & 0x20) |
| 745 | | m_sxyreact_serial = ioport("PADDLE")->read_safe(0) & 0xff; |
| 742 | m_sxyreact_serial = ( m_io_paddle ? m_io_paddle->read() : 0 ) & 0xff; |
| 746 | 743 | |
| 747 | 744 | if ( (m_sxyreact_dial & 0x40) && !(data & 0x40) ) // $40 -> $00 |
| 748 | 745 | m_sxyreact_serial <<= 1; // shift 1 bit |
| r21140 | r21141 | |
| 857 | 854 | |
| 858 | 855 | READ16_MEMBER(ssv_state::eaglshot_gfxrom_r) |
| 859 | 856 | { |
| 860 | | UINT8 *rom = memregion("gfx1")->base(); |
| 861 | | size_t size = memregion("gfx1")->bytes(); |
| 857 | UINT8 *rom = m_region_gfx1->base(); |
| 858 | size_t size = m_region_gfx1->bytes(); |
| 862 | 859 | |
| 863 | 860 | offset = offset * 2 + m_gfxrom_select * 0x200000; |
| 864 | 861 | |
| r21140 | r21141 | |
| 880 | 877 | { |
| 881 | 878 | switch(m_trackball_select) |
| 882 | 879 | { |
| 883 | | case 0x60: return (ioport("TRACKX")->read() >> 8) & 0xff; |
| 884 | | case 0x40: return (ioport("TRACKX")->read() >> 0) & 0xff; |
| 880 | case 0x60: return (m_io_trackx->read() >> 8) & 0xff; |
| 881 | case 0x40: return (m_io_trackx->read() >> 0) & 0xff; |
| 885 | 882 | |
| 886 | | case 0x70: return (ioport("TRACKY")->read() >> 8) & 0xff; |
| 887 | | case 0x50: return (ioport("TRACKY")->read() >> 0) & 0xff; |
| 883 | case 0x70: return (m_io_tracky->read() >> 8) & 0xff; |
| 884 | case 0x50: return (m_io_tracky->read() >> 0) & 0xff; |
| 888 | 885 | } |
| 889 | 886 | return 0; |
| 890 | 887 | } |
trunk/src/mame/includes/ssv.h
| r21140 | r21141 | |
| 1 | 1 | #include "cpu/upd7725/upd7725.h" |
| 2 | 2 | #include "video/st0020.h" |
| 3 | #include "machine/eeprom.h" |
| 3 | 4 | |
| 5 | |
| 4 | 6 | class ssv_state : public driver_device |
| 5 | 7 | { |
| 6 | 8 | public: |
| 7 | 9 | ssv_state(const machine_config &mconfig, device_type type, const char *tag) |
| 8 | 10 | : driver_device(mconfig, type, tag), |
| 11 | m_maincpu(*this, "maincpu"), |
| 12 | m_ensoniq(*this, "ensoniq"), |
| 13 | m_eeprom(*this, "eeprom"), |
| 9 | 14 | m_dsp(*this, "dsp"), |
| 10 | 15 | m_mainram(*this, "mainram"), |
| 11 | 16 | m_spriteram(*this, "spriteram"), |
| r21140 | r21141 | |
| 15 | 20 | m_gdfs_tmapram(*this, "gdfs_tmapram"), |
| 16 | 21 | m_gdfs_tmapscroll(*this, "gdfs_tmapscroll"), |
| 17 | 22 | m_gdfs_st0020(*this, "st0020_spr"), |
| 18 | | m_input_sel(*this, "input_sel"){ } |
| 23 | m_input_sel(*this, "input_sel"), |
| 24 | m_region_gfx1(*this, "gfx1"), |
| 25 | m_io_gunx1(*this, "GUNX1"), |
| 26 | m_io_guny1(*this, "GUNY1"), |
| 27 | m_io_gunx2(*this, "GUNX2"), |
| 28 | m_io_guny2(*this, "GUNY2"), |
| 29 | m_io_key0(*this, "KEY0"), |
| 30 | m_io_key1(*this, "KEY1"), |
| 31 | m_io_key2(*this, "KEY2"), |
| 32 | m_io_key3(*this, "KEY3"), |
| 33 | m_io_service(*this, "SERVICE"), |
| 34 | m_io_paddle(*this, "PADDLE"), |
| 35 | m_io_trackx(*this, "TRACKX"), |
| 36 | m_io_tracky(*this, "TRACKY") |
| 37 | { } |
| 19 | 38 | |
| 39 | required_device<cpu_device> m_maincpu; |
| 40 | required_device<device_t> m_ensoniq; |
| 41 | optional_device<eeprom_device> m_eeprom; |
| 20 | 42 | optional_device<upd96050_device> m_dsp; |
| 21 | 43 | |
| 22 | 44 | required_shared_ptr<UINT16> m_mainram; |
| r21140 | r21141 | |
| 139 | 161 | void init_ssv(int interrupt_ultrax); |
| 140 | 162 | void init_hypreac2_common(); |
| 141 | 163 | void init_st010(); |
| 164 | |
| 165 | protected: |
| 166 | required_memory_region m_region_gfx1; |
| 167 | optional_ioport m_io_gunx1; |
| 168 | optional_ioport m_io_guny1; |
| 169 | optional_ioport m_io_gunx2; |
| 170 | optional_ioport m_io_guny2; |
| 171 | optional_ioport m_io_key0; |
| 172 | optional_ioport m_io_key1; |
| 173 | optional_ioport m_io_key2; |
| 174 | optional_ioport m_io_key3; |
| 175 | optional_ioport m_io_service; |
| 176 | optional_ioport m_io_paddle; |
| 177 | optional_ioport m_io_trackx; |
| 178 | optional_ioport m_io_tracky; |
| 142 | 179 | }; |
| 143 | | |
| 144 | | /*----------- defined in video/ssv.c -----------*/ |
| 145 | | void ssv_enable_video(running_machine &machine, int enable); |