Plus 3 mode fully working. Added Plus 3 keyboard

This commit is contained in:
2026-04-30 15:42:54 +01:00
parent d90537de59
commit bc2748250d
5 changed files with 67 additions and 21 deletions

View File

@@ -54,6 +54,7 @@ namespace Core.Io
// The perfectly cropped, 320x256 Scanline Renderer
public void RenderScanline(int scanline)
{
byte[] videoRam = _memoryBus.GetVideoRam();
// 1. Drop the invisible lines instantly (VBlank/Overscan)
if (scanline < 32 || scanline > 287) return;
@@ -91,11 +92,18 @@ namespace Core.Io
// Draw the 32 horizontal character blocks of the visible screen
for (int col = 0; col < 32; col++)
{
ushort pixelAddress = (ushort)(0x4000 | (third << 11) | (pixelRow << 8) | (characterRow << 5) | col);
ushort attrAddress = (ushort)(0x5800 + (y / 8) * 32 + col);
// Calculate the exact internal array offsets (Base 0, no 0x4000 needed!)
int pixelOffset = (third << 11) | (pixelRow << 8) | (characterRow << 5) | col;
int attrOffset = 0x1800 + (y / 8) * 32 + col;
byte pixels = _memoryBus.Read(pixelAddress);
byte attr = _memoryBus.Read(attrAddress);
// Read directly from the raw array
byte pixels = videoRam[pixelOffset];
byte attr = videoRam[attrOffset];
//ushort pixelAddress = (ushort)(0x4000 | (third << 11) | (pixelRow << 8) | (characterRow << 5) | col);
//ushort attrAddress = (ushort)(0x5800 + (y / 8) * 32 + col);
//byte pixels = _memoryBus.Read(pixelAddress);
//byte attr = _memoryBus.Read(attrAddress);
int ink = attr & 0x07;
int paper = (attr >> 3) & 0x07;