Added AY38912 support

This commit is contained in:
2026-04-30 14:35:12 +01:00
parent 3d13425d51
commit d90537de59
7 changed files with 223 additions and 29 deletions

View File

@@ -547,7 +547,7 @@ namespace Core.Cpu
return (ushort)((high << 8) | low);
}
private int ExecuteOpcode(byte opcode)
internal int ExecuteOpcode(byte opcode)
{
sbyte offset = 0;
byte oldCarry = 0;
@@ -1588,6 +1588,32 @@ namespace Core.Cpu
AF.Low = flags;
return 16;
}
case 0xAB: // OUTD
{
// 1. Read the byte from memory at the HL address (Applying Wait States!)
byte outdVal = ReadMemory(HL.Word);
// 2. Decrement the B register
BC.High--;
// 3. Output that byte to the hardware port stored in BC
_simpleIoBus.WritePort(BC.Word, outdVal);
// 4. Decrement HL
HL.Word--;
// 5. Update Flags
// The N flag (Bit 1) is always set.
AF.Low |= 0x02;
// The Z flag (Bit 6) is set if B reaches 0, otherwise cleared.
if (BC.High == 0)
AF.Low |= 0x40;
else
AF.Low &= 0xBF;
return 16; // Takes 16 T-States
}
case 0xB9: // CPDR
{
byte memVal = ReadMemory(HL.Word);