diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/nesasm.pdf b/BizHawk.Emulation/Consoles/Nintendo/Docs/nesasm.pdf new file mode 100644 index 0000000000..c4a886f03e Binary files /dev/null and b/BizHawk.Emulation/Consoles/Nintendo/Docs/nesasm.pdf differ diff --git a/BizHawk.MultiClient/NEStools/NESPPU.cs b/BizHawk.MultiClient/NEStools/NESPPU.cs index e8461ad717..f2306a25a4 100644 --- a/BizHawk.MultiClient/NEStools/NESPPU.cs +++ b/BizHawk.MultiClient/NEStools/NESPPU.cs @@ -117,6 +117,31 @@ namespace BizHawk.MultiClient } PatternView.pattern.UnlockBits(bmpdata); PatternView.Refresh(); + + int SpriteNum, TileNum, Attr, MemAddr; + + //Sprite Viewer + for (int y = 0; y < 4; y++) + { + for (int x = 0; x < 16; x++) + { + SpriteNum = (y << 4) | x; + TileNum = 0; //TODO + Attr = 0; //TODO + if (((int)Nes.ppu.reg_2000.Value & (int)0x20) > 0) //TODO why is C# being retarded about using & with a byte? + { + MemAddr = ((TileNum & 0xFE) << 4) | ((TileNum & 0x01) << 12); + //DrawTile(SprArray + y * 24 * D_SPR_W + x * 16, MemAddr, 4 | (Attr & 3), D_SPR_W); + //DrawTile(SprArray + y * 24 * D_SPR_W + x * 16 + 8 * D_SPR_W, MemAddr + 16, 4 | (Attr & 3), D_SPR_W); + + } + else + { + MemAddr = (TileNum << 4) | ((Nes.ppu.reg_2000.Value & (byte)0x08) << 9); + //DrawTile(SprArray + y * 24 * D_SPR_W + x * 16, MemAddr, 4 | (Attr & 3), D_SPR_W); + } + } + } } public unsafe void UpdateValues() diff --git a/BizHawk.MultiClient/NEStools/PatternViewer.cs b/BizHawk.MultiClient/NEStools/PatternViewer.cs index 2636525d74..5cf0b5b02a 100644 --- a/BizHawk.MultiClient/NEStools/PatternViewer.cs +++ b/BizHawk.MultiClient/NEStools/PatternViewer.cs @@ -8,36 +8,36 @@ using System.Globalization; namespace BizHawk.MultiClient { - public class PatternViewer : Control - { - Size pSize; - public Bitmap pattern; - public int Pal0 = 0; //0-7 Palette choice - public int Pal1 = 0; + public class PatternViewer : Control + { + Size pSize; + public Bitmap pattern; + public int Pal0 = 0; //0-7 Palette choice + public int Pal1 = 0; - public PatternViewer() - { - pSize = new Size(256, 128); - pattern = new Bitmap(pSize.Width, pSize.Height); - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.DoubleBuffer, true); - this.Size = pSize; - this.BackColor = Color.White; - this.Paint += new System.Windows.Forms.PaintEventHandler(this.PatternViewer_Paint); - } + public PatternViewer() + { + pSize = new Size(256, 128); + pattern = new Bitmap(pSize.Width, pSize.Height); + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + this.Size = pSize; + this.BackColor = Color.White; + this.Paint += new System.Windows.Forms.PaintEventHandler(this.PatternViewer_Paint); + } - private void Display(Graphics g) - { - unchecked - { - g.DrawImage(pattern, 1, 1); - } - } + private void Display(Graphics g) + { + unchecked + { + g.DrawImage(pattern, 1, 1); + } + } - private void PatternViewer_Paint(object sender, PaintEventArgs e) - { - Display(e.Graphics); - } - } + private void PatternViewer_Paint(object sender, PaintEventArgs e) + { + Display(e.Graphics); + } + } } diff --git a/BizHawk.MultiClient/NEStools/SpriteViewer.cs b/BizHawk.MultiClient/NEStools/SpriteViewer.cs index 5fd0962e1d..ead837c805 100644 --- a/BizHawk.MultiClient/NEStools/SpriteViewer.cs +++ b/BizHawk.MultiClient/NEStools/SpriteViewer.cs @@ -8,34 +8,34 @@ using System.Globalization; namespace BizHawk.MultiClient { - public class SpriteViewer : Control - { - Size pSize; - public Bitmap pattern; + public class SpriteViewer : Control + { + Size pSize; + public Bitmap sprites; - public SpriteViewer() - { - pSize = new Size(256, 128); - pattern = new Bitmap(pSize.Width, pSize.Height); - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.DoubleBuffer, true); - this.Size = pSize; - this.BackColor = Color.White; - this.Paint += new System.Windows.Forms.PaintEventHandler(this.SpriteViewer_Paint); - } + public SpriteViewer() + { + pSize = new Size(256, 128); + sprites = new Bitmap(pSize.Width, pSize.Height); + SetStyle(ControlStyles.AllPaintingInWmPaint, true); + SetStyle(ControlStyles.UserPaint, true); + SetStyle(ControlStyles.DoubleBuffer, true); + this.Size = pSize; + this.BackColor = Color.White; + this.Paint += new System.Windows.Forms.PaintEventHandler(this.SpriteViewer_Paint); + } - private void Display(Graphics g) - { - unchecked - { - g.DrawImage(pattern, 1, 1); - } - } + private void Display(Graphics g) + { + unchecked + { + g.DrawImage(sprites, 1, 1); + } + } - private void SpriteViewer_Paint(object sender, PaintEventArgs e) - { - Display(e.Graphics); - } - } + private void SpriteViewer_Paint(object sender, PaintEventArgs e) + { + Display(e.Graphics); + } + } }