It is currently Sun Nov 17, 2019 3:40 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: About mapper 113
PostPosted: Wed Feb 24, 2016 7:55 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
I know this is a rather marginal mapper used by just a few of lame-ish multicarts, but I found it a nice expansion to GNROM plus it allowed for mirroring selection by software:

http://wiki.nesdev.com/w/index.php/INES_Mapper_113

Doragasu has implemented a mapper which behaves exactly as described in the above link and we are using that for a couple of games and a multicart. That's sorted out and going nicely, but I need to be able to run the ROMs in emulators to develop.

Problem is, mirroring selection bit doesn't seem to affect actual mirroring when running the ROM in Fceux. I don't know whether I'm doing something wrong or if I'm missing something, but the mirroring is always what I specify in the iNES header. If I raise bit 0 of byte 6 it's horizontal, otherwise vertical.

Mapper 113 "listens" to writes to address $4100 (among others) and expects

Code:
MCPPPCCC


Where "M" is the mirroring bit. But it seems to ignore it.

Here's my paging code. Nothing very fancy, as there's no bus conflicts
Code:
_change_rom:
   lda #0
   sta PPU_MASK
   sta PPU_CTRL

   lda $0300
   sta $4100
   jmp start


Whenever I want to change PRG or CHR, or mirroring, I write the correct value to a buffer in $0300 then call _change_rom. Writing a value of 10110110 ($B6) should select PRG 6, CHR 6, and Vertical mirroring, but it just selects PRG 6 and CHR 6. Mirroring doesn't change.

Any pointers? I've dived in the Fceux sources but can't find the implementation for 113.

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Wed Feb 24, 2016 8:27 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7633
Location: Canada
na_th_an wrote:
I've dived in the Fceux sources but can't find the implementation for 113.


Look in ines.cpp for a lookup table of mapper implementations:
ines.cpp line 566 wrote:
Code:
   {"HACKER/SACHEN BOARD",   113, Mapper113_Init},


From that line, search for Mapper113_Init, which will lead you to boards/datalatch.cpp. You should be able to find the implementation details you want there.


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Wed Feb 24, 2016 8:58 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
Thanks for the pointers, I'll take a glance :)

Edit: I've seen it:

Code:
static void M113Sync(void) {
   setprg32(0x8000, (latche >> 3) & 7);
   setchr8(((latche >> 3) & 8) | (latche & 7));
//   setmirror(latche>>7); // only for HES 6in1
}


The "setmirror" which reads bit 7 is commented out. I wonder why. I'll try and contact the developers. Thanks :)

Edit (again): I've posted the question to the Fceux forums. I've also tried this behaviour in VirtuaNES. In the source code you see this behaviour patched *only* for the HES 6-in-1 cartridge.

Code:
void   Mapper113::WriteLow( WORD addr, BYTE data )
{
//DEBUGOUT( "$%04X:$%02X L=%3d\n", addr, data, nes->GetScanline() );
   switch( addr ) {
      case   0x4100:
      case   0x4111:
      case   0x4120:
      case   0x4194:
      case   0x4195:
      case   0x4900:
         if( nes->rom->GetPROM_CRC() == 0xA75AEDE5 ) { // HES 6-in-1
            if( data & 0x80 ) {
               SetVRAM_Mirror( VRAM_VMIRROR );
            } else {
               SetVRAM_Mirror( VRAM_HMIRROR );
            }
         }
         SetPROM_32K_Bank( data >> 3 );
         SetVROM_8K_Bank( ((data>>3)&0x08)+(data&0x07) );
         break;
   }
}


I'll contact the authors of VirtuaNES as well about this issue. Just out of curiosity, you know.

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Wed Feb 24, 2016 1:17 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8683
Location: Seattle
I guess it's remotely possible that the other two multigames (Mind Blower Pak and Total Funpak) don't support switching mirroring, but that would be a little weird.


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Wed Feb 24, 2016 3:00 pm 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
I guess it's my fault for choosing such an obscure mapper ;-)

Well, at least it works in real hardware. Also, I've found that if I specify 4 nametables in the iNES header, even if it ignores the mirroring changes, most of my stuff works (almost glitch-less) so it's more than enough for developing. What's more, one of the games doesn't even need the feature (works with horizontal mirroring all the time).

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Wed Feb 24, 2016 11:09 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8683
Location: Seattle
You could also try looking through my table at nesdevwiki:User:Lidnariq/Discrete Logic Table


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 12:49 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
I knew that table but I discovered it way too late ^_^u

Zeromus believes that the behaviour is coded that way as there are only three Mapper 113 carts, two of them doesn't use mirroring adjust - plus they break if it is emulated. That's why support is off or restricted just to the 6in1 cartridge.

He proposes the creation of two submappers of mapper 113. Submapper 1 with a functional M bit, and submapper 2 which ignores such bit, information to be stored in the NES 2.0 header extension, an option I favour (obviously) - but I think I'll have to move this discussion elsewhere (the NESdevEm forums, that is).

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 3:20 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8683
Location: Seattle
Interesting. Maybe Disch's original documentation for Mapper 79 and Mapper 113 has merit then?

He originally defined Mapper 79 as "Mapper 113 but with fixed mirroring", and that would handle both the Mind Blower Pak and Total Funpak, as well as all the "normal" 64KiB/64KiB NINA-003 games.


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 4:13 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
I don't know. That would make HES 6in1 (and our future releases) the only 113 game. Anyways, I find it awkward that there's a mapper number assigned to just three cartridges that behave differently enough to make two of them break if one of the feature of the mapper is emulated.

I don't know what would be better: move the two fixed mirroring games to mapper 79 and make 113 respond to the "M" bit by default, or do as Zeromus suggests and introduce two submappers.

If most implementations of mapper 79 only consider one bit to select the PRG-ROM bank, maybe the submapper approach would break less stuff if applied.

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 5:59 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
By the way, the feature works in Nestopia. I've tried our tester multicart which attempts to alter mirroring and it works.

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 7:45 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7633
Location: Canada
na_th_an wrote:
I find it awkward that there's a mapper number assigned to just three cartridges that behave differently enough to make two of them break if one of the feature of the mapper is emulated.

It wouldn't be iNES without silly mapper definition conflicts. ;)


Top
 Profile  
 
 Post subject: Re: About mapper 113
PostPosted: Thu Feb 25, 2016 11:53 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8683
Location: Seattle
na_th_an wrote:
I don't know. That would make HES 6in1 (and our future releases) the only 113 game.
There are plenty of other singletons in the iNES definitions; adding another to the list wouldn't be incrementally any worse.
Quote:
Anyways, I find it awkward that there's a mapper number assigned to just three cartridges that behave differently enough to make two of them break if one of the feature of the mapper is emulated.
At least it's not the Cony (mapper 83) mess...

Quote:
If most implementations of mapper 79 only consider one bit to select the PRG-ROM bank, maybe the submapper approach would break less stuff if applied.
Undersize things (by definition) work as intended: if there's no address line to connect to, it doesn't matter what value was latched.

So it'd only be the transition of "Now these multipaks are mapper 79, and emulators don't support them"—which should be the same as now, for those where mirroring control is wrong. All the smaller games would be unaffected.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 14 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