src/mame/drivers/megadriv.c
| r9290 | r9291 | |
| 2895 | 2895 | // access from the SH2 via 4030 - 403f |
| 2896 | 2896 | /**********************************************************************************************/ |
| 2897 | 2897 | |
| 2898 | | #define PWM_FIFO_SIZE pwm_tm_reg // guess, check this (Doom wants 3, Virtua Racing wants 1 like they sets this register?) |
| 2898 | /* |
| 2899 | TODO: |
| 2900 | - noticeable static noise on Virtua Fighter Sega logo at start-up |
| 2901 | - Understand if Speaker OFF makes the FIFO to advance or not |
| 2902 | */ |
| 2899 | 2903 | |
| 2904 | #define PWM_FIFO_SIZE pwm_tm_reg // guess, Marsch calls this register as FIFO width |
| 2905 | |
| 2900 | 2906 | static UINT16 pwm_ctrl,pwm_cycle,pwm_tm_reg; |
| 2901 | 2907 | static UINT16 cur_lch[0x10],cur_rch[0x10]; |
| 2902 | 2908 | static UINT16 pwm_cycle_reg; //used for latching |
| r9290 | r9291 | |
| 2928 | 2934 | { |
| 2929 | 2935 | if(lch_index_r < PWM_FIFO_SIZE) |
| 2930 | 2936 | { |
| 2931 | | dac_signed_data_16_w(machine->device("lch_pwm"), cur_lch[lch_index_r++]); |
| 2937 | switch(pwm_ctrl & 3) |
| 2938 | { |
| 2939 | case 0: lch_index_r++; /*Speaker OFF*/ break; |
| 2940 | case 1: dac_signed_data_16_w(machine->device("lch_pwm"), cur_lch[lch_index_r++]); break; |
| 2941 | case 2: dac_signed_data_16_w(machine->device("rch_pwm"), cur_lch[lch_index_r++]); break; |
| 2942 | case 3: popmessage("Undefined PWM Lch value 3, contact MESSdev"); break; |
| 2943 | } |
| 2944 | |
| 2932 | 2945 | lch_index_w = 0; |
| 2933 | 2946 | } |
| 2934 | 2947 | |
| r9290 | r9291 | |
| 2936 | 2949 | |
| 2937 | 2950 | if(rch_index_r < PWM_FIFO_SIZE) |
| 2938 | 2951 | { |
| 2939 | | dac_signed_data_16_w(machine->device("rch_pwm"), cur_rch[rch_index_r++]); |
| 2952 | switch((pwm_ctrl & 0xc) >> 2) |
| 2953 | { |
| 2954 | case 0: rch_index_r++; /*Speaker OFF*/ break; |
| 2955 | case 1: dac_signed_data_16_w(machine->device("rch_pwm"), cur_rch[rch_index_r++]); break; |
| 2956 | case 2: dac_signed_data_16_w(machine->device("lch_pwm"), cur_rch[rch_index_r++]); break; |
| 2957 | case 3: popmessage("Undefined PWM Rch value 3, contact MESSdev"); break; |
| 2958 | } |
| 2959 | |
| 2940 | 2960 | rch_index_w = 0; |
| 2941 | 2961 | } |
| 2942 | 2962 | |