It is currently Wed Jan 23, 2019 9:00 pm

All times are UTC - 7 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 29, 2015 1:44 pm 
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 863
Location: New York, NY
I am having difficulty getting Mapper 052 to work correctly. Half the games on Mario Party 7-in-1 appear to work, but the graphics are garbled in the other half (though the program and sound seem to work correctly). There is a note about inverted bits in the source code of FCEUX:

static void M52CW(uint32 A, uint8 V) {
   uint32 mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1);
//   uint32 bank = (((EXPREGS[0]>>3)&4)|((EXPREGS[0]>>1)&2)|((EXPREGS[0]>>6)&(EXPREGS[0]>>4)&1))<<7;
   uint32 bank = (((EXPREGS[0] >> 4) & 2) | (EXPREGS[0] & 4) | ((EXPREGS[0] >> 6) & (EXPREGS[0] >> 4) & 1)) << 7;   // actually 256K CHR banks index bits is inverted!
   setchr1(A, bank | (V & mask));

Is that expression any different from the wiki explanation?

Edit: I just discovered that the graphics in FCEUX are as garbled as my emulator. But, Nestopia is able to run the game correctly. The wiki must be missing something.

Edit2: I found the solution in Nestopia's source:

   if (WhichGame & 0x40)
      CHRmask = 0x7F;
      CHRbank = ((WhichGame & 0x20) >> 3) | ((WhichGame & 0x10) >> 4) | ((WhichGame & 0x04) >> 1);
      CHRmask = 0xFF;
      CHRbank = ((WhichGame & 0x20) >> 3) | ((WhichGame & 0x10) >> 4);

The bits are swapped around differently than described in the wiki. With this notation:

$6000-7FFF:  [ABCD EFGH]  Multicart reg

There are 8 possible CHR banks constructed from bits CFD. The wiki erroneously suggests that it should be FCD; per Nestopia, the upper 2 bits are flipped. Maybe that is what the comment in the FCEUX source was referring to.

The D bit is only used in the CHR 128K block case as described in the wiki.

PostPosted: Sat May 09, 2015 12:09 am 

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7987
Location: Seattle
Please see FARID's post: viewtopic.php?t=10703 about mapper 52.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group