Previous 15994 Revisions Next

r6028 Saturday 10th October, 2009 at 08:27:03 UTC by Fabio Priuli
[NES] updated known bug list and added VERY preliminary unif support
[hash]nes.hsi
[src/mess/machine]nes.c nes_mmc.c

hash/nes.hsi
r6027r6028
2268122681   </hash>
2268222682   <hash crc32="1bc686a8" sha1="334781c830f135cf30a33e392d8aaa4afdc223f9" name="Fire Hawk (Camerica)">
2268322683      <status>GoodNES Verified Image</status>
22684      <extrainfo>71 0 8 0</extrainfo>
22684      <extrainfo>71 128 8 0</extrainfo>
2268522685
2268622686   </hash>
2268722687   <hash crc32="827bfda8" sha1="a0236196f983960f18396b4635ef7c54f3614542" name="Fire Hawk (Camerica)">
2268822688      <status>Known Bad Image</status>
22689      <extrainfo>71 0 4 8</extrainfo>
22689      <extrainfo>71 128 4 8</extrainfo>
2269022690
2269122691   </hash>
2269222692   <hash crc32="ce090b49" sha1="b4ae7c551f1b81b89a3e7b1e344a39180a1f8ee3" name="Fire Hawk (Camerica)">
2269322693      <status>Known Bad Image</status>
22694      <extrainfo>71 0 8 0</extrainfo>
22694      <extrainfo>71 128 8 0</extrainfo>
2269522695
2269622696   </hash>
2269722697   <hash crc32="3210b546" sha1="77bbc6a7428b03133803f57c9cc048b9699af0f3" name="Fire Hawk (Camerica)">
2269822698      <status>Overdumped Image</status>
22699      <extrainfo>71 0 8 0</extrainfo>
22699      <extrainfo>71 128 8 0</extrainfo>
2270022700
2270122701   </hash>
2270222702   <hash crc32="89a963a3" sha1="ced25f5252d27ba771dfe45a671aa7e64aa3692b" name="Firefly Demo by Loopy (PD)">
src/mess/machine/nes.c
r6027r6028
8787   nes_battery_ram = nes.wram;
8888
8989   /* Set up the memory handlers for the mapper */
90   //if (nes.format == 1)
9190   switch (nes.mapper)
9291   {
9392      case 20:
r6027r6028
129128   }
130129
131130   /* Set up the mapper callbacks */
131   if (nes.format == 1)
132132   {
133133      const mmc *mapper;
134134
r6027r6028
149149         ppu_latch = NULL;
150150      }
151151   }
152   else if (nes.format == 2)
153   {
154      const unif *board;
152155
153   //else if (nes.format == 2)
154   //TODO: we have to set up memory banking for unif board as in the mapper case
156      board = nes_unif_lookup(nes.board);
157      if (board)
158      {
159         mmc_write_low = board->mmc_write_low;
160         mmc_read_low = board->mmc_read_low;
161         mmc_write_mid = board->mmc_write_mid;
162         mmc_write = board->mmc_write;
163         ppu_latch = board->ppu_latch;
164      }
165      else
166      {
167         logerror("Board %s is not yet supported, defaulting to no mapper.\n", nes.board);
168         mmc_write_low = mmc_write_mid = mmc_write = NULL;
169         mmc_read_low = NULL;
170         ppu_latch = NULL;
171      }
172   }
155173
156174   /* Load a battery file, but only if there's no trainer since they share */
157175   /* overlapping memory. */
r6027r6028
190208   nes.mid_ram_enable = 1;
191209
192210   /* Reset the mapper variables. Will also mark the char-gen ram as dirty */
193   //if (nes.format == 1)
194   mapper_reset(machine, nes.mapper);
211   if (nes.format == 1)
212      mapper_reset(machine, nes.mapper);
195213
196   //if (nes.format == 2)
197   //unif_reset(machine, nes.board);
214   if (nes.format == 2)
215      unif_reset(machine, nes.board);
198216
199217   /* Reset the serial input ports */
200218   in_0.shift = 0;
r6027r6028
580598      logerror("**\n");
581599      logerror("Mapper: %d\n", nes.mapper);
582600      logerror("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks);
583//      printf("Mapper: %d\n", nes.mapper);
584//      printf("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks);
601      printf("Mapper: %d\n", nes.mapper);
602      printf("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks);
585603
586604      /* Read in any chr chunks */
587605      if (nes.chr_chunks > 0)
r6027r6028
611629
612630      logerror("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks);
613631      logerror("**\n");
614//      printf("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks);
615//      printf("**\n");
632      printf("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks);
633      printf("**\n");
616634
617635      /* Attempt to load a battery file for this ROM. If successful, we */
618636      /* must wait until later to move it to the system memory. */
r6027r6028
626644      char magic2[4];
627645      UINT8 buffer[4];
628646      UINT32 chunk_length = 0, read_length = 0x20;
647      UINT32 prg_start = 0, chr_start = 0;
648      UINT32 prg_left = 0, chr_left = 0;   // used to verify integrity of our unif image
629649      char unif_mapr[32];   // here we should store MAPR chunks
630650      UINT32 size = image_length(image);
631651      const unif *unif_board;
r6027r6028
658678         memset(magic2, '\0', sizeof(magic2));
659679         image_fread(image, &magic2, 4);
660680
681         /* Preliminary checks: the first chunk MUST be MAPR! */
682         if (read_length == 0x20 && ((magic2[0] != 'M') || (magic2[1] != 'A') || (magic2[2] != 'P') || (magic2[3] != 'R')))
683            fatalerror("First chunk of data in UNIF should be [MAPR]. Check if your image has been corrupted\n");
684
685         /* Preliminary checks: multiple MAPR chunks are FORBIDDEN! */
686         if (read_length > 0x20 && ((magic2[0] == 'M') && (magic2[1] == 'A') && (magic2[2] == 'P') && (magic2[3] == 'R')))
687            fatalerror("UNIF should not have multiple [MAPR] chunks. Check if your image has been corrupted\n");
688
661689         /* What kind of chunk do we have here? */
662690         if ((magic2[0] == 'M') && (magic2[1] == 'A') && (magic2[2] == 'P') && (magic2[3] == 'R'))
663691         {
664            int i;
692//            int i;
665693            logerror("[MAPR] chunk found: ");
666694            image_fread(image, &buffer, 4);
667695            chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
r6027r6028
671699
672700            read_length += (chunk_length + 8);
673701
674            unif_board = nes_unif_lookup(unif_mapr);   // this does not work atm, it's mainly a proof of concept
702            unif_board = nes_unif_lookup(unif_mapr);
675703
676            for(i = 0; i < chunk_length; i++)
677               logerror("%c", unif_mapr[i]);
678            logerror("\n");
704//            for(i = 0; i < chunk_length; i++)
705//               logerror("%c", unif_mapr[i]);
706//            logerror("\n");
707            logerror("%s\n", unif_mapr);
679708
680709            if (unif_board == NULL)
681710            {
682711               fatalerror("Unsupported UNIF board.\n");
683712//                  logerror("Unsupported UNIF board.\n");
684713            }
714
715            nes.mapper = 0;   // this allows us to set up memory handlers without duplicating code (for the moment)
716            nes.board = unif_board->board;
717            nes.prg_chunks = unif_board->prgrom;
718            nes.chr_chunks = unif_board->chrrom;
719            nes.battery = unif_board->wram;   // we should implement WRAM banks...
720            nes.hard_mirroring = unif_board->nt;
721//            nes.four_screen_vram = ;
722
723            /* Free the regions that were allocated by the ROM loader */
724            memory_region_free(image->machine, "maincpu");
725            memory_region_free(image->machine, "gfx1");
726
727            /* Allocate them again with the proper size */
728            memory_region_alloc(image->machine, "maincpu", 0x10000 + (nes.prg_chunks + 1) * 0x4000, 0);
729            if (nes.chr_chunks)
730               memory_region_alloc(image->machine, "gfx1", nes.chr_chunks * 0x2000, 0);
731
732            nes.rom = memory_region(image->machine, "maincpu");
733            nes.vrom = memory_region(image->machine, "gfx1");
734            nes.vram = memory_region(image->machine, "gfx2");
735            nes.wram = memory_region(image->machine, "user1");
736
737            /* for validation purposes */
738            prg_left = unif_board->prgrom * 0x4000;
739            chr_left = unif_board->chrrom * 0x2000;
685740         }
686741         else if ((magic2[0] == 'R') && (magic2[1] == 'E') && (magic2[2] == 'A') && (magic2[3] == 'D'))
687742         {
r6027r6028
749804         }
750805         else if ((magic2[0] == 'P') && (magic2[1] == 'C') && (magic2[2] == 'K'))
751806         {
752            logerror("[PCKx] chunk found. No support yet.\n");
807            logerror("[PCK%c] chunk found. No support yet.\n", magic2[3]);
753808            image_fread(image, &buffer, 4);
754809            chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
755810
r6027r6028
757812         }
758813         else if ((magic2[0] == 'C') && (magic2[1] == 'C') && (magic2[2] == 'K'))
759814         {
760            logerror("[CCKx] chunk found. No support yet.\n");
815            logerror("[CCK%c] chunk found. No support yet.\n", magic2[3]);
761816               image_fread(image, &buffer, 4);
762817            chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
763818
r6027r6028
765820         }
766821         else if ((magic2[0] == 'P') && (magic2[1] == 'R') && (magic2[2] == 'G'))
767822         {
768            logerror("[PRGx] chunk found. No support yet.\n");
823            logerror("[PRG%c] chunk found. ", magic2[3]);
769824            image_fread(image, &buffer, 4);
770825            chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
771826
827            logerror("It consists of %d 16K-blocks.\n", chunk_length / 0x4000);
828            /* Validation */
829            prg_left -= chunk_length;
830            if (prg_left < 0)
831               fatalerror("PRG chunks larger than expected by board %s!\n", unif_mapr);
832
833            /* Read in the program chunks */
834            if (nes.prg_chunks == 1)
835            {
836               image_fread(image, &nes.rom[0x14000], chunk_length);
837               /* Mirror the only bank into $8000 */
838               memcpy(&nes.rom[0x10000], &nes.rom[0x14000], chunk_length);
839            }
840            else
841               image_fread(image, &nes.rom[0x10000 + prg_start], chunk_length);
842
843            prg_start += chunk_length;
772844            read_length += (chunk_length + 8);
773845         }
774846         else if ((magic2[0] == 'C') && (magic2[1] == 'H') && (magic2[2] == 'R'))
775847         {
776            logerror("[CHRx] chunk found. No support yet.\n");
848            logerror("[CHR%c] chunk found. ", magic2[3]);
777849            image_fread(image, &buffer, 4);
778850            chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
779851
852            logerror("It consists of %d 8K-blocks.\n", chunk_length / 0x2000);
853            /* validation */
854            chr_left -= chunk_length;
855            if (chr_left < 0)
856               fatalerror("CHR chunks larger than expected by board %s!\n", unif_mapr);
857
858            image_fread(image, nes.vrom + chr_start, chunk_length);
859
860            chr_start += chunk_length;
780861            read_length += (chunk_length + 8);
781862         }
782863         else
r6027r6028
787868      } while (size > read_length);
788869
789870   logerror("UNIF support is only very preliminary.\n");
790   return INIT_FAIL;   // if we let Unif init to pass, emulation would crash due to no PRG/CHR settings ;-)
791871   }
792872
793873   return INIT_PASS;
src/mess/machine/nes_mmc.c
r6027r6028
3939    * 064 has many IRQ problems (due to the way we implement CPU based IRQ) - see Skull & Crossbones.
4040          Klax has problems as well (even if it uses scanline based IRQ, according to Disch's docs).
4141    * 067 some 1-line glitches that cannot be solved without a better implementation for cycle-based IRQs
42    * 071 Fire Hawk is not properly working (it requires one hack to support both boards using this mapper)
4342    * 072, 086, 092 lack samples support (maybe others as well)
4443    * 073 16 bit IRQ mode is not implemented
4544    * 077 Requires 4-screen mirroring. Currently, it is very glitchy
r6027r6028
8180    * 032 - Major League needs hardwired mirroring (missing windows and glitched field in top view, otherwise)
8281    * 034 - Impossible Mission II is not like BxROM games (it writes to 0x7ffd-0x7fff, instead of 0x8000). It is still
8382          unplayable though (see above)
83    * 071 - Fire Hawk is different from other Camerica games (no hardwired mirroring)
8484    * 078 - Cosmo Carrier needs a different mirroring than Holy Diver
8585    * 113 - HES 6-in-1 requires mirroring (check Bookyman playfield), while other games break with this (check AV Soccer)
8686    * 153 - Famicom Jump II uses a different board (or the same in a very different way)
r6027r6028
47504750
47514751*************************************************************/
47524752
4753static WRITE8_HANDLER( mapper71_m_w )
4754{
4755   LOG_MMC(("mapper71_m_w offset: %04x, data: %02x\n", offset, data));
4756
4757   prg16_89ab(space->machine, data);
4758}
4759
47604753static WRITE8_HANDLER( mapper71_w )
47614754{
47624755   LOG_MMC(("mapper71_w offset: %04x, data: %02x\n", offset, data));
47634756
4764   if (offset >= 0x4000)
4757   switch (offset & 0x7000)
4758   {
4759   case 0x0000:
4760   case 0x1000:
4761      if (nes.crc_hack)
4762         set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW);
4763      break;
4764   case 0x4000:
4765   case 0x5000:
4766   case 0x6000:
4767   case 0x7000:
47654768      prg16_89ab(space->machine, data);
4769      break;
4770   }
47664771}
47674772
47684773/*************************************************************
r6027r6028
1111611121   { 68, "SunSoft 4",                 NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL },
1111711122   { 69, "SunSoft FME",               NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq },
1111811123   { 70, "74161/32 Bandai",           NULL, NULL, NULL, mapper70_w, NULL, NULL, NULL },
11119   { 71, "Camerica",                  NULL, NULL, mapper71_m_w, mapper71_w, NULL, NULL, NULL },
11124   { 71, "Camerica",                  NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL },
1112011125   { 72, "74161/32 Jaleco",           NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL },
1112111126   { 73, "Konami VRC 3",              NULL, NULL, NULL, mapper73_w, NULL, NULL, konami_irq },
1112211127   { 74, "Waixing Type A",            NULL, NULL, NULL, mapper74_w, NULL, NULL, mapper4_irq },
r6027r6028
1137711382      case 155:
1137811383         mmc_cmd1 = 0;
1137911384         mmc_count = 0;
11380         MMC1_regs[0] = 0x0f;
11385         MMC1_regs[0] = 0;//0x0f;
1138111386         MMC1_regs[1] = MMC1_regs[2] = MMC1_regs[3] = 0;
1138211387         set_nt_mirroring(PPU_MIRROR_HORZ);
1138311388         MMC1_set_chr(space->machine);
r6027r6028
1167411679      case 65:
1167511680      case 67:
1167611681      case 69:
11677      case 71:
1167811682      case 72:
1167911683      case 78:
1168011684      case 92:
r6027r6028
1169011694         prg16_89ab(space->machine, nes.prg_chunks - 2);
1169111695         prg16_cdef(space->machine, nes.prg_chunks - 1);
1169211696         break;
11697      case 71:
11698         set_nt_mirroring(PPU_MIRROR_HORZ);
11699         prg16_89ab(space->machine, 0);
11700         prg16_cdef(space->machine, nes.prg_chunks - 1);
11701         break;
1169311702      case 76:
1169411703         prg8_89(space->machine, 0);
1169511704         prg8_ab(space->machine, 1);
r6027r6028
1218012189static const unif unif_list[] =
1218112190{
1218212191/*       UNIF                       LOW_W, LOW_R, MED_W, HIGH_W, PPU_latch, scanline CB, hblank CB     PRG  CHR  NVW  WRAM  CRAM       NMT    IDX*/
12183   { "UNL-SACHEN-8259A",         mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL,        256, 256,   0,    0, CHRRAM_0,  0,     SACHEN_8259A},
12192   { "UNL-SACHEN-8259A",         mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL,        16, 32,   0,    0, CHRRAM_0,  0,     SACHEN_8259A},
1218412193};
1218512194
1218612195const unif *nes_unif_lookup( const char *board )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team