src/mess/machine/nes.c
| r3412 | r3413 | |
| 8 | 8 | #include "hash.h" |
| 9 | 9 | |
| 10 | 10 | |
| 11 | | |
| 12 | 11 | /*************************************************************************** |
| 13 | 12 | CONSTANTS |
| 14 | 13 | ***************************************************************************/ |
| r3412 | r3413 | |
| 90 | 89 | { |
| 91 | 90 | case 20: |
| 92 | 91 | nes.slow_banking = 0; |
| 93 | | nes_fds.data = auto_malloc( 0x8000 ); |
| 92 | /* If we are loading a disk we have already filled nes_fds.data and we don't want to overwrite it, |
| 93 | if we are loading a cart image identified as mapper 20 (probably wrong mapper...) we need to alloc |
| 94 | memory for the bank 2 pointer */ |
| 95 | if (nes_fds.data == NULL) |
| 96 | nes_fds.data = auto_malloc( 0x8000 ); |
| 94 | 97 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4030, 0x403f, 0, 0, fds_r); |
| 95 | 98 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0xdfff, 0, 0, SMH_BANK2); |
| 96 | 99 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK1); |
| r3412 | r3413 | |
| 406 | 409 | |
| 407 | 410 | |
| 408 | 411 | |
| 409 | | DEVICE_IMAGE_LOAD(nes_cart) |
| 412 | DEVICE_IMAGE_LOAD( nes_cart ) |
| 410 | 413 | { |
| 411 | 414 | const char *mapinfo; |
| 412 | | int mapint1=0,mapint2=0,mapint3=0,mapint4=0,goodcrcinfo = 0; |
| 415 | int mapint1 = 0, mapint2 = 0, mapint3 = 0, mapint4 = 0, goodcrcinfo = 0; |
| 413 | 416 | char magic[4]; |
| 414 | 417 | char skank[8]; |
| 415 | 418 | int local_options = 0; |
| r3412 | r3413 | |
| 420 | 423 | memset(magic, '\0', sizeof(magic)); |
| 421 | 424 | image_fread(image, magic, 4); |
| 422 | 425 | |
| 423 | | if ((magic[0] != 'N') || |
| 424 | | (magic[1] != 'E') || |
| 425 | | (magic[2] != 'S')) |
| 426 | | goto bad; |
| 426 | if ((magic[0] != 'N') || (magic[1] != 'E') || (magic[2] != 'S')) |
| 427 | { |
| 428 | logerror("BAD section hit during LOAD ROM.\n"); |
| 429 | return INIT_FAIL; |
| 430 | } |
| 427 | 431 | |
| 428 | 432 | mapinfo = image_extrainfo(image); |
| 433 | |
| 429 | 434 | if (mapinfo) |
| 430 | 435 | { |
| 431 | 436 | if (4 == sscanf(mapinfo,"%d %d %d %d",&mapint1,&mapint2,&mapint3,&mapint4)) |
| r3412 | r3413 | |
| 436 | 441 | nes.chr_chunks = mapint4; |
| 437 | 442 | logerror("NES.CRC info: %d %d %d %d\n",mapint1,mapint2,mapint3,mapint4); |
| 438 | 443 | goodcrcinfo = 1; |
| 439 | | } else |
| 444 | } |
| 445 | else |
| 440 | 446 | { |
| 441 | 447 | logerror("NES: [%s], Invalid mapinfo found\n",mapinfo); |
| 442 | 448 | } |
| 443 | | } else |
| 449 | } |
| 450 | else |
| 444 | 451 | { |
| 445 | 452 | logerror("NES: No extrainfo found\n"); |
| 446 | 453 | } |
| 454 | |
| 447 | 455 | if (!goodcrcinfo) |
| 448 | 456 | { |
| 449 | 457 | // image_extrainfo() resets the file position back to start. |
| r3412 | r3413 | |
| 496 | 504 | memory_region_free (image->machine, "gfx1"); |
| 497 | 505 | |
| 498 | 506 | /* Allocate them again with the proper size */ |
| 499 | | memory_region_alloc(image->machine, "main", 0x10000 + (nes.prg_chunks+1) * 0x4000,0); |
| 507 | memory_region_alloc(image->machine, "main", 0x10000 + (nes.prg_chunks + 1) * 0x4000,0); |
| 500 | 508 | if (nes.chr_chunks) |
| 501 | 509 | memory_region_alloc(image->machine, "gfx1", nes.chr_chunks * 0x2000,0); |
| 502 | 510 | |
| r3412 | r3413 | |
| 544 | 552 | |
| 545 | 553 | logerror("**\n"); |
| 546 | 554 | logerror("Mapper: %d\n", nes.mapper); |
| 547 | | logerror("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000*nes.prg_chunks); |
| 555 | logerror("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks); |
| 548 | 556 | |
| 549 | 557 | /* Read in any chr chunks */ |
| 550 | 558 | if (nes.chr_chunks > 0) |
| r3412 | r3413 | |
| 554 | 562 | logerror("Warning: VROM has been found in VRAM-based mapper. Either the mapper is set wrong or the ROM image is incorrect.\n"); |
| 555 | 563 | } |
| 556 | 564 | |
| 557 | | logerror("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000*nes.chr_chunks); |
| 565 | logerror("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks); |
| 558 | 566 | logerror("**\n"); |
| 559 | 567 | |
| 560 | 568 | /* Attempt to load a battery file for this ROM. If successful, we */ |
| r3412 | r3413 | |
| 563 | 571 | image_battery_load(image, battery_data, BATTERY_SIZE); |
| 564 | 572 | |
| 565 | 573 | return INIT_PASS; |
| 566 | | |
| 567 | | bad: |
| 568 | | logerror("BAD section hit during LOAD ROM.\n"); |
| 569 | | return INIT_FAIL; |
| 570 | 574 | } |
| 571 | 575 | |
| 572 | 576 | |
| r3412 | r3413 | |
| 603 | 607 | |
| 604 | 608 | /* See if it has a redundant header on it */ |
| 605 | 609 | image_fread(image, magic, 4); |
| 606 | | if ((magic[0] == 'F') && |
| 607 | | (magic[1] == 'D') && |
| 608 | | (magic[2] == 'S')) |
| 610 | if ((magic[0] == 'F') && (magic[1] == 'D') && (magic[2] == 'S')) |
| 609 | 611 | { |
| 610 | 612 | /* Skip past the redundant header */ |
| 611 | 613 | image_fseek (image, 0x10, SEEK_SET); |
| r3412 | r3413 | |
| 621 | 623 | nes_fds.data = image_realloc(image, nes_fds.data, nes_fds.sides * 65500); |
| 622 | 624 | if (!nes_fds.data) |
| 623 | 625 | return INIT_FAIL; |
| 624 | | image_fread (image, nes_fds.data + ((nes_fds.sides-1) * 65500), 65500); |
| 626 | image_fread (image, nes_fds.data + ((nes_fds.sides - 1) * 65500), 65500); |
| 625 | 627 | } |
| 626 | 628 | |
| 627 | 629 | logerror("Number of sides: %d\n", nes_fds.sides); |
docs/messnew.txt
| r3412 | r3413 | |
| 113 | 113 | |
| 114 | 114 | - [EXIDY] Added support for 1200 baud cassette images. [Wilbert Pol] |
| 115 | 115 | |
| 116 | - [FAMICOM] Fixed small Disk loading bug which caused "Disk Trouble Err. |
| 117 | 22" with all disk images (remaining part of bug #1479). Famicom Disk |
| 118 | System is back to working status [Fabio Priuli] |
| 119 | |
| 116 | 120 | - [GENESIS / MD] Added possibility to choose between a 3 buttons and a 6 |
| 117 | 121 | buttons Joypad. [Fabio Priuli] |
| 118 | 122 | |
| 119 | 123 | - [GENEVE] Fixed RTC to start on Sunday. [Michael Zapf] |
| 120 | 124 | |
| 121 | | - [INTV] Added partial support for images in .int/.itv/.bin format. Images in .rom |
| 122 | | format are still preferred. [Fabio Priuli] |
| 125 | - [INTV] Added partial support for images in .int/.itv/.bin format. Images |
| 126 | in .rom format are still preferred. [Fabio Priuli] |
| 123 | 127 | |
| 124 | 128 | - [LYNX] Added support for images in .lyx format [Fabio Priuli] |
| 125 | 129 | |
| r3412 | r3413 | |
| 146 | 150 | loaded. [Curt Coder] |
| 147 | 151 | |
| 148 | 152 | - [SNES] Improved special chips detection (if you run MESS with -log you will |
| 149 | | be warned of the presence of unemulated chips in error.log), memory handling, |
| 150 | | cart and SRAM mirroring [Fabio Priuli] |
| 153 | be warned of the presence of unemulated chips in error.log), memory |
| 154 | handling, cart and SRAM mirroring [Fabio Priuli] |
| 151 | 155 | |
| 152 | 156 | - [SNES] Fixed inputs in Super Street Fighter 2 (bug #437) [Fabio Priuli] |
| 153 | 157 | |
| 154 | | - [SNES] Added support for the emulation of the DSP-2 and OBC-1 add-on chips. Code |
| 155 | | based on byuu's implementation in BSNES (thanks byuu) [Fabio Priuli] |
| 158 | - [SNES] Added support for the emulation of the DSP-2 and OBC-1 add-on chips. |
| 159 | Code based on byuu's implementation in BSNES (thanks byuu) [Fabio Priuli] |
| 156 | 160 | |
| 157 | 161 | - [SPECTRUM] Added lot of Spectrum clones and custom ROM's [Miodrag Milanovic] |
| 158 | 162 | |
| r3412 | r3413 | |
| 165 | 169 | |
| 166 | 170 | - [TMC2000] Fixed quickloading. [Curt Coder] |
| 167 | 171 | |
| 168 | | - [TRS80] Added proper cassette emulation support (both .wav and .cas. formats) |
| 169 | | [Wilbert Pol] |
| 172 | - [TRS80] Added proper cassette emulation support (both .wav and .cas. |
| 173 | formats) [Wilbert Pol] |
| 170 | 174 | |
| 171 | 175 | - [VIC20] Added support for tape emulation using MESS core functions |
| 172 | 176 | (loading and saving, both .wav and .tap formats) [Fabio Priuli] |