src/mess/drivers/jaguar.c
| r8029 | r8030 | |
| 640 | 640 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 641 | 641 | |
| 642 | 642 | /* quickload */ |
| 643 | | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin", 0) |
| 643 | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof", 0) |
| 644 | 644 | |
| 645 | 645 | /* cartridge */ |
| 646 | 646 | MDRV_CARTSLOT_ADD("cart") |
| r8029 | r8030 | |
| 696 | 696 | offs_t quickload_begin = 0x4000; |
| 697 | 697 | memset(jaguar_shared_ram, 0, 0x200000); |
| 698 | 698 | quickload_size = MIN(quickload_size, 0x200000 - quickload_begin); |
| 699 | |
| 699 | 700 | image_fread(image, &memory_region(image->machine, "maincpu")[quickload_begin], quickload_size); |
| 700 | 701 | |
| 701 | 702 | /* Fix endian-ness */ |
| r8029 | r8030 | |
| 705 | 706 | jaguar_shared_ram[i] = ((j & 0xff) << 24) | ((j & 0xff00) << 8) | ((j & 0xff0000) >> 8) | ((j & 0xff000000) >> 24); |
| 706 | 707 | } |
| 707 | 708 | |
| 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 | |
| 708 | 751 | /* Transfer control to image */ |
| 709 | 752 | cpu_set_reg(devtag_get_device(image->machine, "maincpu"), REG_GENPC, quickload_begin); |
| 710 | 753 | return INIT_PASS; |
| r8029 | r8030 | |
| 712 | 755 | |
| 713 | 756 | static DEVICE_IMAGE_LOAD( jaguar ) |
| 714 | 757 | { |
| 715 | | int i, j, offset = 0; |
| 716 | | UINT32 size; |
| 758 | int i, j, load_skip = 0; |
| 759 | UINT32 size, load_offset = 0; |
| 717 | 760 | UINT8 header[512]; |
| 718 | 761 | |
| 719 | 762 | if (image_software_entry(image) == NULL) |
| 720 | 763 | { |
| 721 | 764 | size = image_length(image); |
| 722 | 765 | |
| 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")) |
| 725 | 768 | { |
| 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 */ |
| 728 | 772 | } |
| 773 | else |
| 729 | 774 | |
| 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); |
| 731 | 785 | } |
| 732 | 786 | else |
| 733 | 787 | { |
| r8029 | r8030 | |
| 736 | 790 | /* skip header, if any */ |
| 737 | 791 | if ((size & 0x200) == 0x200) |
| 738 | 792 | { |
| 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); |
| 741 | 795 | } |
| 742 | 796 | |
| 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); |
| 744 | 798 | } |
| 745 | 799 | |
| 746 | 800 | memset(jaguar_shared_ram, 0, 0x200000); |
| 747 | 801 | memcpy(jaguar_shared_ram, rom_base, 0x10); |
| 748 | 802 | |
| 749 | 803 | /* 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 */ |
| 751 | 806 | if (image_software_entry(image) == NULL && !mame_stricmp(image_filetype(image), "j01")) |
| 752 | 807 | { |
| 753 | 808 | for (i = 0; i < size / 4; i++) |