src/mame/machine/snessdd1.c
| r5795 | r5796 | |
| 537 | 537 | |
| 538 | 538 | static void sdd1_init(running_machine* machine) |
| 539 | 539 | { |
| 540 | UINT8 i; |
| 541 | |
| 542 | snes_sdd1.sdd1_enable = 0x00; |
| 543 | snes_sdd1.xfer_enable = 0x00; |
| 544 | |
| 545 | snes_sdd1.mmc[0] = 0 << 20; |
| 546 | snes_sdd1.mmc[1] = 1 << 20; |
| 547 | snes_sdd1.mmc[2] = 2 << 20; |
| 548 | snes_sdd1.mmc[3] = 3 << 20; |
| 549 | |
| 550 | for(i = 0; i < 8; i++) |
| 551 | { |
| 552 | snes_sdd1.dma[i].addr = 0; |
| 553 | snes_sdd1.dma[i].size = 0; |
| 554 | } |
| 555 | |
| 540 | 556 | snes_sdd1.sdd1emu = SDD1emu_ctor(machine); |
| 557 | |
| 558 | snes_sdd1.buffer.ready = 0; |
| 541 | 559 | } |
| 542 | 560 | |
| 543 | 561 | static UINT8 sdd1_mmio_read(const address_space *space, UINT32 addr) |
| r5795 | r5796 | |
| 631 | 649 | |
| 632 | 650 | static UINT8 sdd1_read(running_machine* machine, UINT32 addr) |
| 633 | 651 | { |
| 652 | unsigned char *ROM; |
| 653 | ROM = memory_region(machine, "cart"); |
| 654 | |
| 634 | 655 | //printf( "sdd1.read(%06x)\n", addr ); |
| 635 | 656 | if(snes_sdd1.sdd1_enable & snes_sdd1.xfer_enable) |
| 636 | 657 | { |
| r5795 | r5796 | |
| 677 | 698 | } // S-DD1 decompressor enabled |
| 678 | 699 | |
| 679 | 700 | //printf( "returning a generic memory read from %06x\n", 0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff) ); |
| 680 | | return snes_ram[0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff)]; |
| 701 | return ROM[snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff)]; |
| 681 | 702 | } |
| 682 | 703 | |
| 683 | 704 | static void sdd1_reset(running_machine *machine) |
src/mess/machine/snescart.c
| r5795 | r5796 | |
| 343 | 343 | UINT8 header[512]; |
| 344 | 344 | UINT8 *temp_buffer = auto_alloc_array(machine, UINT8, 0x410000); |
| 345 | 345 | UINT8 valid_mode20, valid_mode21, valid_mode25; |
| 346 | unsigned char *ROM; |
| 347 | int length; |
| 346 | 348 | |
| 347 | 349 | memory_region_alloc(machine, "maincpu", 0x1000000, 0); |
| 348 | 350 | |
| r5795 | r5796 | |
| 412 | 414 | snes_cart.sram_max = 0x20000; |
| 413 | 415 | } |
| 414 | 416 | |
| 417 | /* Loading data */ |
| 418 | { |
| 419 | ROM = memory_region(image->machine, "cart"); |
| 420 | length = image_fread(image, ROM, image_length(image) - offset); |
| 421 | } |
| 422 | |
| 415 | 423 | /* FIXME: Insert crc check here */ |
| 416 | 424 | |
| 417 | 425 | /* How many blocks of data are available to be loaded? */ |
| r5795 | r5796 | |
| 439 | 447 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 440 | 448 | { |
| 441 | 449 | /* Loading data */ |
| 442 | | image_fread(image, &snes_ram[0xc00000 + read_blocks * 0x10000], 0x10000); |
| 450 | memcpy(&snes_ram[0xc00000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x10000], 0x10000); |
| 443 | 451 | /* Mirroring */ |
| 444 | 452 | memcpy(&snes_ram[0x008000 + read_blocks * 0x10000], &snes_ram[0xc08000 + read_blocks * 0x10000], 0x8000); |
| 445 | 453 | memcpy(&snes_ram[0x400000 + read_blocks * 0x10000], &snes_ram[0xc00000 + read_blocks * 0x10000], 0x10000); |
| r5795 | r5796 | |
| 474 | 482 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 475 | 483 | { |
| 476 | 484 | /* Loading data */ |
| 477 | | image_fread(image, &snes_ram[0xc00000 + read_blocks * 0x10000], 0x10000); |
| 485 | memcpy(&snes_ram[0xc00000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x10000], 0x10000); |
| 478 | 486 | /* Mirroring */ |
| 479 | 487 | memcpy( &snes_ram[0x808000 + read_blocks * 0x10000], &snes_ram[0xc08000 + read_blocks * 0x10000], 0x8000); |
| 480 | 488 | read_blocks++; |
| r5795 | r5796 | |
| 492 | 500 | while (read_blocks < 64 && read_blocks < (total_blocks - 64)) |
| 493 | 501 | { |
| 494 | 502 | /* Loading data */ |
| 495 | | image_fread(image, &snes_ram[0x400000 + read_blocks * 0x10000], 0x10000); |
| 503 | memcpy(&snes_ram[0x400000 + read_blocks * 0x10000], &ROM[0x400000 + read_blocks * 0x10000], 0x10000); |
| 496 | 504 | /* Mirroring */ |
| 497 | 505 | memcpy(&snes_ram[0x8000 + read_blocks * 0x10000], &snes_ram[0x408000 + read_blocks * 0x10000], 0x8000); |
| 498 | 506 | read_blocks++; |
| r5795 | r5796 | |
| 522 | 530 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 523 | 531 | { |
| 524 | 532 | /* Loading data */ |
| 525 | | image_fread( image, &snes_ram[0x8000 + read_blocks * 0x10000], 0x8000); |
| 533 | memcpy(&snes_ram[0x008000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x8000], 0x8000); |
| 526 | 534 | /* Mirroring */ |
| 527 | 535 | memcpy(&snes_ram[0x400000 + read_blocks * 0x10000], &snes_ram[0x8000 + read_blocks * 0x10000], 0x8000); |
| 528 | 536 | memcpy(&snes_ram[0x408000 + read_blocks * 0x10000], &snes_ram[0x8000 + read_blocks * 0x10000], 0x8000); |
| r5795 | r5796 | |
| 552 | 560 | /* LoROM carts load data in banks 0x00 to 0x7f at address 0x8000 (actually up to 0x7d, because 0x7e and |
| 553 | 561 | * 0x7f are overwritten by WRAM). Each block is also mirrored in banks 0x80 to 0xff (up to 0xff for real) |
| 554 | 562 | */ |
| 555 | | if((temp_buffer[0x007fd6] >= 0x13 && temp_buffer[0x007fd6] <= 0x15) || temp_buffer[0x007fd6] == 0xa) |
| 563 | /* SuperFX games needs a different loading routine */ |
| 564 | if(((temp_buffer[0x007fd6] >= 0x13 && temp_buffer[0x007fd6] <= 0x15) || temp_buffer[0x007fd6] == 0x1a) && (temp_buffer[0x007fd5] == 0x20)) |
| 556 | 565 | { |
| 557 | 566 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 558 | 567 | { |
| 559 | 568 | /* Loading data primary: banks 0-3f from 8000-ffff*/ |
| 560 | | image_fread(image, &snes_ram[0x8000 + read_blocks * 0x10000], 0x8000); |
| 569 | memcpy(&snes_ram[0x008000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x8000], 0x8000); |
| 561 | 570 | /* Mirroring at banks 80-bf from 8000-ffff */ |
| 562 | | memcpy(&snes_ram[0x808000 + (read_blocks * 0x10000)], &snes_ram[0x8000 + (read_blocks * 0x10000)], 0x8000); |
| 571 | memcpy(&snes_ram[0x808000 + read_blocks * 0x10000], &snes_ram[0x8000 + (read_blocks * 0x10000)], 0x8000); |
| 563 | 572 | read_blocks++; |
| 564 | 573 | } |
| 565 | | |
| 566 | | image_fseek(image, offset, SEEK_SET); |
| 567 | 574 | /* Loading data secondary, filling full 64k banks from 0x400000 to 600000 */ |
| 568 | | image_fread(image, &snes_ram[0x400000], total_blocks * 0x8000); |
| 575 | memcpy(&snes_ram[0x400000], &ROM[0x000000], total_blocks * 0x8000); |
| 569 | 576 | /* mirror at c00000-e00000 */ |
| 570 | | memcpy( &snes_ram[0xc00000], &snes_ram[0x400000], total_blocks * 0x8000); |
| 577 | memcpy(&snes_ram[0xc00000], &snes_ram[0x400000], total_blocks * 0x8000); |
| 571 | 578 | } |
| 572 | 579 | else |
| 573 | 580 | { |
| 574 | 581 | while (read_blocks < 128 && read_blocks < total_blocks) |
| 575 | 582 | { |
| 576 | 583 | /* Loading data */ |
| 577 | | image_fread(image, &snes_ram[0x8000 + read_blocks * 0x10000], 0x8000); |
| 584 | memcpy(&snes_ram[0x008000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x8000], 0x8000); |
| 578 | 585 | /* Mirroring */ |
| 579 | | memcpy(&snes_ram[0x808000 + (read_blocks * 0x10000)], &snes_ram[0x8000 + (read_blocks * 0x10000)], 0x8000); |
| 586 | memcpy(&snes_ram[0x808000 + read_blocks * 0x10000], &snes_ram[0x8000 + (read_blocks * 0x10000)], 0x8000); |
| 580 | 587 | read_blocks++; |
| 581 | 588 | } |
| 582 | 589 | /* Filling banks up to 0x7f and their mirrors */ |
src/mess/drivers/snes.c
| r5795 | r5796 | |
| 34 | 34 | #include "includes/snes.h" |
| 35 | 35 | #include "machine/snescart.h" |
| 36 | 36 | |
| 37 | #define MAX_SNES_CART_SIZE 0x600000 |
| 37 | 38 | |
| 38 | 39 | /************************************* |
| 39 | 40 | * |
| r5795 | r5796 | |
| 278 | 279 | ROM_REGION( 0x1000, "addons", 0 ) /* add-on chip ROMs (DSP, SFX, etc) */ |
| 279 | 280 | ROM_LOAD( "dsp1data.bin", 0x000000, 0x000800, CRC(4b02d66d) SHA1(1534f4403d2a0f68ba6e35186fe7595d33de34b1) ) |
| 280 | 281 | ROM_LOAD( "dsp3data.bin", 0x000800, 0x000800, CRC(4a1c5453) SHA1(2f69c652109938cde21df5eb89890bf090256dbb) ) |
| 282 | ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 ) |
| 281 | 283 | ROM_END |
| 282 | 284 | |
| 283 | 285 | ROM_START(snessfx) |
| r5795 | r5796 | |
| 285 | 287 | ROM_LOAD( "spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */ |
| 286 | 288 | ROM_REGION( 0x1000, "addons", 0 ) /* add-on chip ROMs (DSP, SFX, etc) */ |
| 287 | 289 | ROM_LOAD( "dsp1data.bin", 0x000000, 0x000800, CRC(4b02d66d) SHA1(1534f4403d2a0f68ba6e35186fe7595d33de34b1) ) |
| 290 | ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 ) |
| 288 | 291 | ROM_END |
| 289 | 292 | |
| 290 | 293 | ROM_START(snespal) |
| r5795 | r5796 | |
| 293 | 296 | ROM_REGION( 0x1000, "addons", 0 ) /* add-on chip ROMs (DSP, SFX, etc) */ |
| 294 | 297 | ROM_LOAD( "dsp1data.bin", 0x000000, 0x000800, CRC(4b02d66d) SHA1(1534f4403d2a0f68ba6e35186fe7595d33de34b1) ) |
| 295 | 298 | ROM_LOAD( "dsp3data.bin", 0x000800, 0x000800, CRC(4a1c5453) SHA1(2f69c652109938cde21df5eb89890bf090256dbb) ) |
| 299 | ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 ) |
| 296 | 300 | ROM_END |
| 297 | 301 | |
| 298 | 302 | ROM_START(snespsfx) |
| r5795 | r5796 | |
| 300 | 304 | ROM_LOAD( "spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */ |
| 301 | 305 | ROM_REGION( 0x1000, "addons", 0 ) /* add-on chip ROMs (DSP, SFX, etc) */ |
| 302 | 306 | ROM_LOAD( "dsp1data.bin", 0x000000, 0x000800, CRC(4b02d66d) SHA1(1534f4403d2a0f68ba6e35186fe7595d33de34b1) ) |
| 307 | ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 ) |
| 303 | 308 | ROM_END |
| 304 | 309 | |
| 305 | 310 | ROM_START(sfcbox) |
| r5795 | r5796 | |
| 315 | 320 | ROM_LOAD( "spc700.rom", 0x00, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */ |
| 316 | 321 | |
| 317 | 322 | ROM_REGION( 0x1000, "addons", ROMREGION_ERASE00 ) /* add-on chip ROMs (DSP, SFX, etc) */ |
| 323 | ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 ) |
| 318 | 324 | ROM_END |
| 319 | 325 | |
| 320 | 326 | /*************************************************************************** |