src/mame/drivers/megadriv.c
| r9285 | r9286 | |
| 67 | 67 | |
| 68 | 68 | #include "emu.h" |
| 69 | 69 | #include "cpu/z80/z80.h" |
| 70 | | #include "deprecat.h" |
| 70 | //#include "deprecat.h" |
| 71 | 71 | #include "sound/sn76496.h" |
| 72 | 72 | #include "sound/2612intf.h" |
| 73 | 73 | #include "sound/upd7759.h" |
| 74 | 74 | #include "sound/fm.h" |
| 75 | #include "sound/dac.h" |
| 75 | 76 | #include "cpu/m68000/m68000.h" |
| 76 | 77 | #include "includes/megadriv.h" |
| 77 | 78 | #include "cpu/sh2/sh2.h" |
| r9285 | r9286 | |
| 2791 | 2792 | { |
| 2792 | 2793 | switch(offset) |
| 2793 | 2794 | { |
| 2794 | | case 0/2: return pwm_ctrl; //control register |
| 2795 | | case 2/2: return pwm_cycle_reg; // cycle register |
| 2796 | | case 4/2: return mame_rand(space->machine) & 0xc000; // l ch TODO |
| 2797 | | case 6/2: return mame_rand(space->machine) & 0xc000; // r ch TODO |
| 2798 | | case 8/2: return mame_rand(space->machine) & 0xc000; // mono ch TODO |
| 2795 | case 0x00/2: return pwm_ctrl; //control register |
| 2796 | case 0x02/2: return pwm_cycle_reg; // cycle register |
| 2797 | case 0x04/2: return mame_rand(space->machine) & 0xc000; // l ch TODO |
| 2798 | case 0x06/2: return mame_rand(space->machine) & 0xc000; // r ch TODO |
| 2799 | case 0x08/2: return mame_rand(space->machine) & 0xc000; // mono ch TODO |
| 2799 | 2800 | } |
| 2800 | 2801 | |
| 2801 | 2802 | printf("Read at undefined PWM register %02x\n",offset); |
| r9285 | r9286 | |
| 2806 | 2807 | { |
| 2807 | 2808 | switch(offset) |
| 2808 | 2809 | { |
| 2809 | | case 0/2: |
| 2810 | case 0x00/2: |
| 2810 | 2811 | pwm_ctrl = data & 0xffff; |
| 2811 | 2812 | pwm_tm_reg = (pwm_ctrl & 0xf00) >> 8; |
| 2812 | 2813 | calculate_pwm_timer(); |
| 2813 | 2814 | break; |
| 2814 | | case 2/2: |
| 2815 | case 0x02/2: |
| 2815 | 2816 | pwm_cycle = pwm_cycle_reg = data & 0xfff; |
| 2816 | 2817 | calculate_pwm_timer(); |
| 2817 | 2818 | break; |
| 2818 | | case 4/2: |
| 2819 | | // l ch TODO |
| 2819 | case 0x04/2: |
| 2820 | dac_data_16_w(space->machine->device("lch_pwm"), ((data & 0xfff) << 4)); |
| 2820 | 2821 | break; |
| 2821 | | case 6/2: |
| 2822 | | // r ch TODO |
| 2822 | case 0x06/2: |
| 2823 | dac_data_16_w(space->machine->device("rch_pwm"), ((data & 0xfff) << 4)); |
| 2823 | 2824 | break; |
| 2824 | | case 8/2: |
| 2825 | | // mono TODO |
| 2825 | case 0x08/2: |
| 2826 | dac_data_16_w(space->machine->device("lch_pwm"), ((data & 0xfff) << 4)); |
| 2827 | dac_data_16_w(space->machine->device("rch_pwm"), ((data & 0xfff) << 4)); |
| 2826 | 2828 | break; |
| 2827 | 2829 | default: |
| 2828 | 2830 | printf("Write at undefined PWM register %02x %04x\n",offset,data); |
| r9285 | r9286 | |
| 3300 | 3302 | |
| 3301 | 3303 | |
| 3302 | 3304 | /* the 32x treats everything as 16-bit registers, so we remap the 32-bit read & writes |
| 3303 | | to 2x 16-bit handlers here */ |
| 3305 | to 2x 16-bit handlers here (TODO: nuke this shit) */ |
| 3304 | 3306 | |
| 3305 | 3307 | #define _32X_MAP_READHANDLERS(NAMEA,NAMEB) \ |
| 3306 | 3308 | static READ32_HANDLER( _32x_sh2_##NAMEA##_##NAMEB##_r ) \ |
| r9285 | r9286 | |
| 6296 | 6298 | // boosting the interleave here actually makes Kolibri run incorrectly however, that |
| 6297 | 6299 | // one works best just boosting the interleave on communications?! |
| 6298 | 6300 | MDRV_QUANTUM_TIME(HZ(1800000)) |
| 6301 | |
| 6302 | MDRV_SOUND_ADD("lch_pwm", DAC, 0) |
| 6303 | MDRV_SOUND_ROUTE(0, "lspeaker", 0.75) |
| 6304 | |
| 6305 | MDRV_SOUND_ADD("rch_pwm", DAC, 0) |
| 6306 | MDRV_SOUND_ROUTE(0, "rspeaker", 0.75) |
| 6299 | 6307 | MACHINE_CONFIG_END |
| 6300 | 6308 | |
| 6301 | 6309 | |
| r9285 | r9286 | |
| 6309 | 6317 | MDRV_CPU_PROGRAM_MAP(sh2_slave_map) |
| 6310 | 6318 | MDRV_CPU_CONFIG(sh2_conf_slave) |
| 6311 | 6319 | |
| 6320 | // brutal needs at least 30000 or the backgrounds don't animate properly / lock up, and the game |
| 6321 | // freezes. Some stage seem to need as high as 80000 ? this *KILLS* performance |
| 6322 | // |
| 6323 | // boosting the interleave here actually makes Kolibri run incorrectly however, that |
| 6324 | // one works best just boosting the interleave on communications?! |
| 6325 | MDRV_QUANTUM_TIME(HZ(1800000)) |
| 6312 | 6326 | MACHINE_CONFIG_END |
| 6313 | 6327 | |
| 6314 | 6328 | MACHINE_CONFIG_DERIVED( genesis_scd, megadriv ) |