Got main system and VDP working! There is a display!

This commit is contained in:
2026-05-10 02:43:11 +01:00
parent 778f03b55c
commit f4e279b9c8
8 changed files with 516 additions and 104 deletions

View File

@@ -1,11 +1,11 @@
using Core.Interfaces;
using Core.Video;
namespace Core.Io
{
public class SmsIoBus : IIoBus
{
// We will wire these up in the next phases!
// public Vdp VideoProcessor { get; set; }
public SmsVdp VideoProcessor { get; set; }
// public Psg AudioProcessor { get; set; }
// Joypad State (0xFF means no buttons pressed - the SMS uses Active-Low logic!)
@@ -18,11 +18,17 @@ namespace Core.Io
// hardware only physically wires up the bottom 8 bits.
byte lowerPort = (byte)(port & 0xFF);
if (lowerPort == 0x7E)
{
// VDP V-Counter (Vertical Scanline Position)
return VideoProcessor.ReadVCounter();
}
if (lowerPort >= 0x80 && lowerPort <= 0xBF)
{
// VDP Read (Usually 0xBE for VRAM Data, 0xBF for Status Flags)
// return VideoProcessor.ReadPort(lowerPort);
return 0x00;
// Even ports (like 0xBE) are Data. Odd ports (like 0xBF) are Control.
if ((lowerPort & 0x01) == 0) return VideoProcessor.ReadDataPort();
else return VideoProcessor.ReadControlPort();
}
if (lowerPort == 0xDC)
{
@@ -49,8 +55,8 @@ namespace Core.Io
}
else if (lowerPort >= 0x80 && lowerPort <= 0xBF)
{
// VDP Write (Usually 0xBE for VRAM Data, 0xBF for Control Registers)
// VideoProcessor.WritePort(lowerPort, value);
if ((lowerPort & 0x01) == 0) VideoProcessor.WriteDataPort(value);
else VideoProcessor.WriteControlPort(value);
}
else if (lowerPort <= 0x3F)
{