Previous 15994 Revisions Next

r8030 Thursday 13th May, 2010 at 05:28:25 UTC by Robbbert
[JAGUAR] Added support for "rom","prg","cof" files. Only "cof" is working.
[src/mess/drivers]jaguar.c

src/mess/drivers/jaguar.c
r8029r8030
640640   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
641641
642642   /* quickload */
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin", 0)
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof", 0)
644644
645645   /* cartridge */
646646   MDRV_CARTSLOT_ADD("cart")
r8029r8030
696696   offs_t quickload_begin = 0x4000;
697697   memset(jaguar_shared_ram, 0, 0x200000);
698698   quickload_size = MIN(quickload_size, 0x200000 - quickload_begin);
699
699700   image_fread(image, &memory_region(image->machine, "maincpu")[quickload_begin], quickload_size);
700701
701702   /* Fix endian-ness */
r8029r8030
705706      jaguar_shared_ram[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
706707   }
707708
709   if (!mame_stricmp(image_filetype(image), "prg"))
710   {
711      if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752))
712      {
713         UINT32 type = jaguar_shared_ram[0x1008] >> 16;
714         UINT32 start = ((jaguar_shared_ram[0x1008] & 0xffff) << 16) | (jaguar_shared_ram[0x1009] >> 16);
715         UINT32 skip = 28;
716         if (type == 2) skip = 42;
717         if (type == 3) skip = 46;
718         memset(jaguar_shared_ram, 0, 0x200000);
719         image_fseek(image, 0, SEEK_SET);
720         image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
721         quickload_begin = start;
722         /* Fix endian-ness */
723         for (i = quickload_begin / 4; i < quickload_size / 4; i++)
724         {
725            j = jaguar_shared_ram[i];
726            jaguar_shared_ram[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
727         }
728      }
729   }
730   else
731   if (!mame_stricmp(image_filetype(image), "cof"))
732   {
733      if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000)
734      {
735         UINT32 start = jaguar_shared_ram[0x100e];
736         UINT32 skip = jaguar_shared_ram[0x1011];
737         memset(jaguar_shared_ram, 0, 0x200000);
738         image_fseek(image, 0, SEEK_SET);
739         image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
740         quickload_begin = start;
741         /* Fix endian-ness */
742         for (i = quickload_begin / 4; i < quickload_size / 4; i++)
743         {
744            j = jaguar_shared_ram[i];
745            jaguar_shared_ram[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
746         }
747      }
748   }
749
750
708751   /* Transfer control to image */
709752   cpu_set_reg(devtag_get_device(image->machine, "maincpu"), REG_GENPC, quickload_begin);
710753   return INIT_PASS;
r8029r8030
712755
713756static DEVICE_IMAGE_LOAD( jaguar )
714757{
715   int i, j, offset = 0;
716   UINT32 size;
758   int i, j, load_skip = 0;
759   UINT32 size, load_offset = 0;
717760   UINT8 header[512];
718761
719762   if (image_software_entry(image) == NULL)
720763   {
721764      size = image_length(image);
722765
723      /* skip header, if any */
724      if ((size & 0x200) == 0x200)
766      /* .rom files load & run at 802000 */
767      if (!mame_stricmp(image_filetype(image), "rom"))   
725768      {
726         offset = 0x200;
727         image_fread(image, header, 0x200);
769         load_offset = 0x2000;
770         cart_base[0x101]=0x208000;   // becomes 802000 after endian adjustment below
771         /* more may be needed as no .rom files run yet */
728772      }
773      else
729774
730      image_fread(image, cart_base, size - offset);
775      /* see if we are loading Brutal Sports Football with CRC 0FDCEB66 */
776      if ((size & 0x200) == 0x200)
777         load_skip = 0x200;
778
779      /* Skip any header */
780      if (load_skip)
781         image_fread(image, header, load_skip);
782
783      /* Load cart into memory */
784      image_fread(image, cart_base + load_offset, size - load_skip);
731785   }
732786   else
733787   {
r8029r8030
736790      /* skip header, if any */
737791      if ((size & 0x200) == 0x200)
738792      {
739         offset = 0x200;
740         memcpy(header, image_get_software_region(image, "rom") , 0x200);
793         load_skip = 0x200;
794         memcpy(header, image_get_software_region(image, "rom") , load_skip);
741795      }
742796
743      memcpy(cart_base, image_get_software_region(image, "rom") + offset, size - offset);
797      memcpy(cart_base, image_get_software_region(image, "rom") + load_skip, size - load_skip);
744798   }
745799
746800   memset(jaguar_shared_ram, 0, 0x200000);
747801   memcpy(jaguar_shared_ram, rom_base, 0x10);
748802
749803   /* Fix endian-ness  */
750   // Note (2010-04, FP): I assume there is no .j01 file in our xml list
804   /* Air Cars is scrambled, it needs to be made the same as an ordinary cart,
805      but in the meantime, this enables it to load */
751806   if (image_software_entry(image) == NULL && !mame_stricmp(image_filetype(image), "j01"))
752807   {
753808      for (i = 0; i < size / 4; i++)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team