Almost runs Chuckie Egg. LDI to implement next

This commit is contained in:
2026-04-19 01:38:53 +01:00
parent ed64eb2ebe
commit 1ccacb55d5
2 changed files with 163 additions and 1 deletions

View File

@@ -433,6 +433,10 @@ namespace Desktop
mnemonic = $"LD H, 0x{hImm:X2}";
instructionLength = 2;
break;
case 0x27: // DAA
mnemonic = "DAA";
instructionLength = 1;
break;
case 0x28:
sbyte jrZOffset = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
ushort jrZDest = (ushort)(currentPc + 2 + jrZOffset);
@@ -845,12 +849,39 @@ namespace Desktop
mnemonic = $"LD (0x{nn:X4}), IX";
instructionLength = 4;
}
else if (ddOpcode == 0x24) // INC IXH
{
mnemonic = "INC IXH";
instructionLength = 2;
}
else if (ddOpcode == 0x25) // DEC IXH
{
mnemonic = "DEC IXH";
instructionLength = 2;
}
else if (ddOpcode == 0x26) // LD IXH, n
{
byte nValue = _memoryBus.Read((ushort)(currentPc + 2));
mnemonic = $"LD IXH, 0x{nValue:X2}";
instructionLength = 3;
}
else if (ddOpcode == 0x2A) // LD IX, (nn)
{
ushort nn = (ushort)(_memoryBus.Read((ushort)(currentPc + 2)) | (_memoryBus.Read((ushort)(currentPc + 3)) << 8));
mnemonic = $"LD IX, (0x{nn:X4})";
instructionLength = 4;
}
else if (ddOpcode == 0x2D) // DEC IXL
{
mnemonic = "DEC IXL";
instructionLength = 2;
}
else if (ddOpcode == 0x2E) // LD IXL, n
{
byte nValue = _memoryBus.Read((ushort)(currentPc + 2));
mnemonic = $"LD IXL, 0x{nValue:X2}";
instructionLength = 3;
}
else if (ddOpcode == 0x36) // LD (IX+d), n
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -895,6 +926,11 @@ namespace Desktop
mnemonic = $"LD H, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x68) // LD IXL, B
{
mnemonic = "LD IXL, B";
instructionLength = 2;
}
else if (ddOpcode == 0x6E) // LD L, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -916,6 +952,17 @@ namespace Desktop
mnemonic = $"LD (IX{sign}{d}), L";
instructionLength = 3;
}
else if (ddOpcode == 0x77) // LD (IX+d), A
{
// Read the 3rd byte (the displacement)
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
// Format nicely with a + or - sign
string sign = offset >= 0 ? "+" : "";
mnemonic = $"LD (IX{sign}{offset}), A";
instructionLength = 3;
}
else if (ddOpcode == 0x7E) // LD A, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -1024,6 +1071,7 @@ namespace Desktop
mnemonic = $"LD DE, (0x{addr5B:X4})";
instructionLength = 4;
break;
case 0x5F: mnemonic = "LD A, R"; instructionLength = 2; break;
case 0x6A: mnemonic = "ADC HL, HL"; instructionLength = 2; break;
case 0x62: mnemonic = "SBC HL, HL"; instructionLength = 2; break;
case 0x73: