Previous 15994 Revisions Next

r9291 Friday 1st October, 2010 at 04:02:55 UTC by Angelo Salese
[32x]: Added PWM Panning
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9290r9291
28952895// access from the SH2 via 4030 - 403f
28962896/**********************************************************************************************/
28972897
2898#define PWM_FIFO_SIZE pwm_tm_reg // guess, check this (Doom wants 3, Virtua Racing wants 1 like they sets this register?)
2898/*
2899TODO:
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*/
28992903
2904#define PWM_FIFO_SIZE pwm_tm_reg // guess, Marsch calls this register as FIFO width
2905
29002906static UINT16 pwm_ctrl,pwm_cycle,pwm_tm_reg;
29012907static UINT16 cur_lch[0x10],cur_rch[0x10];
29022908static UINT16 pwm_cycle_reg; //used for latching
r9290r9291
29282934{
29292935   if(lch_index_r < PWM_FIFO_SIZE)
29302936   {
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
29322945      lch_index_w = 0;
29332946   }
29342947
r9290r9291
29362949
29372950   if(rch_index_r < PWM_FIFO_SIZE)
29382951   {
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
29402960      rch_index_w = 0;
29412961   }
29422962

Previous 15994 Revisions Next


© 1998-2018 The MESS Team