trunk/src/mame/drivers/cps2.c
| r19581 | r19582 | |
| 764 | 764 | * Sound ? |
| 765 | 765 | * |
| 766 | 766 | *************************************/ |
| 767 | |
| 768 | TIMER_CALLBACK_MEMBER(cps_state::cps2_update_digital_volume) |
| 769 | { |
| 770 | int vol_button_state; |
| 767 | 771 | |
| 772 | vol_button_state = ioport("DIGITALVOL")->read(); |
| 773 | |
| 774 | if (vol_button_state & 0x01) m_cps2digitalvolumelevel -= 1; |
| 775 | if (vol_button_state & 0x02) m_cps2digitalvolumelevel += 1; |
| 776 | |
| 777 | if (m_cps2digitalvolumelevel > 39) m_cps2digitalvolumelevel = 39; |
| 778 | if (m_cps2digitalvolumelevel < 0) m_cps2digitalvolumelevel = 0; |
| 779 | |
| 780 | machine().device<qsound_device>("qsound")->set_output_gain(0, m_cps2digitalvolumelevel / 39.0); |
| 781 | machine().device<qsound_device>("qsound")->set_output_gain(1, m_cps2digitalvolumelevel / 39.0); |
| 782 | } |
| 783 | |
| 768 | 784 | static READ16_HANDLER( cps2_qsound_volume_r ) |
| 769 | 785 | { |
| 770 | 786 | cps_state *state = space.machine().driver_data<cps_state>(); |
| 771 | | |
| 787 | |
| 788 | UINT16 cps2_vol_states[40] = |
| 789 | { |
| 790 | 0xf010, 0xf008, 0xf004, 0xf002, 0xf001, 0xe810, 0xe808, 0xe804, 0xe802, 0xe801, |
| 791 | 0xe410, 0xe408, 0xe404, 0xe402, 0xe401, 0xe210, 0xe208, 0xe204, 0xe202, 0xe201, |
| 792 | 0xe110, 0xe108, 0xe104, 0xe102, 0xe101, 0xe090, 0xe088, 0xe084, 0xe082, 0xe081, |
| 793 | 0xe050, 0xe048, 0xe044, 0xe042, 0xe041, 0xe030, 0xe028, 0xe024, 0xe022, 0xe021 |
| 794 | }; |
| 795 | |
| 796 | UINT16 result; |
| 797 | |
| 798 | result = cps2_vol_states[state->m_cps2digitalvolumelevel]; |
| 799 | |
| 772 | 800 | /* Extra adapter memory (0x660000-0x663fff) available when bit 14 = 0 */ |
| 773 | 801 | /* Network adapter (ssf2tb) present when bit 15 = 0 */ |
| 774 | 802 | /* Only game known to use both these so far is SSF2TB */ |
| 775 | 803 | |
| 776 | 804 | if (state->m_cps2networkpresent) |
| 777 | | return 0x2021; |
| 805 | return 0x2021; /* SSF2TB doesn't have a digital slider in the test screen */ |
| 778 | 806 | else |
| 779 | | return 0xe021; |
| 807 | if (state->m_cps2disabledigitalvolume) |
| 808 | return 0xd000; /* digital display isn't shown in test mode */ |
| 809 | else |
| 810 | return result; |
| 780 | 811 | } |
| 781 | 812 | |
| 782 | 813 | |
| r19581 | r19582 | |
| 928 | 959 | PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, write_bit) |
| 929 | 960 | PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, set_clock_line) |
| 930 | 961 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, set_cs_line) |
| 962 | |
| 963 | /* fake inputs for digital volume buttons */ |
| 964 | PORT_START( "DIGITALVOL" ) |
| 965 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VOLUME_DOWN ) |
| 966 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_VOLUME_UP ) |
| 931 | 967 | INPUT_PORTS_END |
| 932 | 968 | |
| 933 | 969 | /* 4 players and 3 buttons */ |
| r19581 | r19582 | |
| 8162 | 8198 | * |
| 8163 | 8199 | *************************************/ |
| 8164 | 8200 | |
| 8201 | static void init_digital_volume(running_machine &machine) |
| 8202 | { |
| 8203 | cps_state *state = machine.driver_data<cps_state>(); |
| 8204 | |
| 8205 | state->m_cps2digitalvolumelevel = 39; /* maximum */ |
| 8206 | state->m_cps2disabledigitalvolume = 0; |
| 8207 | |
| 8208 | /* create a timer to update our volume state from the fake switches - read it every 6 frames or so to enable some granularity */ |
| 8209 | state->m_digital_volume_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(cps_state::cps2_update_digital_volume),state)); |
| 8210 | state->m_digital_volume_timer->adjust(attotime::from_msec(100), 0, attotime::from_msec(100)); |
| 8211 | } |
| 8212 | |
| 8165 | 8213 | DRIVER_INIT_MEMBER(cps_state,cps2) |
| 8166 | 8214 | { |
| 8167 | 8215 | |
| r19581 | r19582 | |
| 8172 | 8220 | DRIVER_INIT_CALL(cps2_video); |
| 8173 | 8221 | |
| 8174 | 8222 | m_cps2networkpresent = 0; |
| 8175 | | |
| 8223 | |
| 8224 | init_digital_volume(machine()); |
| 8225 | |
| 8176 | 8226 | machine().device("maincpu")->set_clock_scale(0.7375f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ |
| 8177 | 8227 | } |
| 8178 | 8228 | |
| r19581 | r19582 | |
| 8201 | 8251 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x804000, 0x804001, FUNC(joy_or_paddle_r)); |
| 8202 | 8252 | } |
| 8203 | 8253 | |
| 8254 | DRIVER_INIT_MEMBER(cps_state,singbrd) |
| 8255 | { |
| 8256 | DRIVER_INIT_CALL(cps2); |
| 8257 | |
| 8258 | /* the single board games don't have a digital volume switch */ |
| 8259 | m_cps2disabledigitalvolume = 1; |
| 8260 | m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); |
| 8261 | } |
| 8262 | |
| 8204 | 8263 | static READ16_HANDLER( gigaman2_dummyqsound_r ) |
| 8205 | 8264 | { |
| 8206 | 8265 | cps_state *state = space.machine().driver_data<cps_state>(); |
| r19581 | r19582 | |
| 8246 | 8305 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x618000, 0x619fff, FUNC(gigaman2_dummyqsound_r), FUNC(gigaman2_dummyqsound_w)); // no qsound.. |
| 8247 | 8306 | space.set_decrypted_region(0x000000, (length) - 1, &rom[length/4]); |
| 8248 | 8307 | m68k_set_encrypted_opcode_range(machine().device("maincpu"), 0, length); |
| 8308 | |
| 8309 | /* no digital volume switches on this? */ |
| 8310 | m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); |
| 8249 | 8311 | } |
| 8250 | 8312 | |
| 8251 | 8313 | |
| r19581 | r19582 | |
| 8447 | 8509 | GAME( 1998, mvscur1, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (USA 971222)", GAME_SUPPORTS_SAVE ) |
| 8448 | 8510 | GAME( 1998, mvscj, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Japan 980123)", GAME_SUPPORTS_SAVE ) |
| 8449 | 8511 | GAME( 1998, mvscjr1, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Japan 980112)", GAME_SUPPORTS_SAVE ) |
| 8450 | | GAME( 1998, mvscjsing, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Japan 980123) (Single PCB)", GAME_SUPPORTS_SAVE ) |
| 8512 | GAME( 1998, mvscjsing, mvsc, cps2, cps2_2p6b, cps_state, singbrd, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Japan 980123) (Single PCB)", GAME_SUPPORTS_SAVE ) |
| 8451 | 8513 | GAME( 1998, mvsca, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Asia 980123)", GAME_SUPPORTS_SAVE ) |
| 8452 | 8514 | GAME( 1998, mvscar1, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Asia 980112)", GAME_SUPPORTS_SAVE ) |
| 8453 | 8515 | GAME( 1998, mvsch, mvsc, cps2, cps2_2p6b, cps_state, cps2, ROT0, "Capcom", "Marvel Vs. Capcom: Clash of Super Heroes (Hispanic 980123)", GAME_SUPPORTS_SAVE ) |