Previous 15994 Revisions Next

r8036 Friday 14th May, 2010 at 07:17:59 UTC by Robbbert
[JAGUAR] More work on loading homebrews. Removed J01 extension.
[src/mess/drivers]jaguar.c

src/mess/drivers/jaguar.c
r8035r8036
640640   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
641641
642642   /* quickload */
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof,abs", 0)
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,bjl,prg,cof,abs", 0)
644644
645645   /* cartridge */
646646   MDRV_CARTSLOT_ADD("cart")
647   MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64,j01")
647   MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64")
648648   MDRV_CARTSLOT_INTERFACE("jaguar_cart")
649649   MDRV_CARTSLOT_LOAD(jaguar)
650650
r8035r8036
718718
719719   jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
720720
721   /* Deal with some of the numerous homebrew header systems */
722      /* COF */
723   if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000)
724   {
725      UINT32 start = jaguar_shared_ram[0x100e];
726      UINT32 skip = jaguar_shared_ram[0x1011];
727      memset(jaguar_shared_ram, 0, 0x200000);
728      image_fseek(image, 0, SEEK_SET);
729      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
730      quickload_begin = start;
731      jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size);
732   }
733   else   /* PRG */
721734   if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752))
722735   {
723736      UINT32 type = jaguar_shared_ram[0x1008] >> 16;
r8035r8036
729742      image_fseek(image, 0, SEEK_SET);
730743      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
731744      quickload_begin = start;
732      jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
745      jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size);
733746   }
734   else
735   if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000)
736   {
737      UINT32 start = jaguar_shared_ram[0x100e];
738      UINT32 skip = jaguar_shared_ram[0x1011];
739      memset(jaguar_shared_ram, 0, 0x200000);
740      image_fseek(image, 0, SEEK_SET);
741      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
742      quickload_begin = start;
743      jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
744   }
745   else
747   else   /* ABS */
746748   if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000)
747749   {
748750      UINT32 start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16);
r8035r8036
751753      image_fseek(image, 0, SEEK_SET);
752754      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
753755      quickload_begin = start;
754      jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
756      jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size);
755757   }
756758
757759
r8035r8036
762764
763765static DEVICE_IMAGE_LOAD( jaguar )
764766{
765   int i, j;
766767   UINT32 size, load_offset = 0, load_skip = 0;
767   UINT8 header[512];
768768
769769   if (image_software_entry(image) == NULL)
770770   {
r8035r8036
773773      /* .rom files load & run at 802000 */
774774      if (!mame_stricmp(image_filetype(image), "rom"))   
775775      {
776         load_offset = 0x2000;
777         cart_base[0x101]=0x208000;   // becomes 802000 after endian adjustment below
778         /* more may be needed as no .rom files run yet */
776         load_offset = 0x2000;      // fix load address
777         cart_base[0x101]=0x802000;   // fix exec address
779778      }
780779      else
781780
r8035r8036
785784
786785      /* Skip any header */
787786      if (load_skip)
788         image_fread(image, header, load_skip);
787         image_fseek(image, load_skip, SEEK_SET);
789788
790789      /* Load cart into memory */
791790      image_fread(image, &memory_region(image->machine, "maincpu")[0x800000+load_offset], size - load_skip);
r8035r8036
795794      size = image_get_software_region_length(image, "rom");
796795
797796      /* skip header, if any */
798      if ((size & 0x200) == 0x200)
799      {
800         load_skip = 0x200;
801         memcpy(header, image_get_software_region(image, "rom") , load_skip);
802      }
797//      if ((size & 0x200) == 0x200)
798//      {
799//         load_skip = 0x200;
800//         memcpy(header, image_get_software_region(image, "rom") , load_skip);
801//      }
803802
804803      memcpy(cart_base, image_get_software_region(image, "rom") + load_skip, size - load_skip);
805804   }
r8035r8036
807806   memset(jaguar_shared_ram, 0, 0x200000);
808807   memcpy(jaguar_shared_ram, rom_base, 0x10);
809808
810   /* Fix endian-ness  */
811   /* Air Cars is scrambled, it needs to be made the same as an ordinary cart,
812      but in the meantime, this enables it to load */
813   if (image_software_entry(image) == NULL && !mame_stricmp(image_filetype(image), "j01"))
814   {
815      for (i = 0; i < size / 4; i++)
816      {
817         j = cart_base[i];
818         cart_base[i] = ((j & 0xff) << 16) | ((j & 0xff00) << 16) | ((j & 0xff0000) >> 16) | ((j & 0xff000000) >> 16);
819      }
820   }
821   else
822      jaguar_fix_endian(image->machine, 0x800000, size);
809   jaguar_fix_endian(image->machine, 0x800000+load_offset, size-load_skip);
823810
824811   /* Skip the logo */
825812   cart_base[0x102] = 1;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team