src/mess/drivers/jaguar.c
| r8035 | r8036 | |
| 640 | 640 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 641 | 641 | |
| 642 | 642 | /* quickload */ |
| 643 | | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,prg,cof,abs", 0) |
| 643 | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,bjl,prg,cof,abs", 0) |
| 644 | 644 | |
| 645 | 645 | /* cartridge */ |
| 646 | 646 | MDRV_CARTSLOT_ADD("cart") |
| 647 | | MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64,j01") |
| 647 | MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64") |
| 648 | 648 | MDRV_CARTSLOT_INTERFACE("jaguar_cart") |
| 649 | 649 | MDRV_CARTSLOT_LOAD(jaguar) |
| 650 | 650 | |
| r8035 | r8036 | |
| 718 | 718 | |
| 719 | 719 | jaguar_fix_endian(image->machine, quickload_begin, quickload_size); |
| 720 | 720 | |
| 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 */ |
| 721 | 734 | if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752)) |
| 722 | 735 | { |
| 723 | 736 | UINT32 type = jaguar_shared_ram[0x1008] >> 16; |
| r8035 | r8036 | |
| 729 | 742 | image_fseek(image, 0, SEEK_SET); |
| 730 | 743 | image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size); |
| 731 | 744 | quickload_begin = start; |
| 732 | | jaguar_fix_endian(image->machine, quickload_begin, quickload_size); |
| 745 | jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size); |
| 733 | 746 | } |
| 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 */ |
| 746 | 748 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000) |
| 747 | 749 | { |
| 748 | 750 | UINT32 start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16); |
| r8035 | r8036 | |
| 751 | 753 | image_fseek(image, 0, SEEK_SET); |
| 752 | 754 | image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size); |
| 753 | 755 | quickload_begin = start; |
| 754 | | jaguar_fix_endian(image->machine, quickload_begin, quickload_size); |
| 756 | jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size); |
| 755 | 757 | } |
| 756 | 758 | |
| 757 | 759 | |
| r8035 | r8036 | |
| 762 | 764 | |
| 763 | 765 | static DEVICE_IMAGE_LOAD( jaguar ) |
| 764 | 766 | { |
| 765 | | int i, j; |
| 766 | 767 | UINT32 size, load_offset = 0, load_skip = 0; |
| 767 | | UINT8 header[512]; |
| 768 | 768 | |
| 769 | 769 | if (image_software_entry(image) == NULL) |
| 770 | 770 | { |
| r8035 | r8036 | |
| 773 | 773 | /* .rom files load & run at 802000 */ |
| 774 | 774 | if (!mame_stricmp(image_filetype(image), "rom")) |
| 775 | 775 | { |
| 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 |
| 779 | 778 | } |
| 780 | 779 | else |
| 781 | 780 | |
| r8035 | r8036 | |
| 785 | 784 | |
| 786 | 785 | /* Skip any header */ |
| 787 | 786 | if (load_skip) |
| 788 | | image_fread(image, header, load_skip); |
| 787 | image_fseek(image, load_skip, SEEK_SET); |
| 789 | 788 | |
| 790 | 789 | /* Load cart into memory */ |
| 791 | 790 | image_fread(image, &memory_region(image->machine, "maincpu")[0x800000+load_offset], size - load_skip); |
| r8035 | r8036 | |
| 795 | 794 | size = image_get_software_region_length(image, "rom"); |
| 796 | 795 | |
| 797 | 796 | /* 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 | // } |
| 803 | 802 | |
| 804 | 803 | memcpy(cart_base, image_get_software_region(image, "rom") + load_skip, size - load_skip); |
| 805 | 804 | } |
| r8035 | r8036 | |
| 807 | 806 | memset(jaguar_shared_ram, 0, 0x200000); |
| 808 | 807 | memcpy(jaguar_shared_ram, rom_base, 0x10); |
| 809 | 808 | |
| 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); |
| 823 | 810 | |
| 824 | 811 | /* Skip the logo */ |
| 825 | 812 | cart_base[0x102] = 1; |