Previous 15994 Revisions Next

r8032 Thursday 13th May, 2010 at 09:06:03 UTC by Robbbert
[JAGUAR] Started work on "abs" files, not working yet. Made a common decrypt routine, fixes some "bin" files that weren't being completely unscrambled.
[src/mess/drivers]jaguar.c

src/mess/drivers/jaguar.c
r8031r8032
640640   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
641641
642642   /* quickload */
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof", 0)
643   MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof,abs", 0)
644644
645645   /* cartridge */
646646   MDRV_CARTSLOT_ADD("cart")
647   MDRV_CARTSLOT_EXTENSION_LIST("jag,abs,rom,j64,j01")
647   MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64,j01")
648648   MDRV_CARTSLOT_INTERFACE("jaguar_cart")
649649   MDRV_CARTSLOT_LOAD(jaguar)
650650
r8031r8032
685685 *
686686 *************************************/
687687
688static void jaguar_fix_endian( running_machine *machine, UINT32 addr, UINT32 size )
689{
690   UINT8 j[4], *RAM = memory_region(machine, "maincpu");
691   UINT32 i;
692   size += addr;
693   for (i = addr; i < size; i+=4)
694   {
695      j[0] = RAM[i];
696      j[1] = RAM[i+1];
697      j[2] = RAM[i+2];
698      j[3] = RAM[i+3];
699      RAM[i] = j[3];
700      RAM[i+1] = j[2];
701      RAM[i+2] = j[1];
702      RAM[i+3] = j[0];
703   }
704}
705
688706static DRIVER_INIT( jaguar )
689707{
690708   state_save_register_global(machine, joystick_data);
r8031r8032
692710
693711static QUICKLOAD_LOAD( jaguar )
694712{
695   int i,j;
696713   offs_t quickload_begin = 0x4000;
697714   memset(jaguar_shared_ram, 0, 0x200000);
698715   quickload_size = MIN(quickload_size, 0x200000 - quickload_begin);
699716
700717   image_fread(image, &memory_region(image->machine, "maincpu")[quickload_begin], quickload_size);
701718
702   /* Fix endian-ness */
703   for (i = quickload_begin / 4; i < quickload_size / 4; i++)
719   jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
720
721   if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752))
704722   {
705      j = jaguar_shared_ram[i];
706      jaguar_shared_ram[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
723      UINT32 type = jaguar_shared_ram[0x1008] >> 16;
724      UINT32 start = ((jaguar_shared_ram[0x1008] & 0xffff) << 16) | (jaguar_shared_ram[0x1009] >> 16);
725      UINT32 skip = 28;
726      if (type == 2) skip = 42;
727      if (type == 3) skip = 46;
728      memset(jaguar_shared_ram, 0, 0x200000);
729      image_fseek(image, 0, SEEK_SET);
730      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
731      quickload_begin = start;
732      jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
707733   }
708
709   if (!mame_stricmp(image_filetype(image), "prg"))
734   else
735   if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000)
710736   {
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      }
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);
729744   }
730745   else
731   if (!mame_stricmp(image_filetype(image), "cof"))
746   if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000)
732747   {
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      UINT32 start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16);
749      UINT32 skip = 0xd0;
750      memset(jaguar_shared_ram, 0, 0x200000);
751      image_fseek(image, 0, SEEK_SET);
752      image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size);
753      quickload_begin = start;
754      jaguar_fix_endian(image->machine, quickload_begin, quickload_size);
748755   }
749756
750757
r8031r8032
812819      }
813820   }
814821   else
815   {
816      for (i = 0; i < size / 4; i++)
817      {
818         j = cart_base[i];
819         cart_base[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24);
820      }
821   }
822      jaguar_fix_endian(image->machine, 0x800000, size);
822823
823824   /* Skip the logo */
824825   cart_base[0x102] = 1;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team