src/mess/drivers/jaguar.c
| r8038 | r8039 | |
| 640 | 640 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 641 | 641 | |
| 642 | 642 | /* quickload */ |
| 643 | | MDRV_QUICKLOAD_ADD("quickload", jaguar, "bin,bjl,prg,cof,abs", 0) |
| 643 | MDRV_QUICKLOAD_ADD("quickload", jaguar, "abs,bin,cof,jag,prg", 0) |
| 644 | 644 | |
| 645 | 645 | /* cartridge */ |
| 646 | 646 | MDRV_CARTSLOT_ADD("cart") |
| 647 | | MDRV_CARTSLOT_EXTENSION_LIST("jag,rom,j64") |
| 647 | MDRV_CARTSLOT_EXTENSION_LIST("j64,jag,rom") |
| 648 | 648 | MDRV_CARTSLOT_INTERFACE("jaguar_cart") |
| 649 | 649 | MDRV_CARTSLOT_LOAD(jaguar) |
| 650 | 650 | |
| r8038 | r8039 | |
| 690 | 690 | UINT8 j[4], *RAM = memory_region(machine, "maincpu"); |
| 691 | 691 | UINT32 i; |
| 692 | 692 | size += addr; |
| 693 | logerror("File Loaded to address range %X to %X\n",addr,size-1); |
| 693 | 694 | for (i = addr; i < size; i+=4) |
| 694 | 695 | { |
| 695 | 696 | j[0] = RAM[i]; |
| r8038 | r8039 | |
| 710 | 711 | |
| 711 | 712 | static QUICKLOAD_LOAD( jaguar ) |
| 712 | 713 | { |
| 713 | | offs_t quickload_begin = 0x4000; |
| 714 | offs_t quickload_begin = 0x4000, start = quickload_begin, skip = 0; |
| 714 | 715 | memset(jaguar_shared_ram, 0, 0x200000); |
| 715 | 716 | quickload_size = MIN(quickload_size, 0x200000 - quickload_begin); |
| 716 | 717 | |
| r8038 | r8039 | |
| 722 | 723 | /* COF */ |
| 723 | 724 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x01500000) |
| 724 | 725 | { |
| 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); |
| 726 | start = jaguar_shared_ram[0x100e]; |
| 727 | skip = jaguar_shared_ram[0x1011]; |
| 732 | 728 | } |
| 733 | 729 | else /* PRG */ |
| 734 | 730 | if (((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601A0000) && (jaguar_shared_ram[0x1007] == 0x4A414752)) |
| 735 | 731 | { |
| 736 | 732 | UINT32 type = jaguar_shared_ram[0x1008] >> 16; |
| 737 | | UINT32 start = ((jaguar_shared_ram[0x1008] & 0xffff) << 16) | (jaguar_shared_ram[0x1009] >> 16); |
| 738 | | UINT32 skip = 28; |
| 733 | start = ((jaguar_shared_ram[0x1008] & 0xffff) << 16) | (jaguar_shared_ram[0x1009] >> 16); |
| 734 | skip = 28; |
| 739 | 735 | if (type == 2) skip = 42; |
| 740 | | if (type == 3) skip = 46; |
| 741 | | memset(jaguar_shared_ram, 0, 0x200000); |
| 742 | | image_fseek(image, 0, SEEK_SET); |
| 743 | | image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size); |
| 744 | | quickload_begin = start; |
| 745 | | jaguar_fix_endian(image->machine, (start-skip)&0xfffffc, quickload_size); |
| 736 | else if (type == 3) skip = 46; |
| 746 | 737 | } |
| 747 | | else /* ABS */ |
| 738 | else /* ABS with header */ |
| 748 | 739 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x601B0000) |
| 749 | 740 | { |
| 750 | | UINT32 start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16); |
| 751 | | UINT32 skip = 0xd0; |
| 741 | start = ((jaguar_shared_ram[0x1005] & 0xffff) << 16) | (jaguar_shared_ram[0x1006] >> 16); |
| 742 | skip = 36; |
| 743 | } |
| 744 | |
| 745 | else /* ABS binary */ |
| 746 | if (!mame_stricmp(image_filetype(image), "abs")) |
| 747 | start = 0xc000; |
| 748 | |
| 749 | else /* 0x5000 binary */ |
| 750 | if (!mame_stricmp(image_filetype(image), "jag")) |
| 751 | start = 0x5000; |
| 752 | |
| 753 | else /* A header used by Badcoder */ |
| 754 | if ((jaguar_shared_ram[0x1000] & 0xffff0000) == 0x72000000) |
| 755 | skip = 96; |
| 756 | |
| 757 | /* Now that we have the info, reload the file */ |
| 758 | if ((start != quickload_begin) || (skip)) |
| 759 | { |
| 752 | 760 | memset(jaguar_shared_ram, 0, 0x200000); |
| 753 | 761 | image_fseek(image, 0, SEEK_SET); |
| 754 | 762 | image_fread(image, &memory_region(image->machine, "maincpu")[start-skip], quickload_size); |
| r8038 | r8039 | |
| 757 | 765 | } |
| 758 | 766 | |
| 759 | 767 | |
| 768 | /* Some programs are too lazy to set a stack pointer */ |
| 769 | cpu_set_reg(devtag_get_device(image->machine, "maincpu"), REG_GENSP, 0x1000); |
| 770 | jaguar_shared_ram[0]=0x1000; |
| 771 | |
| 760 | 772 | /* Transfer control to image */ |
| 761 | 773 | cpu_set_reg(devtag_get_device(image->machine, "maincpu"), REG_GENPC, quickload_begin); |
| 774 | jaguar_shared_ram[1]=quickload_begin; |
| 762 | 775 | return INIT_PASS; |
| 763 | 776 | } |
| 764 | 777 | |