Implemented many more OpCodes - again, again!

This commit is contained in:
2026-04-13 22:51:20 +01:00
parent 9496c26004
commit 08d718f41e
2 changed files with 67 additions and 7 deletions

View File

@@ -282,6 +282,14 @@ namespace Desktop
mnemonic = $"LD D, 0x{dImm:X2}";
instructionLength = 2;
break;
case 0x18:
sbyte dUnconditional = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
// Calculate the target address based on the PC *after* this 2-byte instruction
ushort targetAddressUnconditional = (ushort)(currentPc + 2 + dUnconditional);
mnemonic = $"JR 0x{targetAddressUnconditional:X4}";
instructionLength = 2;
break;
case 0x19:
mnemonic = "ADD HL, DE";
break;
@@ -453,6 +461,9 @@ namespace Desktop
mnemonic = $"SBC A, 0x{sbcValue:X2}";
instructionLength = 2;
break;
case 0xE9:
mnemonic = "JP (HL)";
break;
case 0xEB:
mnemonic = "EX DE, HL";
break;
@@ -578,15 +589,26 @@ namespace Desktop
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
byte cbOpcode = _memoryBus.Read((ushort)(currentPc + 3));
string sign = d >= 0 ? "+" : "";
if (cbOpcode == 0xCE)
{
mnemonic = $"SET 1, (IY{sign}{d})";
}
else if (cbOpcode == 0x8E)
if (cbOpcode == 0x8E)
{
mnemonic = $"RES 1, (IY{sign}{d})";
}
else if (cbOpcode == 0xAE)
{
mnemonic = $"RES 5, (IY{sign}{d})";
}
else if (cbOpcode == 0xC6)
{
mnemonic = $"SET 0, (IY{sign}{d})";
}
else if (cbOpcode == 0xCE)
{
mnemonic = $"SET 1, (IY{sign}{d})";
}
else if (cbOpcode == 0xE6)
{
mnemonic = $"SET 4, (IY{sign}{d})";
}
else
{
mnemonic = $"FD CB {d:X2} {cbOpcode:X2}"; // Fallback