Previous 15994 Revisions Next

r3413 Wednesday 8th October, 2008 at 10:33:10 UTC by Fabio Priuli
[FAMICOM] Fixed bug #1479. Disks work again.
[docs]messnew.txt
[src/mess/machine]nes.c

src/mess/machine/nes.c
r3412r3413
88#include "hash.h"
99
1010
11
1211/***************************************************************************
1312    CONSTANTS
1413***************************************************************************/
r3412r3413
9089   {
9190      case 20:
9291         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 );
9497         memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4030, 0x403f, 0, 0, fds_r);
9598         memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0xdfff, 0, 0, SMH_BANK2);
9699         memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK1);
r3412r3413
406409
407410
408411
409DEVICE_IMAGE_LOAD(nes_cart)
412DEVICE_IMAGE_LOAD( nes_cart )
410413{
411414   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;
413416   char magic[4];
414417   char skank[8];
415418   int local_options = 0;
r3412r3413
420423   memset(magic, '\0', sizeof(magic));
421424   image_fread(image, magic, 4);
422425
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   }
427431
428432   mapinfo = image_extrainfo(image);
433
429434   if (mapinfo)
430435   {
431436      if (4 == sscanf(mapinfo,"%d %d %d %d",&mapint1,&mapint2,&mapint3,&mapint4))
r3412r3413
436441         nes.chr_chunks = mapint4;
437442         logerror("NES.CRC info: %d %d %d %d\n",mapint1,mapint2,mapint3,mapint4);
438443         goodcrcinfo = 1;
439      } else
444      }
445      else
440446      {
441447         logerror("NES: [%s], Invalid mapinfo found\n",mapinfo);
442448      }
443   } else
449   }
450   else
444451   {
445452      logerror("NES: No extrainfo found\n");
446453   }
454
447455   if (!goodcrcinfo)
448456   {
449457      // image_extrainfo() resets the file position back to start.
r3412r3413
496504   memory_region_free (image->machine, "gfx1");
497505
498506   /* 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);
500508   if (nes.chr_chunks)
501509      memory_region_alloc(image->machine, "gfx1", nes.chr_chunks * 0x2000,0);
502510
r3412r3413
544552
545553   logerror("**\n");
546554   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);
548556
549557   /* Read in any chr chunks */
550558   if (nes.chr_chunks > 0)
r3412r3413
554562         logerror("Warning: VROM has been found in VRAM-based mapper. Either the mapper is set wrong or the ROM image is incorrect.\n");
555563   }
556564
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);
558566   logerror("**\n");
559567
560568   /* Attempt to load a battery file for this ROM. If successful, we */
r3412r3413
563571      image_battery_load(image, battery_data, BATTERY_SIZE);
564572
565573   return INIT_PASS;
566
567bad:
568   logerror("BAD section hit during LOAD ROM.\n");
569   return INIT_FAIL;
570574}
571575
572576
r3412r3413
603607
604608   /* See if it has a  redundant header on it */
605609   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'))
609611   {
610612      /* Skip past the redundant header */
611613      image_fseek (image, 0x10, SEEK_SET);
r3412r3413
621623      nes_fds.data = image_realloc(image, nes_fds.data, nes_fds.sides * 65500);
622624      if (!nes_fds.data)
623625         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);
625627   }
626628
627629   logerror("Number of sides: %d\n", nes_fds.sides);
docs/messnew.txt
r3412r3413
113113
114114- [EXIDY] Added support for 1200 baud cassette images. [Wilbert Pol]
115115
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
116120- [GENESIS / MD] Added possibility to choose between a 3 buttons and a 6
117121  buttons Joypad. [Fabio Priuli]
118122
119123- [GENEVE] Fixed RTC to start on Sunday.  [Michael Zapf]
120124
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]
123127
124128- [LYNX] Added support for images in .lyx format [Fabio Priuli]
125129
r3412r3413
146150  loaded. [Curt Coder]
147151
148152- [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]
151155
152156- [SNES] Fixed inputs in Super Street Fighter 2 (bug #437) [Fabio Priuli]
153157
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]
156160
157161- [SPECTRUM] Added lot of Spectrum clones and custom ROM's [Miodrag Milanovic]
158162
r3412r3413
165169
166170- [TMC2000] Fixed quickloading. [Curt Coder]
167171
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]
170174
171175- [VIC20] Added support for tape emulation using MESS core functions
172176  (loading and saving, both .wav and .tap formats) [Fabio Priuli]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team