src/mess/drivers/jaguar.c
| r8031 | r8032 | |
| 640 | 640 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 641 | 641 | |
| 642 | 642 | /* quickload */ |
| 643 | | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof", 0) |
| 643 | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof,abs", 0) |
| 644 | 644 | |
| 645 | 645 | /* cartridge */ |
| 646 | 646 | MDRV_CARTSLOT_ADD("cart") |
| 647 | | MDRV_CARTSLOT_EXTENSION_LIST("jag,abs,rom,j64,j01") |
| 647 | MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64,j01") |
| 648 | 648 | MDRV_CARTSLOT_INTERFACE("jaguar_cart") |
| 649 | 649 | MDRV_CARTSLOT_LOAD(jaguar) |
| 650 | 650 | |
| r8031 | r8032 | |
| 685 | 685 | * |
| 686 | 686 | *************************************/ |
| 687 | 687 | |
| 688 | static 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 | |
| 688 | 706 | static DRIVER_INIT( jaguar ) |
| 689 | 707 | { |
| 690 | 708 | state_save_register_global(machine, joystick_data); |
| r8031 | r8032 | |
| 692 | 710 | |
| 693 | 711 | static QUICKLOAD_LOAD( jaguar ) |
| 694 | 712 | { |
| 695 | | int i,j; |
| 696 | 713 | offs_t quickload_begin = 0x4000; |
| 697 | 714 | memset(jaguar_shared_ram, 0, 0x200000); |
| 698 | 715 | quickload_size = MIN(quickload_size, 0x200000 - quickload_begin); |
| 699 | 716 | |
| 700 | 717 | image_fread(image, &memory_region(image->machine, "maincpu")[quickload_begin], quickload_size); |
| 701 | 718 | |
| 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)) |
| 704 | 722 | { |
| 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); |
| 707 | 733 | } |
| 708 | | |
| 709 | | if (!mame_stricmp(image_filetype(image), "prg")) |
| 734 | else |
| 735 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000) |
| 710 | 736 | { |
| 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); |
| 729 | 744 | } |
| 730 | 745 | else |
| 731 | | if (!mame_stricmp(image_filetype(image), "cof")) |
| 746 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000) |
| 732 | 747 | { |
| 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); |
| 748 | 755 | } |
| 749 | 756 | |
| 750 | 757 | |
| r8031 | r8032 | |
| 812 | 819 | } |
| 813 | 820 | } |
| 814 | 821 | 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); |
| 822 | 823 | |
| 823 | 824 | /* Skip the logo */ |
| 824 | 825 | cart_base[0x102] = 1; |