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);
     }
 }
 public void Write(ushort address, byte data)
 {
     if ((address & 0x0100) != 0)
     {
         Map.Switch32kPrgRom(((data >> 3) & 0x01) * 8);
         Map.Switch8kChrRom((data & 0x07) * 8);
     }
 }
Exemple #4
0
 public void Write(ushort address, byte data)
 {
     Map.Switch32kPrgRom((data & 0x07) * 8);
     if ((data & 0x10) != 0)
     {
         Map.Cartridge.MirroringBase = 0x2400;
     }
     else
     {
         Map.Cartridge.MirroringBase = 0x2000;
     }
     Map.ApplayMirroring();
 }
Exemple #5
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 #6
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();
     }
 }
Exemple #8
0
 public void SetUpMapperDefaults()
 {
     Map.Switch32kPrgRom(0);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(8);
     }
     Map.Switch8kChrRom(0);
 }
Exemple #9
0
        public void Write(ushort address, byte data)
        {
            if (address >= 0x8000 & address <= 0xFFFF)
            {
                if ((address & 0x10) == 0)
                {
                    _Map.Switch32kPrgRom((address & 0xF) * 8);
                }
                else
                {
                    _Map.Switch16kPrgRom((((address & 0xF) << 1) | (((address & 0x20) >> 5))) * 4, 0);
                    _Map.Switch16kPrgRom((((address & 0xF) << 1) | (((address & 0x20) >> 5))) * 4, 1);
                }

                _Map.Cartridge.Mirroring = ((address & 0x80) != 0) ? Mirroring.Horizontal : Mirroring.Vertical;
                _Map.ApplayMirroring();
            }
        }
 public void Write(ushort address, byte data)
 {
     if (address == 0x7ffd)
     {
         Map.Switch32kPrgRom(data * 8);
     }
     else if (address == 0x7ffe)
     {
         Map.Switch4kChrRom(data * 4, 0);
     }
     else if (address == 0x7fff)
     {
         Map.Switch4kChrRom(data * 4, 1);
     }
     else if (address >= 0x8000)
     {
         Map.Switch32kPrgRom(data * 8);
     }
 }
        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.Switch32kPrgRom((Map.Cartridge.PRG_PAGES - 1) * 4 - 4);
     Map.Switch8kPrgRom(0, 0);
     if (Map.Cartridge.IsVRAM)
     {
         Map.FillCHR(16);
     }
     Map.Switch8kChrRom(0);
 }
 public void SetUpMapperDefaults()
 {
     MEM.Switch32kPrgRom(0);
     if (MEM.Cartridge.IsVRAM)
     {
         MEM.FillCHR(16);
     }
     MEM.Switch8kChrRom(0);
     if (MEM.Cartridge.PRG_PAGES == 1)
     {
         MEM.Switch16kPrgRom(0, 1);
     }
 }
 public void SetUpMapperDefaults()
 {
     _Map.Switch32kPrgRom(0);
     _Map.Switch8kChrRom(0);
 }
        public void Write(ushort address, byte data)
        {
            if ((address & 0xFF00) == 0x4100)
            {
                // Street Fighter 2 YOKO
                mem.Switch32kPrgRom(((data & 0x30) >> 4) * 8);
            }
            else if ((address & 0xFF00) == 0x6100)
            {
                // Master Fighter 2
                mem.Switch32kPrgRom((data & 0x03) * 8);
            }
            else
            {
                switch (address & 0xE001)
                {
                case 0x8000:
                    reg[0] = data;
                    SetCHR();
                    break;

                case 0x8001:
                    reg[1] = data;
                    SetCHR();
                    switch (reg[0] & 0x07)
                    {
                    case 0x00:
                        chr01 = (byte)(data & 0xFE);
                        SetCHR();
                        break;

                    case 0x01:
                        chr23 = (byte)(data & 0xFE);
                        SetCHR();
                        break;

                    case 0x02:
                        chr4 = data;
                        SetCHR();
                        break;

                    case 0x03:
                        chr5 = data;
                        SetCHR();
                        break;

                    case 0x04:
                        chr6 = data;
                        SetCHR();
                        break;

                    case 0x05:
                        chr7 = data;
                        SetCHR();
                        break;
                    }
                    break;

                case 0xA000:
                    if ((data & 0x01) != 0)
                    {
                        mem.Cartridge.Mirroring = Mirroring.Horizontal;
                    }
                    else
                    {
                        mem.Cartridge.Mirroring = Mirroring.Vertical;
                    }
                    mem.ApplayMirroring();
                    break;

                case 0xC000:
                    irq_counter = data;
                    break;

                case 0xC001:
                    irq_latch = data;
                    break;

                case 0xE000:
                    irq_enable = 0;
                    break;

                case 0xE001:
                    irq_enable = 0xFF;
                    break;
                }
            }
        }
 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;
             }
         }
     }
 }