Previous 15994 Revisions Next

r9344 Saturday 9th October, 2010 at 14:18:52 UTC by Angelo Salese
[32x]: Added h interrupt hook-up
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9343r9344
7474  vdp line state change, which can be configured in the init
7575  rather than hardcoding them.
7676
7732x Marsch tests documentation:
7732x Marsch tests documentation (keep start pressed at start-up for individual tests):
7878
7979MD side check:
8080#1 Communication Check
r9343r9344
117117#37 SH-2 Slave ROM Read Check
118118#38 SH-2 Serial Communication (ERROR - returns a Timeout Error)
119119MD & 32x check:
120#39 MD&SH-2 Master Communication (ERROR)
121#40 MD&SH-2 Slave Communication (STALLS)
120#39 MD&SH-2 Master Communication
121#40 MD&SH-2 Slave Communication
122122#41 MD&SH-2 Master FM Bit R/W
123123#42 MD&SH-2 Slave FM Bit R/W
124#43 MD&SH-2 Master DREQ CTL (ERROR)
125#44 MD&SH-2 Slave DREQ CTL (ERROR)
124#43 MD&SH-2 Master DREQ CTL
125#44 MD&SH-2 Slave DREQ CTL
126126#45 MD&SH-2 Master DREQ SRC address
127127#46 MD&SH-2 Slave DREQ SRC address
128128#47 MD&SH-2 Master DREQ DST address
r9343r9344
131131#50 MD&SH-2 Slave DREQ SIZE address
132132#51 SH-2 Master V IRQ
133133#52 SH-2 Slave V IRQ
134#53 SH2 Master H IRQ (MD 0) (ERROR)
135#54 SH2 Slave H IRQ (MD 0) (ERROR)
136#55 SH2 Master H IRQ (MD 1) (ERROR)
137#56 SH2 Slave H IRQ (MD 1) (ERROR)
138#57 SH2 Master H IRQ (MD 2) (ERROR)
139#58 SH2 Slave H IRQ (MD 2) (ERROR)
134#53 SH2 Master H IRQ (MD 0)
135#54 SH2 Slave H IRQ (MD 0)
136#55 SH2 Master H IRQ (MD 1)
137#56 SH2 Slave H IRQ (MD 1)
138#57 SH2 Master H IRQ (MD 2)
139#58 SH2 Slave H IRQ (MD 2)
140140MD VDP check:
141141#59 Bitmap Mode Register
142142#60 Shift Register
r9343r9344
304304static int sh2_master_vint_pending;
305305static int sh2_slave_vint_pending;
306306static int _32x_fb_swap;
307static int _32x_hcount_reg,_32x_hcount_compare_val;
307308
308309void _32x_check_irqs(running_machine* machine);
309310
r9343r9344
29852986*/
29862987
29872988#define PWM_FIFO_SIZE pwm_tm_reg // guess, Marsch calls this register as FIFO width
2989#define PWM_CLOCK megadrive_region_pal ? ((MASTER_CLOCK_PAL*3) / 7) : ((MASTER_CLOCK_NTSC*3) / 7)
29882990
29892991static UINT16 pwm_ctrl,pwm_cycle,pwm_tm_reg;
29902992static UINT16 cur_lch[0x10],cur_rch[0x10];
r9343r9344
30093011      lch_fifo_state = rch_fifo_state = 0x4000;
30103012      lch_index_r = rch_index_r = 0;
30113013      lch_index_w = rch_index_w = 0;
3012      timer_adjust_oneshot(_32x_pwm_timer, ATTOTIME_IN_HZ(((MASTER_CLOCK_NTSC*3 / 7) / (pwm_cycle - 1))), 0);
3014      timer_adjust_oneshot(_32x_pwm_timer, ATTOTIME_IN_HZ((PWM_CLOCK) / (pwm_cycle - 1)), 0);
30133015   }
30143016}
30153017
r9343r9344
30543056      if(sh2_slave_pwmint_enable) { cpu_set_input_line(_32x_slave_cpu, SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
30553057   }
30563058
3057   timer_adjust_oneshot(_32x_pwm_timer, ATTOTIME_IN_HZ(((MASTER_CLOCK_NTSC*3 / 7) / (pwm_cycle - 1))), 0);
3059   timer_adjust_oneshot(_32x_pwm_timer, ATTOTIME_IN_HZ((PWM_CLOCK) / (pwm_cycle - 1)), 0);
30583060}
30593061
30603062static READ16_HANDLER( _32x_pwm_r )
r9343r9344
33923394      sh2_master_cmdint_enable = data & 0x2;
33933395      sh2_master_pwmint_enable = data & 0x1;
33943396
3395      if (sh2_master_hint_enable) printf("sh2_master_hint_enable enable!\n");
3397      //if (sh2_master_hint_enable) printf("sh2_master_hint_enable enable!\n");
33963398      //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n");
33973399
33983400      _32x_check_irqs(space->machine);
r9343r9344
34303432      sh2_slave_cmdint_enable = data & 0x2;
34313433      sh2_slave_pwmint_enable = data & 0x1;
34323434
3433      if (sh2_slave_hint_enable) printf("sh2_slave_hint_enable enable!\n");
3435      //if (sh2_slave_hint_enable) printf("sh2_slave_hint_enable enable!\n");
34343436      //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n");
34353437
34363438      _32x_check_irqs(space->machine);
r9343r9344
34613463// H Count Register (H Interrupt)
34623464// 0 = every line
34633465/**********************************************************************************************/
3464static UINT16 hcount;
3465
34663466static READ16_HANDLER( _32x_sh2_common_4004_r )
34673467{
3468   return hcount;
3468   return _32x_hcount_reg;
34693469}
34703470
34713471static WRITE16_HANDLER( _32x_sh2_common_4004_w )
34723472{
3473   hcount = data & 0xff;
3473   _32x_hcount_reg = data & 0xff;
34743474}
34753475
34763476
r9343r9344
67806780   //  if (genesis_scanline_counter==0) irq4counter = MEGADRIVE_REG0A_HINT_VALUE;
67816781      // irq4counter = MEGADRIVE_REG0A_HINT_VALUE;
67826782
6783
6784
67856783      if (genesis_scanline_counter<=224)
67866784      {
67876785         irq4counter--;
r9343r9344
68086806
68096807      //if (genesis_scanline_counter==0) irq4_on_timer->adjust(ATTOTIME_IN_USEC(2));
68106808
6809      if(_32x_is_connected)
6810      {
6811         _32x_hcount_compare_val++;
68116812
6813         if(_32x_hcount_compare_val >= _32x_hcount_reg)
6814         {
6815            _32x_hcount_compare_val = -1;
68126816
6817            if(genesis_scanline_counter < 224 || sh2_hint_in_vbl)
6818            {
6819               if(sh2_master_hint_enable) { cpu_set_input_line(_32x_master_cpu,SH2_HINT_IRQ_LEVEL,ASSERT_LINE); }
6820               if(sh2_slave_hint_enable) { cpu_set_input_line(_32x_slave_cpu,SH2_HINT_IRQ_LEVEL,ASSERT_LINE); }
6821            }
6822         }
6823      }
68136824
6825
68146826      if (timer.machine->device("genesis_snd_z80") != NULL)
68156827      {
68166828         if (genesis_scanline_counter == megadrive_z80irq_scanline)
r9343r9344
69556967   }
69566968
69576969
6958   current_fifo_block = fifo_block_a;
6959   current_fifo_readblock = fifo_block_b;
6960   current_fifo_write_pos = 0;
6961   current_fifo_read_pos = 0;
6962   fifo_block_a_full = 0;
6963   fifo_block_b_full = 0;
6970   if(_32x_is_connected)
6971   {
6972      current_fifo_block = fifo_block_a;
6973      current_fifo_readblock = fifo_block_b;
6974      current_fifo_write_pos = 0;
6975      current_fifo_read_pos = 0;
6976      fifo_block_a_full = 0;
6977      fifo_block_b_full = 0;
69646978
6979      _32x_hcount_compare_val = -1;
6980   }
69656981}
69666982
69676983void megadriv_stop_scanline_timer(void)
r9343r9344
70877103
70887104   scanline_timer->adjust(attotime_zero);
70897105
7106   if(_32x_is_connected)
7107      _32x_hcount_compare_val = -1;
70907108}
70917109
70927110

Previous 15994 Revisions Next


© 1998-2018 The MESS Team