Updated VDP to handle GameGear. Added Turbo mode. Versio 1.0 me thinks!

This commit is contained in:
2026-05-18 14:57:19 +01:00
parent be43019fb0
commit 66f18d0510
5 changed files with 213 additions and 113 deletions

View File

@@ -20,7 +20,7 @@ namespace Desktop
this.Text = "VRAM Viewer (512 Tiles)";
// 256x128 native resolution, scaled up by 2 for visibility!
this.ClientSize = new Size(1024, 512);
this.ClientSize = new Size(512, 256);
this.DoubleBuffered = true;
this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
@@ -45,7 +45,6 @@ namespace Desktop
int tileX = (tile % 32) * 8;
int tileY = (tile / 32) * 8;
int tileAddress = tile * 32;
// Decode the 8x8 pixels
for (int y = 0; y < 8; y++)
{
@@ -57,19 +56,19 @@ namespace Desktop
for (int x = 0; x < 8; x++)
{
int shift = 7 - x;
int colorIndex = ((bp0 >> shift) & 1) | (((bp1 >> shift) & 1) << 1) |
int colourIndex = ((bp0 >> shift) & 1) | (((bp1 >> shift) & 1) << 1) |
(((bp2 >> shift) & 1) << 2) | (((bp3 >> shift) & 1) << 3);
// Use the Sprite Palette (Offset 16) so characters and enemies are colored correctly
byte smsColor = _vdp.CRAM[16 + colorIndex];
int r = (smsColor & 0x03) * 85;
int g = ((smsColor >> 2) & 0x03) * 85;
int b = ((smsColor >> 4) & 0x03) * 85;
int colour = _vdp.GetRgbColour(16, colourIndex);
//int r = (smsColor & 0x03) * 85;
//int g = ((smsColor >> 2) & 0x03) * 85;
//int b = ((smsColor >> 4) & 0x03) * 85;
// Background color (Index 0) is technically transparent for sprites, so we render it as magenta
if (colorIndex == 0) { r = 255; g = 0; b = 255; }
//if (colourIndex == 0) { int r = 255; int g = 0; int b = 255; }
_pixelData[((tileY + y) * 256) + (tileX + x)] = (255 << 24) | (r << 16) | (g << 8) | b;
_pixelData[((tileY + y) * 256) + (tileX + x)] = colourIndex == 0 ? (255 << 24) | (255 << 16) | (0 << 8) | 255 : colour;
}
}
}