Previous 15994 Revisions Next

r9266 Tuesday 28th September, 2010 at 22:14:34 UTC by Angelo Salese
[32x]: Improved 32x irq behaviour [David Haywood]
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9265r9266
117117static int sh2_master_pwmint_enable, sh2_slave_pwmint_enable;
118118static int sh2_hint_in_vbl;
119119
120static int sh2_master_vint_pending;
121static int sh2_slave_vint_pending;
122
123void _32x_check_irqs(running_machine* machine);
124
120125#define SH2_VRES_IRQ_LEVEL 14
121126#define SH2_VINT_IRQ_LEVEL 12
122127#define SH2_HINT_IRQ_LEVEL 10
r9265r9266
26432648      if (data&0x1)
26442649      {
26452650         if (sh2_master_cmdint_enable) cpu_set_input_line(_32x_master_cpu,SH2_CINT_IRQ_LEVEL,ASSERT_LINE);
2651         else printf("master cmdint when masked!\n");
26462652      }
26472653
26482654      if (data&0x2)
26492655      {
26502656         if (sh2_slave_cmdint_enable) cpu_set_input_line(_32x_slave_cpu,SH2_CINT_IRQ_LEVEL,ASSERT_LINE);
2657         else printf("slave cmdint when masked!\n");
26512658      }
26522659   }
26532660}
r9265r9266
30283035
30293036      if (sh2_master_hint_enable) printf("sh2_master_hint_enable enable!\n");
30303037      //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n");
3038     
3039      _32x_check_irqs(space->machine);
30313040   }
30323041}
30333042
r9265r9266
30653074      if (sh2_slave_hint_enable) printf("sh2_slave_hint_enable enable!\n");
30663075      //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n");
30673076
3077      _32x_check_irqs(space->machine);
3078
30683079   }
30693080}
30703081
r9265r9266
32173228// VINT (vertical interrupt) clear
32183229/**********************************************************************************************/
32193230
3220static WRITE16_HANDLER( _32x_sh2_master_4016_w ){cpu_set_input_line(_32x_master_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);}
3221static WRITE16_HANDLER( _32x_sh2_slave_4016_w ) { cpu_set_input_line(_32x_slave_cpu, SH2_VINT_IRQ_LEVEL,CLEAR_LINE);}
3231static WRITE16_HANDLER( _32x_sh2_master_4016_w ){ sh2_master_vint_pending = 0; _32x_check_irqs(space->machine); }
3232static WRITE16_HANDLER( _32x_sh2_slave_4016_w ) { sh2_slave_vint_pending = 0; _32x_check_irqs(space->machine); }
32223233
32233234/**********************************************************************************************/
32243235// SH2 side 4018
r9265r9266
58765887   }
58775888}
58785889
5890void _32x_check_irqs(running_machine* machine)
5891{
58795892
5893   if (sh2_master_vint_enable && sh2_master_vint_pending) cpu_set_input_line(_32x_master_cpu,SH2_VINT_IRQ_LEVEL,ASSERT_LINE);
5894   else cpu_set_input_line(_32x_master_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);
5895
5896   if (sh2_slave_vint_enable && sh2_slave_vint_pending) cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,ASSERT_LINE);
5897   else cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);   
5898}
5899
5900
58805901static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
58815902{
58825903   /* This function is called at the very start of every scanline starting at the very
r9265r9266
59085929         // 32x interrupt!
59095930         if (_32x_is_connected)
59105931         {
5911            if (sh2_master_vint_enable) cpu_set_input_line(_32x_master_cpu,SH2_VINT_IRQ_LEVEL,ASSERT_LINE);
5912            if (sh2_slave_vint_enable) cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,ASSERT_LINE);
5932            sh2_master_vint_pending = 1;     
5933            sh2_slave_vint_pending = 1;
5934            _32x_check_irqs(timer.machine);         
59135935         }
59145936
59155937      }
r9265r9266
67216743   sh2_master_hint_enable = sh2_slave_hint_enable = 0;
67226744   sh2_master_cmdint_enable = sh2_slave_cmdint_enable = 0;
67236745   sh2_master_pwmint_enable = sh2_slave_pwmint_enable = 0;
6746   sh2_master_vint_pending = sh2_slave_vint_pending = 0;
67246747
67256748   // start in a reset state
67266749   sh2_are_running = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team