Previous 15994 Revisions Next

r9280 Wednesday 29th September, 2010 at 13:32:06 UTC by Angelo Salese
[32x]: Caught a 68k ROM bank bug, Virtua Racing Deluxe now shows the Sega logo
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9279r9280
638638      {
639639         source -= 2; // the SVP introduces some kind of DMA 'lag', which we have to compensate for, this is obvious even on gfx DMAd from ROM (the Speedometer)
640640      }
641   
641
642642      return space68k->read_word(source);
643643   }
644644   else if (( source >= 0xe00000 ) && ( source <= 0xffffff ))
r9279r9280
23682368            // incase we have a stalled DMA in progress, let the SH2 know there is data available
23692369            sh2_notify_dma_data_available(space->machine->device("32x_master_sh2"));
23702370            sh2_notify_dma_data_available(space->machine->device("32x_slave_sh2"));
2371           
2371
23722372         }
23732373         current_fifo_write_pos = 0;
23742374      }
r9279r9280
24282428
24292429        if (a15106_reg & 0x1) /* NBA Jam TE relies on this */
24302430      {
2431         
2431
24322432         // install the game rom in the normal 0x000000-0x03fffff space used by the genesis - this allows VDP DMA operations to work as they have to be from this area or RAM
24332433         // it should also UNMAP the banked rom area...
24342434         memory_install_rom(space, 0x0000100, 0x03fffff, 0, 0, memory_region(space->machine, "gamecart") + 0x100);
r9279r9280
24362436      else
24372437      {
24382438         // we should be careful and map back any rom overlay (hint) and backup ram too I think...
2439         
2439
24402440         // this is actually blank / nop area
24412441         // we should also map the banked area back (we don't currently unmap it tho)
24422442         memory_install_rom(space, 0x0000100, 0x03fffff, 0, 0, memory_region(space->machine, "maincpu")+0x100);
24432443      }
2444     
2444
24452445      //printf("_32x_68k_a15106_w %04x\n", data);
24462446      /*
24472447        if (a15106_reg & 0x4)
r9279r9280
25832583         memory_install_rom(space, 0x0880000, 0x08fffff, 0, 0, memory_region(space->machine, "gamecart")); // 'fixed' 512kb rom bank
25842584
25852585         memory_install_read_bank(space, 0x0900000, 0x09fffff, 0, 0, "bank12"); // 'bankable' 1024kb rom bank
2586         memory_set_bankptr(space->machine,  "bank12", memory_region(space->machine, "gamecart") );
2586         memory_set_bankptr(space->machine,  "bank12", memory_region(space->machine, "gamecart")+((_32x_68k_a15104_reg&0x3)*0x100000) );
25872587
25882588         memory_install_rom(space, 0x0000000, 0x03fffff, 0, 0, memory_region(space->machine, "32x_68k_bios"));
25892589
r9279r9280
27782778
27792779
27802780//   printf("_32x_68k_a15180_r (a15180) %04x\n",mem_mask);
2781   
2781
27822782   // read needs authorization too I think, undefined behavior otherwise
27832783   switch (offset)
27842784   {
27852785      case 0x00:
2786     
2786
27872787      // the flag is inverted compared to the megadrive
27882788      int ntsc;
27892789      if (megadrive_region_pal) ntsc = 0;
r9279r9280
27932793            (_32x_videopriority << 7 ) |
27942794            ( _32x_240mode << 6 ) |
27952795            ( _32x_displaymode << 0 );
2796           
2797   
2798   
2796
2797
2798
27992799      case 0x02/2:
28002800         return _32x_screenshift;
2801         
2801
28022802      case 0x04/2:
28032803         return _32x_autofill_length;
2804         
2804
28052805      case 0x06/2:
28062806         return _32x_autofill_address;
2807         
2807
28082808      case 0x08/2:
28092809         return _32x_autofill_data;
2810         
2810
28112811      case 0x0a/2:
28122812         UINT16 retdata = _32x_a1518a_reg;
28132813         UINT16 hpos = get_hposition();
r9279r9280
28262826
28272827         return retdata;
28282828   }
2829   
2829
28302830   return 0x0000;
28312831}
28322832
r9279r9280
28352835static WRITE16_HANDLER( _32x_common_vdp_regs_w )
28362836{
28372837   // what happens if the z80 accesses it, what authorization do we use? which address space do we get?? the z80 *can* write here and to the framebuffer via the window
2838   
2838
28392839   address_space* _68kspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
28402840
28412841   if (space!= _68kspace)
r9279r9280
28492849      if (_32x_access_auth!=0)
28502850         return;
28512851   }
2852     
2853   
2852
2853
28542854   switch (offset)
28552855   {
2856   
2857      case 0x00:   
2856
2857      case 0x00:
28582858         printf("_32x_68k_a15180_w (a15180) %04x %04x   source _32x_access_auth %04x\n",data,mem_mask, _32x_access_auth);
2859           
2859
28602860         if (ACCESSING_BITS_0_7)
28612861         {
28622862            _32x_videopriority = (data & 0x80) >> 7;
r9279r9280
28642864            _32x_displaymode   = (data & 0x03) >> 0;
28652865         }
28662866         break;
2867         
2867
28682868      case 0x02/2:
28692869         if (ACCESSING_BITS_0_7)
28702870         {
r9279r9280
28752875
28762876         }
28772877         break;
2878         
2878
28792879      case 0x04/2:
28802880         if (ACCESSING_BITS_0_7)
28812881         {
r9279r9280
28872887
28882888         }
28892889         break;
2890         
2890
28912891      case 0x06/2:
28922892         if (ACCESSING_BITS_0_7)
28932893         {
r9279r9280
28992899            _32x_autofill_address = (_32x_autofill_address & 0x00ff) | (data & 0xff00);
29002900         }
29012901         break;
2902         
2902
29032903      case 0x08/2:
29042904         if (ACCESSING_BITS_0_7)
29052905         {
r9279r9280
29212921            }
29222922         }
29232923         break;
2924         
2924
29252925      case 0x0a/2:
29262926         // bit 0 is the framebuffer select;
29272927         _32x_a1518a_reg = (_32x_a1518a_reg & 0xfffe) | (data & 1);
r9279r9280
29372937            _32x_access_dram = _32x_dram1;
29382938         }
29392939         break;
2940     
2941   
2940
2941
29422942   }
2943   
2944   
2943
2944
29452945}
29462946
29472947
r9279r9280
29992999
30003000      if (sh2_master_hint_enable) printf("sh2_master_hint_enable enable!\n");
30013001      //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n");
3002     
3002
30033003      _32x_check_irqs(space->machine);
30043004   }
30053005}
r9279r9280
53545354               {
53555355                  lineptr[x] = _32x_linerender[x]&0x7fff;
53565356                  drawn = 1;
5357               }                 
5357               }
53585358            }
5359         }   
5359         }
53605360
5361         
5361
53625362         if (drawn==0)
53635363         {
53645364            if (dat&0x10000)
r9279r9280
53665366            else
53675367               lineptr[x] = megadrive_vdp_palette_lookup[(dat&0x0f) | segac2_bg_pal_lookup[(dat&0x30)>>4]];
53685368         }
5369         
53705369
5371         
5370
5371
53725372      }
53735373   }
53745374   else
53755375   {
5376     
5376
53775377      for (x=0;x<320;x++)
53785378      {
53795379         UINT32 dat;
r9279r9280
53985398               {
53995399                  lineptr[x] = _32x_linerender[x]&0x7fff;
54005400                  drawn = 1;
5401               }                 
5401               }
54025402            }
5403         }   
5403         }
54045404
5405         
5405
54065406         if (drawn==0)
54075407         {
54085408            /* Verify my handling.. I'm not sure all cases are correct */
r9279r9280
54425442               break;
54435443            }
54445444         }
5445         
5446         
5447         
5445
5446
5447
54485448      }
54495449
54505450   }
r9279r9280
57905790   else cpu_set_input_line(_32x_master_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);
57915791
57925792   if (sh2_slave_vint_enable && sh2_slave_vint_pending) cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,ASSERT_LINE);
5793   else cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);   
5793   else cpu_set_input_line(_32x_slave_cpu,SH2_VINT_IRQ_LEVEL,CLEAR_LINE);
57945794}
57955795
57965796
r9279r9280
58255825         // 32x interrupt!
58265826         if (_32x_is_connected)
58275827         {
5828            sh2_master_vint_pending = 1;     
5828            sh2_master_vint_pending = 1;
58295829            sh2_slave_vint_pending = 1;
5830            _32x_check_irqs(timer.machine);         
5830            _32x_check_irqs(timer.machine);
58315831         }
58325832
58335833      }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team