More keys. Implemented Border. Completes LOAD readiness sequence

This commit is contained in:
2026-04-18 01:55:08 +01:00
parent 389df3780e
commit 47f3a76bb2
5 changed files with 188 additions and 34 deletions

View File

@@ -5,8 +5,10 @@ namespace Core.Io
{
public class IO_Bus
{
// 8 rows representing the Spectrum keyboard matrix. Default to 0xFF (unpressed).
public byte[] KeyboardRows = new byte[8] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
public byte BorderColorIndex { get; private set; } = 7; // 7 is White
// 8 rows representing the Spectrum keyboard matrix. Default to 0xFF (unpressed).
public byte[] KeyboardRows = new byte[8] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
public byte ReadPort(ushort portAddress)
{
@@ -35,9 +37,17 @@ namespace Core.Io
return 0xFF;
}
public void WritePort(ushort portAddress, byte portValue)
public void WritePort(ushort portAddress, byte portValue)
{
// The ULA intercepts any write to an even port address
if ((portAddress & 0x01) == 0)
{
// The bottom 3 bits (0-2) define the border color!
BorderColorIndex = (byte)(portValue & 0x07);
// (Bits 3 and 4 handle the cassette MIC output and the internal speaker,
// which we will need when we start playing audio!)
}
}
}
}
}