Previous 15994 Revisions Next

r5494 Sunday 23rd August, 2009 at 13:23:21 UTC by Robbbert
[JAGUAR] Added per-game eeproms. Removed banking.
[src/mess/drivers]jaguar.c

src/mess/drivers/jaguar.c
r5493r5494
7878 *************************************/
7979
8080static UINT32 joystick_data;
81static UINT8 eeprom_enable;
82
8381static UINT32 *rom_base;
8482static size_t rom_size;
85
8683static UINT32 *cart_base;
8784static size_t cart_size;
88
8985static UINT8 eeprom_bit_count;
9086
9187
r5493r5494
123119   memory_set_bankptr(machine, 12, jaguar_gpu_ram);
124120   memory_set_bankptr(machine, 13, jaguar_dsp_ram);
125121   memory_set_bankptr(machine, 14, jaguar_shared_ram);
126#endif
127122   memory_set_bankptr(machine, 15, cart_base);
128123   memory_set_bankptr(machine, 16, rom_base);
129//  memory_set_bankptr(machine, 17, jaguar_gpu_ram);
124   memory_set_bankptr(machine, 17, jaguar_gpu_ram);
125#endif
130126
131127   /* clear any spinuntil stuff */
132128   jaguar_gpu_resume(machine);
r5493r5494
155151********************************************************************/
156152
157153
154static mame_file *jaguar_nvram_fopen( running_machine *machine, UINT32 openflags)
155{
156   const device_config *image = devtag_get_device(machine, "cart");
157   astring *fname;
158   file_error filerr;
159   mame_file *file;
160   fname = astring_assemble_4( astring_alloc(), machine->gamedrv->name, PATH_SEPARATOR, image_basename_noext(image), ".nv");
161   filerr = mame_fopen( SEARCHPATH_NVRAM, astring_c( fname), openflags, &file);
162   astring_free( fname);
163   return (filerr == FILERR_NONE) ? file : NULL;
164}
165
166static void jaguar_nvram_load(running_machine *machine)
167{
168   mame_file *nvram_file = NULL;
169   const device_config *device;
170
171   if (machine->config->nvram_handler != NULL)
172   {
173      nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_READ);
174      eeprom_load(nvram_file);
175   }
176
177   for (device = machine->config->devicelist; device != NULL; device = device->next)
178   {
179      device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
180      if (nvram != NULL)
181      {
182         if (nvram_file == NULL)
183            nvram_file = nvram_fopen(machine, OPEN_FLAG_READ);
184         (*nvram)(device, nvram_file, 0);
185      }
186   }
187
188   if (nvram_file != NULL)
189      mame_fclose(nvram_file);
190}
191
192
193static void jaguar_nvram_save(running_machine *machine)
194{
195   mame_file *nvram_file = NULL;
196   const device_config *device;
197
198   if (machine->config->nvram_handler != NULL)
199   {
200      nvram_file = jaguar_nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
201      eeprom_save(nvram_file);
202   }
203
204   for (device = machine->config->devicelist; device != NULL; device = device->next)
205   {
206      device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
207      if (nvram != NULL)
208      {
209         if (nvram_file == NULL)
210            nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
211         (*nvram)(device, nvram_file, 1);
212      }
213   }
214
215   if (nvram_file != NULL)
216      mame_fclose(nvram_file);
217}
218
158219static NVRAM_HANDLER( jaguar )
159220{
160221   if (read_or_write)
161      eeprom_save(file);
222      jaguar_nvram_save(machine);
162223   else
163224   {
164225      eeprom_init(machine, &eeprom_interface_93C46);
165226
166227      if (file)
167         eeprom_load(file);
228         jaguar_nvram_load(machine);
168229   }
169230}
170231
r5493r5494
347408static ADDRESS_MAP_START( jaguar_map, ADDRESS_SPACE_PROGRAM, 32 )
348409   ADDRESS_MAP_GLOBAL_MASK(0xffffff)
349410   AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_BASE(&jaguar_shared_ram) AM_MIRROR(0x200000) AM_SHARE(1) AM_REGION("maincpu", 0)
350   AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_BASE(&cart_base) AM_SIZE(&cart_size) AM_REGION("maincpu", 0x800000)
351   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE(&rom_base) AM_SIZE(&rom_size) AM_REGION("maincpu", 0xe00000)
411   AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_BASE(&cart_base) AM_SIZE(&cart_size) AM_SHARE(15) AM_REGION("maincpu", 0x800000)
412   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE(&rom_base) AM_SIZE(&rom_size) AM_SHARE(16) AM_REGION("maincpu", 0xe00000)
352413   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
353414   AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_BASE(&jaguar_gpu_clut) AM_SHARE(2)
354415   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
r5493r5494
372433
373434static ADDRESS_MAP_START( gpu_map, ADDRESS_SPACE_PROGRAM, 32 )
374435   ADDRESS_MAP_GLOBAL_MASK(0xffffff)
375   AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_RAM AM_SHARE(1)
376   AM_RANGE(0x800000, 0xdfffff) AM_ROMBANK(15)
377   AM_RANGE(0xe00000, 0xe1ffff) AM_ROMBANK(16)
436   AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_RAM AM_SHARE(1) AM_REGION("maincpu", 0)
437   AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_SHARE(15) AM_REGION("maincpu", 0x800000)
438   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_SHARE(16) AM_REGION("maincpu", 0xe00000)
378439   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
379440   AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_SHARE(2)
380441   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
r5493r5494
488549   PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED )
489550
490551   PORT_START("CONFIG")
552//   PORT_CONFNAME( 0x02, 0x02, "Show Logo")
553//   PORT_CONFSETTING(    0x00, "Yes")
554//   PORT_CONFSETTING(    0x02, "No")
491555   PORT_CONFNAME( 0x04, 0x04, "TV System")
492556   PORT_CONFSETTING(    0x00, "PAL")
493557   PORT_CONFSETTING(    0x04, "NTSC")
r5493r5494
590654static DRIVER_INIT( jaguar )
591655{
592656   state_save_register_global(machine, joystick_data);
593   state_save_register_global(machine, eeprom_enable);
594
595   /* init the sound system and install DSP speedups */
596//   cojag_sound_init(machine);   // rom makes this redundant
597657}
598658
599659static QUICKLOAD_LOAD( jaguar )
r5493r5494
639699      cart_base[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
640700   }
641701
642   /* Disable logo - breaks Doom */
643   rom_base[0x53c / 4] = 0x67000002;
702   /* Disable logo? - can't do this because of core fatal warning */
703   //if (input_port_read(image->machine, "CONFIG") & 2)
704      rom_base[0x53c / 4] = 0x67000002;
644705
645706   /* Transfer control to the bios */
646707   cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, rom_base[1]);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team