small amount of work on NES Sprite viewer, added nesasm.pdf to NES docs

This commit is contained in:
andres.delikat 2011-07-16 18:16:21 +00:00
parent b1abe27bfc
commit 7445ff887c
4 changed files with 81 additions and 56 deletions

Binary file not shown.

View File

@ -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()

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}