コード例 #1
0
ファイル: m085.cs プロジェクト: DualBrain/Emu-o-Tron
 public m085(NESCore nes, byte reg1, byte altReg1)
 {
     this.nes      = nes;
     this.cycleIRQ = true;
     regAddr       = reg1;
     altRegAddr    = altReg1;
 }
コード例 #2
0
ファイル: NSF.cs プロジェクト: DualBrain/Emu-o-Tron
 public NSF(NESCore nes, int specialChips)
 {
     this.nes  = nes;
     chipCount = 0;
     if ((FlagVRC6 & specialChips) != 0)
     {
         VRC6 = new Channels.VRC6(0, 1, 2, 3);
         chipCount++;
     }
     else
     {
         VRC6 = new Channels.External();
     }
     if ((FlagVRC7 & specialChips) != 0)
     {
         VRC7 = new Channels.External();
         chipCount++;
     }
     else
     {
         VRC7 = new Channels.External();
     }
     if ((FlagFDS & specialChips) != 0)
     {
         FDS = new Channels.FDS();
         chipCount++;
     }
     else
     {
         FDS = new Channels.External();
     }
     if ((FlagMMC5 & specialChips) != 0)
     {
         hasMMC5 = true;
         MMC5    = new Channels.MMC5(nes);
         chipCount++;
     }
     else
     {
         MMC5 = new Channels.External();
     }
     if ((FlagN163 & specialChips) != 0)
     {
         N163 = new Channels.N163();
         chipCount++;
     }
     else
     {
         N163 = new Channels.External();
     }
     if ((FlagFME7 & specialChips) != 0)
     {
         FME7 = new Channels.FME7();
         chipCount++;
     }
     else
     {
         FME7 = new Channels.External();
     }
 }
コード例 #3
0
ファイル: DWindow.cs プロジェクト: luislasonbra/CNes
 public DWindow(NES6502 cpu, Cart cr, NESCore nes)
 {
     this.cpu = cpu;
     this.cr  = cr;
     this.nes = nes;
     InitializeComponent();
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: LintfordPickle/NES-Sharp
        public MainForm()
        {
            InitializeComponent();

            // Setup the real-time renderer to run when Application_Idle is fired.
            Application.Idle += Application_Idle;

            _Bitmap    = new DirectBitmap(780, 480, PixelFormat.Format32bppArgb);
            _TimeUtil  = new TimeUtil();
            _FpsUtil   = new FPSUtil();
            _InputUtil = new InputUtil();

            this.KeyDown += _InputUtil.OnKeyDown;
            this.KeyUp   += _InputUtil.OnKeyUp;

            // Assign the DirectBitmap to the pixturebox
            pictureBox1.Image = _Bitmap.bitmap;

            _DrawFont      = new Font("Courier New", 9);
            _StringBuilder = new StringBuilder();

            _DrawOnBrush  = new SolidBrush(Color.Yellow);
            _DrawOffBrush = new SolidBrush(Color.Gray);

            _NESCore = new NESCore();
        }
コード例 #5
0
ファイル: m085.cs プロジェクト: nickmass/Emu-o-Tron
 public m085(NESCore nes, byte reg1, byte altReg1)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     regAddr = reg1;
     altRegAddr = altReg1;
 }
コード例 #6
0
ファイル: NSF.cs プロジェクト: nickmass/Emu-o-Tron
 public NSF(NESCore nes, int specialChips)
 {
     this.nes = nes;
     chipCount = 0;
     if ((FlagVRC6 & specialChips) != 0)
     {
         VRC6 = new Channels.VRC6(0, 1, 2, 3);
         chipCount++;
     }
     else
     {
         VRC6 = new Channels.External();
     }
     if ((FlagVRC7 & specialChips) != 0)
     {
         VRC7 = new Channels.External();
         chipCount++;
     }
     else
     {
         VRC7 = new Channels.External();
     }
     if ((FlagFDS & specialChips) != 0)
     {
         FDS = new Channels.FDS();
         chipCount++;
     }
     else
     {
         FDS = new Channels.External();
     }
     if ((FlagMMC5 & specialChips) != 0)
     {
         hasMMC5 = true;
         MMC5 = new Channels.MMC5(nes);
         chipCount++;
     }
     else
     {
         MMC5 = new Channels.External();
     }
     if ((FlagN163 & specialChips) != 0)
     {
         N163 = new Channels.N163();
         chipCount++;
     }
     else
     {
         N163 = new Channels.External();
     }
     if ((FlagFME7 & specialChips) != 0)
     {
         FME7 = new Channels.FME7();
         chipCount++;
     }
     else
     {
         FME7 = new Channels.External();
     }
 }
コード例 #7
0
ファイル: m019.cs プロジェクト: nickmass/Emu-o-Tron
 public m019(NESCore nes)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     if (nes.rom.mapper == 19)
         nes.APU.external = new Channels.N163();
 }
コード例 #8
0
ファイル: MemoryVis.cs プロジェクト: DualBrain/Emu-o-Tron
 public void Update(NESCore nes)
 {
     this.nes = nes;
     if (timer++ % 6 == 0)
     {
         Redraw();
     }
 }
コード例 #9
0
ファイル: m022.cs プロジェクト: nickmass/Emu-o-Tron
 public m022(NESCore nes)
 {
     this.nes = nes;
     regAddr[0] = 0;
     regAddr[1] = 2;
     regAddr[2] = 1;
     regAddr[3] = 3;
 }
コード例 #10
0
 public m022(NESCore nes)
 {
     this.nes   = nes;
     regAddr[0] = 0;
     regAddr[1] = 2;
     regAddr[2] = 1;
     regAddr[3] = 3;
 }
コード例 #11
0
 public m019(NESCore nes)
 {
     this.nes      = nes;
     this.cycleIRQ = true;
     if (nes.rom.mapper == 19)
     {
         nes.APU.external = new Channels.N163();
     }
 }
コード例 #12
0
ファイル: mVRC6.cs プロジェクト: nickmass/Emu-o-Tron
 public mVRC6(NESCore nes, byte reg1, byte reg2, byte reg3, byte reg4)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     regAddr[0] = reg1;
     regAddr[1] = reg2;
     regAddr[2] = reg3;
     regAddr[3] = reg4;
     this.nes.APU.external = new Channels.VRC6(reg1, reg2, reg3, reg4);
 }
コード例 #13
0
 public Debug(NESCore nes)
 {
     this.nes        = nes;
     square1History  = new byte[historySamplesPerFrame];
     square2History  = new byte[historySamplesPerFrame];
     triangleHistory = new byte[historySamplesPerFrame];
     noiseHistory    = new byte[historySamplesPerFrame];
     dmcHistory      = new byte[historySamplesPerFrame];
     externalHistory = new byte[historySamplesPerFrame];
 }
コード例 #14
0
 public mVRC6(NESCore nes, byte reg1, byte reg2, byte reg3, byte reg4)
 {
     this.nes              = nes;
     this.cycleIRQ         = true;
     regAddr[0]            = reg1;
     regAddr[1]            = reg2;
     regAddr[2]            = reg3;
     regAddr[3]            = reg4;
     this.nes.APU.external = new Channels.VRC6(reg1, reg2, reg3, reg4);
 }
コード例 #15
0
ファイル: APU.cs プロジェクト: DualBrain/Emu-o-Tron
        public APU(NESCore nes, int sampleRate)
        {
            this.nes        = nes;
            this.sampleRate = sampleRate;
            switch (nes.nesRegion)
            {
            default:
            case SystemType.NTSC:
                CPUClock             = 1789773;
                FPS                  = (CPUClock * 3.0) / 89341.5;
                modeZeroDelay        = 7459;//http://nesdev.parodius.com/bbs/viewtopic.php?p=64281#64281
                modeZeroFrameLengths = new int[] { 7456, 7458, 7458, 7458 };
                modeOneDelay         = 1;
                modeOneFrameLengths  = new int[] { 7458, 7456, 7458, 7458, 7452 };
                break;

            case SystemType.PAL:
                CPUClock             = 1662607;
                FPS                  = (CPUClock * 3.2) / 106392;
                modeZeroDelay        = 8315;
                modeZeroFrameLengths = new int[] { 8314, 8312, 8314, 8314 };
                modeOneDelay         = 1;
                modeOneFrameLengths  = new int[] { 8314, 8314, 8312, 8314, 8312 };
                break;
            }
            if (this.sampleRate == -1)
            {
                this.sampleRate = CPUClock;
            }
            rollingAveWindow = this.sampleRate / 10;
            SetFPS(FPS);
            output = new short[this.sampleRate]; //the buffers really don't need to be this large, but it should prevent overflows when the FPS is set exceptionally low.
            for (int i = 0; i < 32; i++)
            {
                pulseTable[i]      = ((95.52 / (8128.0 / i + 100.0)));
                pulseTableShort[i] = (int)(pulseTable[i] * 0x7FFF); //Half the range for internal channels, half for external.
            }
            for (int i = 0; i < 204; i++)
            {
                tndTable[i]      = ((163.67 / (24329.0 / i + 100.0)));
                tndTableShort[i] = (int)(tndTable[i] * 0x7FFF);
            }
            volume.square1  = 1;
            volume.square2  = 1;
            volume.triangle = 1;
            volume.noise    = 1;
            volume.dmc      = 1;
            volume.external = 1;
            square1         = new Channels.Square(nes, true, true);
            square2         = new Channels.Square(nes, true, false);
            triangle        = new Channels.Triangle(nes);
            noise           = new Channels.Noise(nes);
            dmc             = new Channels.DMC(nes, CPUClock);
            external        = new Channels.External();
        }
コード例 #16
0
ファイル: mNSF.cs プロジェクト: nickmass/Emu-o-Tron
 public mNSF(NESCore nes, byte[] banks, int PBRATE, int specialChip)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     this.speed = (nes.APU.CPUClock * 1.0) / (1000000.0 / (PBRATE * 1.0));
     for (int i = 0; i < 8; i++)
         if (banks[i] != 0)
             bankSwitching = true;
     initialBanks = banks;
     nes.APU.external = new Channels.NSF(nes, specialChip);
 }
コード例 #17
0
ファイル: m185.cs プロジェクト: nickmass/Emu-o-Tron
 public m185(NESCore nes)
 {
     this.nes = nes;
     for (int i = 0; i < 0x400; i++)
     {
         disabledChrBank[i] = 0x12;
     }
     for (int i = 0; i < 8; i++)
     {
         chrBanks[i] = nes.PPU.PPUMemory.banks[nes.PPU.PPUMemory.swapOffset + i];
     }
 }
コード例 #18
0
 public m185(NESCore nes)
 {
     this.nes = nes;
     for (int i = 0; i < 0x400; i++)
     {
         disabledChrBank[i] = 0x12;
     }
     for (int i = 0; i < 8; i++)
     {
         chrBanks[i] = nes.PPU.PPUMemory.banks[nes.PPU.PPUMemory.swapOffset + i];
     }
 }
コード例 #19
0
ファイル: APU.cs プロジェクト: nickmass/Emu-o-Tron
 public APU(NESCore nes, int sampleRate)
 {
     this.nes = nes;
     this.sampleRate = sampleRate;
     switch (nes.nesRegion)
     {
         default:
         case SystemType.NTSC:
             CPUClock = 1789773;
             FPS = (CPUClock * 3.0) / 89341.5;
             modeZeroDelay = 7459;//http://nesdev.parodius.com/bbs/viewtopic.php?p=64281#64281
             modeZeroFrameLengths = new int[] { 7456, 7458, 7458, 7458};
             modeOneDelay = 1;
             modeOneFrameLengths = new int[] { 7458, 7456, 7458, 7458, 7452};
             break;
         case SystemType.PAL:
             CPUClock = 1662607;
             FPS = (CPUClock * 3.2) / 106392;
             modeZeroDelay = 8315;
             modeZeroFrameLengths = new int[] { 8314, 8312, 8314, 8314 };
             modeOneDelay = 1;
             modeOneFrameLengths = new int[] { 8314, 8314, 8312, 8314, 8312 };
             break;
     }
     if (this.sampleRate == -1)
         this.sampleRate = CPUClock;
     rollingAveWindow = this.sampleRate / 10;
     SetFPS(FPS);
     output = new short[this.sampleRate]; //the buffers really don't need to be this large, but it should prevent overflows when the FPS is set exceptionally low.
     for (int i = 0; i < 32; i++)
     {
         pulseTable[i] = ((95.52 / (8128.0 / i + 100.0)));
         pulseTableShort[i] = (int)(pulseTable[i] * 0x7FFF); //Half the range for internal channels, half for external.
     }
     for (int i = 0; i < 204; i++)
     {
         tndTable[i] = ((163.67 / (24329.0 / i + 100.0)));
         tndTableShort[i] = (int)(tndTable[i] * 0x7FFF);
     }
     volume.square1 = 1;
     volume.square2 = 1;
     volume.triangle = 1;
     volume.noise = 1;
     volume.dmc = 1;
     volume.external = 1;
     square1 = new Channels.Square(nes, true, true);
     square2 = new Channels.Square(nes, true, false);
     triangle = new Channels.Triangle(nes);
     noise = new Channels.Noise(nes);
     dmc = new Channels.DMC(nes, CPUClock);
     external = new Channels.External();
 }
コード例 #20
0
ファイル: FamiPaddle.cs プロジェクト: DualBrain/Emu-o-Tron
 public FamiPaddle(NESCore nes, Port port) //I know this plugged into the expandsion port, but if I dont have a player number how do I know who's keybinds to use?
 {
     this.nes  = nes;
     this.port = port;
     if (port == Port.PortOne)
     {
         playerNum = 0;
     }
     else if (port == Port.PortTwo)
     {
         playerNum = 1;
     }
 }
コード例 #21
0
ファイル: mVRC4.cs プロジェクト: DualBrain/Emu-o-Tron
 public mVRC4(NESCore nes, byte reg1, byte reg2, byte reg3, byte reg4, byte altReg1, byte altReg2, byte altReg3, byte altReg4)
 {
     this.nes      = nes;
     this.cycleIRQ = true;
     regAddr[0]    = reg1;
     regAddr[1]    = reg2;
     regAddr[2]    = reg3;
     regAddr[3]    = reg4;
     altRegAddr[0] = altReg1;
     altRegAddr[1] = altReg2;
     altRegAddr[2] = altReg3;
     altRegAddr[3] = altReg4;
 }
コード例 #22
0
ファイル: Zapper.cs プロジェクト: nickmass/Emu-o-Tron
 public Zapper(NESCore nes, Port port)
 {
     this.nes = nes;
     this.port = port;
     if (port == Port.PortOne)
     {
         playerNum = 0;
     }
     else if (port == Port.PortTwo)
     {
         playerNum = 1;
     }
 }
コード例 #23
0
 public Paddle(NESCore nes, Port port)
 {
     this.nes  = nes;
     this.port = port;
     if (port == Port.PortOne)
     {
         playerNum = 0;
     }
     else if (port == Port.PortTwo)
     {
         playerNum = 1;
     }
 }
コード例 #24
0
ファイル: mVRC4.cs プロジェクト: nickmass/Emu-o-Tron
 public mVRC4(NESCore nes, byte reg1, byte reg2, byte reg3, byte reg4, byte altReg1, byte altReg2, byte altReg3, byte altReg4)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     regAddr[0] = reg1;
     regAddr[1] = reg2;
     regAddr[2] = reg3;
     regAddr[3] = reg4;
     altRegAddr[0] = altReg1;
     altRegAddr[1] = altReg2;
     altRegAddr[2] = altReg3;
     altRegAddr[3] = altReg4;
 }
コード例 #25
0
ファイル: Noise.cs プロジェクト: nickmass/Emu-o-Tron
 public Noise(NESCore nes)
 {
     this.nes = nes;
     switch (nes.nesRegion)
     {
         default:
         case SystemType.NTSC:
             periods = new ushort[] { 4, 8, 16, 32, 64, 96, 128, 160, 202, 254, 380, 508, 762, 1016, 2034, 4068 };
             break;
         case SystemType.PAL:
             periods = new ushort[] { 4, 7, 14, 30, 60, 88, 118, 148, 188, 236, 354, 472, 708, 944, 1890, 3778 };
             break;
     }
 }
コード例 #26
0
ファイル: Noise.cs プロジェクト: DualBrain/Emu-o-Tron
        public Noise(NESCore nes)
        {
            this.nes = nes;
            switch (nes.nesRegion)
            {
            default:
            case SystemType.NTSC:
                periods = new ushort[] { 4, 8, 16, 32, 64, 96, 128, 160, 202, 254, 380, 508, 762, 1016, 2034, 4068 };
                break;

            case SystemType.PAL:
                periods = new ushort[] { 4, 7, 14, 30, 60, 88, 118, 148, 188, 236, 354, 472, 708, 944, 1890, 3778 };
                break;
            }
        }
コード例 #27
0
ファイル: DMC.cs プロジェクト: nickmass/Emu-o-Tron
 public DMC(NESCore nes, int bufferSize)
 {
     this.nes = nes;
     switch (nes.nesRegion)
     {
         default:
         case SystemType.NTSC:
             rates = new int[] { 428, 380, 340, 320, 286, 254, 226, 214, 190, 160, 142, 128, 106, 84, 72, 54 };
             break;
         case SystemType.PAL:
             rates = new int[] { 398, 354, 316, 298, 276, 236, 210, 198, 176, 148, 132, 118, 98, 78, 66, 50 };
             break;
     }
     buffer = new byte[bufferSize];
 }
コード例 #28
0
 public mNSF(NESCore nes, byte[] banks, int PBRATE, int specialChip)
 {
     this.nes      = nes;
     this.cycleIRQ = true;
     this.speed    = (nes.APU.CPUClock * 1.0) / (1000000.0 / (PBRATE * 1.0));
     for (int i = 0; i < 8; i++)
     {
         if (banks[i] != 0)
         {
             bankSwitching = true;
         }
     }
     initialBanks     = banks;
     nes.APU.external = new Channels.NSF(nes, specialChip);
 }
コード例 #29
0
ファイル: DMC.cs プロジェクト: DualBrain/Emu-o-Tron
        public DMC(NESCore nes, int bufferSize)
        {
            this.nes = nes;
            switch (nes.nesRegion)
            {
            default:
            case SystemType.NTSC:
                rates = new int[] { 428, 380, 340, 320, 286, 254, 226, 214, 190, 160, 142, 128, 106, 84, 72, 54 };
                break;

            case SystemType.PAL:
                rates = new int[] { 398, 354, 316, 298, 276, 236, 210, 198, 176, 148, 132, 118, 98, 78, 66, 50 };
                break;
            }
            buffer = new byte[bufferSize];
        }
コード例 #30
0
ファイル: m020.cs プロジェクト: nickmass/Emu-o-Tron
 public m020(NESCore nes, Stream diskStream, bool ignoreFileCheck)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     diskStream.Position = 0x0;
     if (!ignoreFileCheck)
     {
         if (diskStream.ReadByte() != 'F' || diskStream.ReadByte() != 'D' || diskStream.ReadByte() != 'S' || diskStream.ReadByte() != 0x1A)
         {
             diskStream.Position = 0x0;
             if (diskStream.ReadByte() != 0x01 || diskStream.ReadByte() != '*' || diskStream.ReadByte() != 'N' || diskStream.ReadByte() != 'I')
             {
                 diskStream.Close();
                 throw (new BadHeaderException("Invalid File"));
             }
             else //NoIntro set uses many headerless roms which makes sense given how useless the header is.
             {
                 diskStream.Position = 0x0;
                 sideCount = (int)(diskStream.Length / 65500);
             }
         }
         else
         {
             diskStream.Position = 0x4;
             sideCount = diskStream.ReadByte();
             diskStream.Position = 0x10;
         }
     }
     diskData = new byte[sideCount, 65500];
     crc = 0xFFFFFFFF;
     for (int side = 0; side < sideCount; side++)
     {
         for (int i = 0; i < 65500; i++)
         {
             byte nextByte = (byte)diskStream.ReadByte();
             diskData[side, i] = nextByte;
             crc = CRC32.crc32_adjust(crc, nextByte);
         }
     }
     nes.debug.LogInfo("Disk Sides: " + sideCount.ToString());
     crc = crc ^ 0xFFFFFFFF;
     nes.APU.external = new Channels.FDS();
 }
コード例 #31
0
 public m020(NESCore nes, Stream diskStream, bool ignoreFileCheck)
 {
     this.nes            = nes;
     this.cycleIRQ       = true;
     diskStream.Position = 0x0;
     if (!ignoreFileCheck)
     {
         if (diskStream.ReadByte() != 'F' || diskStream.ReadByte() != 'D' || diskStream.ReadByte() != 'S' || diskStream.ReadByte() != 0x1A)
         {
             diskStream.Position = 0x0;
             if (diskStream.ReadByte() != 0x01 || diskStream.ReadByte() != '*' || diskStream.ReadByte() != 'N' || diskStream.ReadByte() != 'I')
             {
                 diskStream.Close();
                 throw (new BadHeaderException("Invalid File"));
             }
             else //NoIntro set uses many headerless roms which makes sense given how useless the header is.
             {
                 diskStream.Position = 0x0;
                 sideCount           = (int)(diskStream.Length / 65500);
             }
         }
         else
         {
             diskStream.Position = 0x4;
             sideCount           = diskStream.ReadByte();
             diskStream.Position = 0x10;
         }
     }
     diskData = new byte[sideCount, 65500];
     crc      = 0xFFFFFFFF;
     for (int side = 0; side < sideCount; side++)
     {
         for (int i = 0; i < 65500; i++)
         {
             byte nextByte = (byte)diskStream.ReadByte();
             diskData[side, i] = nextByte;
             crc = CRC32.crc32_adjust(crc, nextByte);
         }
     }
     nes.debug.LogInfo("Disk Sides: " + sideCount.ToString());
     crc = crc ^ 0xFFFFFFFF;
     nes.APU.external = new Channels.FDS();
 }
コード例 #32
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "NES Roms (*.nes)|*.nes";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fileName = ofd.FileName;
                //START INIT CODE
                cr  = cs.ReadCart(fileName);
                nes = new NESCore(cr);
                cpu = new NES6502(cr, nes);
                ren = new BMP16Renderer(cr);
                ppu = new PPUCore(cr, ren);

                cpu.pc_reg = nes.GetResetAddr();
                //END INIT CODE
                MessageBox.Show("PRG ROM loaded!!!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                buttons(true);
            }
        }
コード例 #33
0
ファイル: m033.cs プロジェクト: DualBrain/Emu-o-Tron
 public m033(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #34
0
ファイル: SoundVis.cs プロジェクト: nickmass/Emu-o-Tron
        public unsafe void Update(NESCore nes)
        {
            this.nes = nes;
            if (nes.APU.volume.square1 != 0)
                chanColors[0] = blue;
            else
                chanColors[0] = grey;
            if (nes.APU.volume.square2 != 0)
                chanColors[1] = blue;
            else
                chanColors[1] = grey;
            if (nes.APU.volume.triangle != 0)
                chanColors[2] = blue;
            else
                chanColors[2] = grey;
            if (nes.APU.volume.noise != 0)
                chanColors[3] = blue;
            else
                chanColors[3] = grey;
            if (nes.APU.volume.dmc != 0)
                chanColors[4] = blue;
            else
                chanColors[4] = grey;
            if (nes.APU.volume.external != 0)
                chanColors[5] = blue;
            else
                chanColors[5] = grey;

            int blueCount = 0;
            int blueItem = -1;
            for(int i = 0; i < 6; i++)
                if(chanColors[i] == blue)
                {
                    blueItem = i;
                    blueCount++;
                }
            if (blueCount == 1)
                chanColors[blueItem] = darkBlue;

            var bmd = screenBuffer.LockBits(new Rectangle(0, 0, 384, 256), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
            uint* ptr = (uint*) bmd.Scan0;
            for (int i = 0; i < 384 * 256; i++)
                ptr[i] = 0xFF000000;
            Point lastPoint;
            for (int channel = 0; channel < 6; channel++)
            {
                switch (channel)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        byte[] volume;
                        switch (channel)
                        {
                            default:
                            case 0:
                                volume = nes.debug.square1History;
                                break;
                            case 1:
                                volume = nes.debug.square2History;
                                break;
                            case 2:
                                volume = nes.debug.triangleHistory;
                                break;
                            case 3:
                                volume = nes.debug.noiseHistory;
                                break;
                        }
                        lastPoint = new Point(-1,0);
                        for (int x = 0; x < 128; x++)
                        {
                            Point newPoint = new Point(x + ((channel % 3) * 128), ((channel / 3) * 128) + ((15 - volume[x]) * 8));

                            if (channel != 2)
                            {
                                if (lastPoint.X != -1)
                                {
                                    DrawLine(lastPoint.X + 1, lastPoint.Y, newPoint.X, newPoint.Y, ptr,
                                                chanColors[channel]);
                                }
                                else
                                {
                                    DrawPixel(ptr, newPoint.X, newPoint.Y, chanColors[channel]);
                                }
                            }
                            else if (lastPoint.X != -1)
                            {
                                DrawLine(lastPoint.X, lastPoint.Y, newPoint.X, newPoint.Y, ptr,
                                         chanColors[channel]);
                            }
                            lastPoint = newPoint;
                        }
                        break;
                    case 4:
                        lastPoint = new Point(-1, 0);
                        for (int x = 0; x < 128; x++)
                        {
                            Point newPoint = new Point(x + ((channel % 3) * 128), ((channel / 3) * 128) + ((127 - nes.debug.dmcHistory[x])));
                            if (lastPoint.X != -1)
                            {
                                DrawLine(lastPoint.X, lastPoint.Y, newPoint.X, newPoint.Y, ptr, chanColors[channel]);
                            }
                            lastPoint = newPoint;
                        }
                        break;
                    case 5:
                        lastPoint = new Point(-1, 0);
                        for (int x = 0; x < 128; x++)
                        {
                            Point newPoint = new Point(x + ((channel % 3) * 128), ((channel / 3) * 128) + ((127 - (nes.debug.externalHistory[x] >> 1))));
                            if (lastPoint.X != -1)
                            {
                                DrawLine(lastPoint.X, lastPoint.Y, newPoint.X, newPoint.Y, ptr, chanColors[channel]);
                            }
                            lastPoint = newPoint;
                        }
                        break;
                }
            }
            screenBuffer.UnlockBits(bmd);
            screenGfx.DrawImageUnscaled(screenBuffer, 0,0);
        }
コード例 #35
0
ファイル: m099.cs プロジェクト: nickmass/Emu-o-Tron
 public m099(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #36
0
ファイル: m004.cs プロジェクト: nickmass/Emu-o-Tron
 public m004(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #37
0
 public m011(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #38
0
 public m228(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #39
0
ファイル: NSFScreen.cs プロジェクト: nickmass/Emu-o-Tron
 public NSFScreen(NESCore nes)
 {
     this.nes = nes;
     LoadCharSheet();
 }
コード例 #40
0
ファイル: Square.cs プロジェクト: nickmass/Emu-o-Tron
 public Square(NESCore nes, bool sweep, bool negate)
 {
     this.nes = nes;
     this.negate = negate;
     this.sweep = sweep; //Allows for reuse as MMC5 square
 }
コード例 #41
0
 public m105(NESCore nes)
 {
     this.nes      = nes;
     this.cycleIRQ = true;
 }
コード例 #42
0
 public m066(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #43
0
ファイル: m069.cs プロジェクト: DualBrain/Emu-o-Tron
 public m069(NESCore nes)
 {
     this.nes              = nes;
     this.cycleIRQ         = true;
     this.nes.APU.external = new Channels.FME7();
 }
コード例 #44
0
ファイル: SPPU.cs プロジェクト: nickmass/Emu-o-Tron
        public SPPU(NESCore nes)
        {
            this.nes = nes;
            int vRAM = 0;
            if (nes.rom.vROM == 0 || nes.rom.mapper == 19 || nes.rom.mapper == 210)
                vRAM += 8;
            PPUMemory = new MemoryStore(4, nes.rom.vROM, vRAM, true); //4 hardwired to make doing extra nametables less insane.

            for (int i = 0; i < 256; i++)
                zeroGray[i] = 0x3F;

            switch (nes.nesRegion)
            {
                default:
                case SystemType.NTSC:
                    vblankEnd = 261;
                    break;
                case SystemType.PAL:
                    vblankEnd = 312;
                    break;

            }
        }
コード例 #45
0
ファイル: m152.cs プロジェクト: nickmass/Emu-o-Tron
 public m152(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #46
0
ファイル: m033.cs プロジェクト: nickmass/Emu-o-Tron
 public m033(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #47
0
ファイル: m071.cs プロジェクト: nickmass/Emu-o-Tron
 public m071(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #48
0
ファイル: m069.cs プロジェクト: nickmass/Emu-o-Tron
 public m069(NESCore nes)
 {
     this.nes = nes;
     this.cycleIRQ = true;
     this.nes.APU.external = new Channels.FME7();
 }
コード例 #49
0
ファイル: m048.cs プロジェクト: nickmass/Emu-o-Tron
 public m048(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #50
0
 public NSFScreen(NESCore nes)
 {
     this.nes = nes;
     LoadCharSheet();
 }
コード例 #51
0
ファイル: m005.cs プロジェクト: nickmass/Emu-o-Tron
 public m005(NESCore nes)
 {
     this.nes = nes;
     nes.APU.external = new Channels.MMC5(nes);
 }
コード例 #52
0
ファイル: PPU.cs プロジェクト: nickmass/Emu-o-Tron
        public PPU(NESCore nes)
        {
            this.nes = nes;
            int vRAM = 0;
            if (nes.rom.vROM == 0 || nes.rom.mapper == 19 || nes.rom.mapper == 210)
                vRAM += 8;
            PPUMemory = new MemoryStore(4, nes.rom.vROM, vRAM, true); //4 hardwired to make doing extra nametables less insane.

            switch (nes.nesRegion)
            {
                default:
                case SystemType.NTSC:
                    vblankEnd = 261;
                    break;
                case SystemType.PAL:
                    vblankEnd = 311;
                    break;
            }
            horzFlipTable = new byte[256];
            for (int i = 0; i < 256; i++)
            {
                horzFlipTable[i] = 0;
                if ((i & 0x80) != 0)
                    horzFlipTable[i] |= 0x01;
                if ((i & 0x40) != 0)
                    horzFlipTable[i] |= 0x02;
                if ((i & 0x20) != 0)
                    horzFlipTable[i] |= 0x04;
                if ((i & 0x10) != 0)
                    horzFlipTable[i] |= 0x08;
                if ((i & 0x08) != 0)
                    horzFlipTable[i] |= 0x10;
                if ((i & 0x04) != 0)
                    horzFlipTable[i] |= 0x20;
                if ((i & 0x02) != 0)
                    horzFlipTable[i] |= 0x40;
                if ((i & 0x01) != 0)
                    horzFlipTable[i] |= 0x80;
            }
        }
コード例 #53
0
ファイル: Unisystem.cs プロジェクト: nickmass/Emu-o-Tron
 public Unisystem(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #54
0
ファイル: m079.cs プロジェクト: DualBrain/Emu-o-Tron
 public m079(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #55
0
ファイル: m086.cs プロジェクト: nickmass/Emu-o-Tron
 public m086(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #56
0
 public m113(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #57
0
ファイル: m080.cs プロジェクト: DualBrain/Emu-o-Tron
 public m080(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #58
0
ファイル: m067.cs プロジェクト: nickmass/Emu-o-Tron
 public m067(NESCore nes)
 {
     this.nes = nes;
     this.cycleIRQ = true;
 }
コード例 #59
0
ファイル: m007.cs プロジェクト: DualBrain/Emu-o-Tron
 public m007(NESCore nes)
 {
     this.nes = nes;
 }
コード例 #60
0
ファイル: Triangle.cs プロジェクト: nickmass/Emu-o-Tron
 public Triangle(NESCore nes)
 {
     this.nes = nes;
 }