public void Write(ushort address, byte data)
 {
     if (address >= 0x8000 & address <= 0xFFFF)
     {
         _Map.Switch16kPrgRom((data & 0x7) * 4, 0);
         _Map.Switch8kChrRom(((data & 0xF0) >> 4) * 8);
         if ((address & 0xFE00) != 0xFE00)
         {
             if (IREM)
             {
                 if ((data & 0x8) != 0)
                 {
                     _Map.Cartridge.Mirroring = Mirroring.Horizontal;
                 }
                 else
                 {
                     _Map.Cartridge.Mirroring = Mirroring.Vertical;
                 }
             }
             else
             {
                 _Map.Cartridge.Mirroring = Mirroring.One_Screen;
                 if ((data & 0x8) != 0)
                 {
                     _Map.Cartridge.MirroringBase = 0x2000;
                 }
                 else
                 {
                     _Map.Cartridge.MirroringBase = 0x2400;
                 }
             }
             _Map.ApplayMirroring();
         }
     }
 }
Exemple #2
0
        public void Write(ushort address, byte data)
        {
            data = (byte)(address & 0xFF);

            if (address >= 0x9000)
            {
                if ((data & 0xF0) == 0xD0)
                {
                    MEM.Switch16kPrgRom((data & 0x0F) * 4, 1);
                }
                else if ((data & 0xF0) == 0xE0)
                {
                    MEM.Switch8kChrRom((data & 0x0F) * 8);
                }
            }
            else
            {
                if ((data & 0xF0) == 0xB0)
                {
                    MEM.Switch16kPrgRom((data & 0x0F) * 4, 1);
                }
                else if ((data & 0xF0) == 0x70)
                {
                    MEM.Switch8kChrRom((data & 0x0F) * 8);
                }
            }
        }
Exemple #3
0
        public void SetUpMapperDefaults()
        {
            mem.Switch16kPrgRom((mem.Cartridge.PRG_PAGES - 2) * 4, 0);
            mem.Switch16kPrgRom((mem.Cartridge.PRG_PAGES - 1) * 4, 1);
            if (mem.Cartridge.IsVRAM)
            {
                mem.FillCHR(16);
            }
            mem.Switch8kChrRom(0);

            for (int i = 0; i < 4; i++)
            {
                prg_reg[i]     = (byte)(mem.Cartridge.PRG_PAGES - 4 + i);
                ntl_reg[i]     = 0;
                nth_reg[i]     = 0;
                chl_reg[i]     = (byte)i;
                chh_reg[i]     = 0;
                chl_reg[i + 4] = (byte)(i + 4);
                chh_reg[i + 4] = 0;
            }

            if (sw_val != 0)
            {
                sw_val = 0x00;
            }
            else
            {
                sw_val = 0xFF;
            }
        }
 public void Write(ushort address, byte data)
 {
     if ((address >= 0x8000) && (address <= 0xFFFF))
     {
         _Map.Switch8kChrRom(data * 8);
     }
 }
 public void Write(ushort address, byte data)
 {
     if ((address & 0x0100) != 0)
     {
         Map.Switch32kPrgRom(((data >> 3) & 0x01) * 8);
         Map.Switch8kChrRom((data & 0x07) * 8);
     }
 }
 public void Write(ushort address, byte data)
 {
     if (address >= 0x4100 & address <= 0x41FF)
     {
         Map.Switch8kChrRom((data & 0x7) * 8);
         Map.Switch32kPrgRom(((data & 0x18) >> 3) * 8);
     }
 }
 public void Write(ushort address, byte data)
 {
     if ((address >= 0x8000) && (address <= 0xFFFF))
     {
         Map.Switch32kPrgRom(((data >> 4) & 0x3) * 8);
         Map.Switch8kChrRom((data & 0x3) * 8);
     }
 }
Exemple #8
0
        public void Write(ushort address, byte data)
        {
            if (address >= 0x8000 & address <= 0xFFFF)
            {
                Map.Switch32kPrgRom(((data & 0x30) >> 4) * 8);
                Map.Switch8kChrRom((data & 0x3) * 8);
            }
            else
            {
                switch (address)
                {
                case 0x42FC:
                case 0x42FE:
                case 0x42FF:
                    switch (address & 0x1)
                    {
                    case 0:
                        Map.Cartridge.Mirroring = Mirroring.One_Screen;
                        if ((data & 0x10) != 0)
                        {
                            Map.Cartridge.MirroringBase = 0x2400;
                        }
                        else
                        {
                            Map.Cartridge.MirroringBase = 0x2000;
                        }
                        Map.ApplayMirroring();
                        break;

                    case 1:
                        if ((data & 0x10) != 0)
                        {
                            Map.Cartridge.Mirroring = Mirroring.Vertical;
                        }
                        else
                        {
                            Map.Cartridge.Mirroring = Mirroring.Horizontal;
                        }
                        Map.ApplayMirroring();
                        break;
                    }
                    break;

                case 0x4501: IRQEnabled = false; break;

                case 0x4502: irq_counter = (short)((irq_counter & 0xFF00) | data); break;

                case 0x4503: irq_counter = (short)((data << 8) | (irq_counter & 0x00FF)); IRQEnabled = true; break;
                }
            }
        }
Exemple #9
0
 public void Write(ushort address, byte data)
 {
     mem.Cartridge.Mirroring = ((address & 0x8) != 0) ? Mirroring.Horizontal : Mirroring.Vertical;
     mem.ApplayMirroring();
     mem.Switch8kChrRom((address & 0x7) * 8);
     if ((address & 0x4000) != 0)
     {
         mem.Switch32kPrgRom(((address & 0x6) >> 1) * 8);
     }
     else
     {
         mem.Switch16kPrgRom((address & 0x7) * 4, 0);
         mem.Switch16kPrgRom((address & 0x7) * 4, 1);
     }
 }
 public void Write(ushort address, byte data)
 {
     if (address >= 0x6000 & address <= 0xFFFF)
     {
         Map.Switch32kPrgRom((address & 0x7) * 8);
         Map.Cartridge.Mirroring = ((address & 0x20) == 0) ? Mirroring.Vertical : Mirroring.Horizontal;
         Mapper41_CHR_High       = (byte)(data & 0x18);
         if ((address & 0x4) == 0)
         {
             Mapper41_CHR_Low = (byte)(data & 0x3);
         }
         temp = (ushort)(Mapper41_CHR_High | Mapper41_CHR_Low);
         Map.Switch8kChrRom((temp) * 8);
         Map.ApplayMirroring();
     }
 }
 public void SetUpMapperDefaults()
 {
     Map.Switch16kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4, 1);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(8);
     }
     Map.Switch8kChrRom(0);
 }
 public void SetUpMapperDefaults()
 {
     Map.Switch32kPrgRom(0);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
 public void SetUpMapperDefaults()
 {
     Map.Switch8kPrgRom(((Map.Cartridge.PRG_PAGES * 2) - 1) * 2, 3);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
Exemple #14
0
 public void SetUpMapperDefaults()
 {
     Map.Switch16kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4, 1);
     Map.Cartridge.Mirroring = Mirroring.One_Screen;
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
 public void SetUpMapperDefaults()
 {
     _Map.Switch16kPrgRom(0, 0);
     _Map.Switch16kPrgRom((_Map.Cartridge.PRG_PAGES - 1) * 4, 1);
     if (_Map.Cartridge.IsVRAM)
     {
         _Map.FillCHR(16);
     }
     _Map.Switch8kChrRom(0);
 }
Exemple #16
0
 public void SetUpMapperDefaults()
 {
     MEM.Switch16kPrgRom(0, 1);
     MEM.Switch16kPrgRom((MEM.Cartridge.PRG_PAGES - 1) * 4, 0);
     if (MEM.Cartridge.IsVRAM)
     {
         MEM.FillCHR(16);
     }
     MEM.Switch8kChrRom(0);
 }
 public void SetUpMapperDefaults()
 {
     Map.Switch16kPrgRom(0, 0);
     Map.Switch16kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4, 1);
     Map.FillCRAM(32);//we'll need these 32k
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
        public void Write(ushort address, byte data)
        {
            if ((address >= 0x8000) && (address <= 0xFFFF))
            {
                int    banks = ((address & 0x4000) != 0) ? 1 : 0;
                ushort wher  = (ushort)((address & 0x0Fc0) >> 7);
                _Map.Switch8kChrRom(((address & 0x003F) + (banks << 6)) * 8);
                if ((address & 0x1000) != 0)     //A12
                {
                    if ((address & 0x0040) != 0) //A6
                    {
                        _Map.Switch16kPrgRom((((wher + (banks << 5)) << 1) + 1) * 4, 0);
                        _Map.Switch16kPrgRom((((wher + (banks << 5)) << 1) + 1) * 4, 1);
                    }
                    else
                    {
                        _Map.Switch16kPrgRom(((wher + (banks << 5)) << 1) * 4, 0);
                        _Map.Switch16kPrgRom(((wher + (banks << 5)) << 1) * 4, 1);
                    }
                }
                else
                {
                    _Map.Switch32kPrgRom((wher + (banks << 5)) * 8);//ignore A6
                }
                _Map.Cartridge.Mirroring = ((address >> 13) & 1) == 0 ? Mirroring.Vertical : Mirroring.Horizontal;
                _Map.ApplayMirroring();
            }
            else if ((address >= 0x5800) && (address <= 0x5FFF))
            {
                switch (address & 0x3)
                {
                case 0: Mapper225_reg0 = (byte)(data & 0xf); break;

                case 1: Mapper225_reg1 = (byte)(data & 0xf); break;

                case 2: Mapper225_reg2 = (byte)(data & 0xf); break;

                case 3: Mapper225_reg3 = (byte)(data & 0xf); break;
                }
            }
        }
 public void SetUpMapperDefaults()
 {
     reg[0] = 0; reg[1] = 4;
     reg[2] = 0; reg[3] = 0;
     map.Switch16kPrgRom(0, 0);
     map.Switch16kPrgRom((map.Cartridge.PRG_PAGES - 1) * 4, 1);
     if (map.Cartridge.IsVRAM)
     {
         map.FillCHR(16);
     }
     map.Switch8kChrRom(0);
 }
Exemple #20
0
 public void SetUpMapperDefaults()
 {
     timer_irq_enabled = false;
     Map.Switch16kPrgRom(0, 0);
     Map.Switch16kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4, 1);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
     MyNesDEBUGGER.WriteLine(this, "Mapper 16 setup done.", DebugStatus.Cool);
 }
 public void SetUpMapperDefaults()
 {
     reg[0] = 0; reg[1] = 4;
     reg[2] = 0; reg[3] = 0;
     Map.Switch32kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4 - 4);
     Map.Switch8kPrgRom(0, 0);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
Exemple #22
0
 public void SetUpMapperDefaults()
 {
     Map.Switch32kPrgRom(0);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
     Map.Cartridge.Mirroring     = Mirroring.One_Screen;
     Map.Cartridge.MirroringBase = 0x2000;
     Map.ApplayMirroring();
 }
 public void Write(ushort address, byte data)
 {
     if ((address >= 0x8000) && (address <= 0x9FFF))
     {
         if ((data & 0x80) == 0x80)
         {
             //Reset
             mapper1_register8000BitPosition = 0;
             mapper1_register8000Value       = 0;
             mapper1_mirroringFlag           = 0;
             mapper1_onePageMirroring        = 1;
             mapper1_prgSwitchingArea        = 1;
             mapper1_prgSwitchingSize        = 1;
             mapper1_vromSwitchingSize       = 0;
         }
         else
         {
             mapper1_register8000Value += (data & 0x1) << mapper1_register8000BitPosition;
             mapper1_register8000BitPosition++;
             if (mapper1_register8000BitPosition == 5)
             {
                 mapper1_mirroringFlag = (byte)(mapper1_register8000Value & 0x1);
                 if (mapper1_mirroringFlag == 0)
                 {
                     Map.Cartridge.Mirroring = Mirroring.Vertical;
                     Map.ApplayMirroring();
                 }
                 else
                 {
                     Map.Cartridge.Mirroring = Mirroring.Horizontal;
                     Map.ApplayMirroring();
                 }
                 mapper1_onePageMirroring = (byte)((mapper1_register8000Value >> 1) & 0x1);
                 if (mapper1_onePageMirroring == 0)
                 {
                     Map.Cartridge.Mirroring     = Mirroring.One_Screen;
                     Map.Cartridge.MirroringBase = 0x2000;
                     Map.ApplayMirroring();
                 }
                 mapper1_prgSwitchingArea        = (byte)((mapper1_register8000Value >> 2) & 0x1);
                 mapper1_prgSwitchingSize        = (byte)((mapper1_register8000Value >> 3) & 0x1);
                 mapper1_vromSwitchingSize       = (byte)((mapper1_register8000Value >> 4) & 0x1);
                 mapper1_register8000BitPosition = 0;
                 mapper1_register8000Value       = 0;
                 mapper1_registerA000BitPosition = 0;
                 mapper1_registerA000Value       = 0;
                 mapper1_registerC000BitPosition = 0;
                 mapper1_registerC000Value       = 0;
                 mapper1_registerE000BitPosition = 0;
                 mapper1_registerE000Value       = 0;
             }
         }
     }
     else if ((address >= 0xA000) && (address <= 0xBFFF))
     {
         if ((data & 0x80) == 0x80)
         {
             //Reset
             mapper1_registerA000BitPosition = 0;
             mapper1_registerA000Value       = 0;
         }
         else
         {
             mapper1_registerA000Value += (data & 0x1) << mapper1_registerA000BitPosition;
             mapper1_registerA000BitPosition++;
             if (mapper1_registerA000BitPosition == 5)
             {
                 if (Map.Cartridge.CHR_PAGES > 0)
                 {
                     if (mapper1_vromSwitchingSize == 1)
                     {
                         Map.Switch4kChrRom(mapper1_registerA000Value * 4, 0);
                     }
                     else
                     {
                         Map.Switch8kChrRom((mapper1_registerA000Value >> 1) * 8);
                     }
                 }
                 mapper1_registerA000BitPosition = 0;
                 mapper1_registerA000Value       = 0;
             }
         }
     }
     else if ((address >= 0xC000) && (address <= 0xDFFF))
     {
         if ((data & 0x80) == 0x80)
         {
             //Reset
             mapper1_registerC000BitPosition = 0;
             mapper1_registerC000Value       = 0;
         }
         else
         {
             mapper1_registerC000Value += (data & 0x1) << mapper1_registerC000BitPosition;
             mapper1_registerC000BitPosition++;
             if (mapper1_registerC000BitPosition == 5)
             {
                 if (Map.Cartridge.CHR_PAGES > 0)
                 {
                     if (mapper1_vromSwitchingSize == 1)
                     {
                         Map.Switch4kChrRom(mapper1_registerC000Value * 4, 1);
                     }
                 }
                 mapper1_registerC000BitPosition = 0;
                 mapper1_registerC000Value       = 0;
             }
         }
     }
     else if ((address >= 0xE000) && (address <= 0xFFFF))
     {
         if ((data & 0x80) == 0x80)
         {
             //Reset
             mapper1_registerE000BitPosition = 0;
             mapper1_registerE000Value       = 0;
             mapper1_registerA000BitPosition = 0;
             mapper1_registerA000Value       = 0;
             mapper1_registerC000BitPosition = 0;
             mapper1_registerC000Value       = 0;
             mapper1_register8000BitPosition = 0;
             mapper1_register8000Value       = 0;
         }
         else
         {
             mapper1_registerE000Value += (data & 0x1) << mapper1_registerE000BitPosition;
             mapper1_registerE000BitPosition++;
             if (mapper1_registerE000BitPosition == 5)
             {
                 if (mapper1_prgSwitchingSize == 1)
                 {
                     if (mapper1_prgSwitchingArea == 1)
                     {
                         // Switch bank at 0x8000 and reset 0xC000
                         Map.Switch16kPrgRom(mapper1_registerE000Value * 4, 0);
                         Map.Switch16kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4, 1);
                     }
                     else
                     {
                         // Switch bank at 0xC000 and reset 0x8000
                         Map.Switch16kPrgRom(mapper1_registerE000Value * 4, 1);
                         Map.Switch16kPrgRom(0, 0);
                     }
                 }
                 else
                 {
                     //Full 32k switch
                     Map.Switch32kPrgRom((mapper1_registerE000Value >> 1) * 8);
                 }
                 mapper1_registerE000BitPosition = 0;
                 mapper1_registerE000Value       = 0;
             }
         }
     }
 }