It is currently Thu Dec 14, 2017 11:39 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Mapper 235?
PostPosted: Tue Jul 11, 2017 6:18 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3076
Location: Brazil
Back in early times, it was assigned mapper 235 for a 150-in-1 cart, and probably others since my implementation brings different stuff for each PRG size. There's some non-sense on it, but not my fault.
Code:
/*
Address

1--A B-mS -M-p pppp
       
M: PPU mirroring control, one screen ($2000).
m: if M=0, PPU mirroring vertical/horizontal.
p: PRG page select.

mS: PRG bank mode?

B: select PRG 32k mode
A: (B=0) select PRG 16k mode
         A=0 low 16k at $8000 and $C000
         A=1 high 16k at $8000 and $C000
*/

static void map235(const unsigned int addr, const unsigned char data)
{
   /* mirroring
    */
   if(addr&0x400)       set_custom_mirror(0,0,0,0);
   else if(addr&0x2000) set_hmirror();
   else                 set_vmirror();

   /* rom bankswitch
    */
   unsigned char pdata = addr & 0x1f;
   switch(prg_banks << 1)
   {
      case 128:
        if(addr & 0x300) { //$8000-$FFFF is ALL openbus!?
           cpu_setopenbus(4);
           cpu_setopenbus(5);
           cpu_setopenbus(6);
           cpu_setopenbus(7);
           return;
        } break;

      case 256:
        switch(addr & 0x300) {
           case 0:
             break;
           case 2:
             pdata |= 0x20;
             break;
           default:
             cpu_setopenbus(4);
             cpu_setopenbus(5);
             cpu_setopenbus(6);
             cpu_setopenbus(7);
             return;
        } break;

      case 384:
        switch(addr & 0x300) {
           case 0:
             break;
           case 2:
             pdata |= 0x20;
             break;
           case 3:
             pdata |= 0x40;
             break;
           default:
             cpu_setopenbus(4);
             cpu_setopenbus(5);
             cpu_setopenbus(6);
             cpu_setopenbus(7); /* todo- what's the point of this? */
             return;
        } break;

      case 512:
        pdata |= (addr & 0x300) >> 3;
        break;

      default:    //unsupported
        return;
   }

   /* prg cpu_swap
    */
   if(0 == (addr&0x800)) {
      cpu_swap32k(pdata);
   } else {
      pdata <<= 2;
      if(addr&0x1000) {
         cpu_swap8k(4,pdata+2);
         cpu_swap8k(5,pdata+3);
         cpu_swap8k(6,pdata+2);
         cpu_swap8k(7,pdata+3);
      } else {
         cpu_swap8k(4,pdata+0);
         cpu_swap8k(5,pdata+1);
         cpu_swap8k(6,pdata+0);
         cpu_swap8k(7,pdata+1);
      }
   }
}


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

All times are UTC - 7 hours


Who is online

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