Chuckie Egg runs fully from a snapshot file! Fully playable!

This commit is contained in:
2026-04-20 12:51:04 +01:00
parent e53661ce8a
commit 7464b29fca
2 changed files with 256 additions and 37 deletions

View File

@@ -832,11 +832,10 @@ namespace Desktop
case 0xDD:
{
byte ddOpcode = _memoryBus.Read((ushort)(currentPc + 1));
if (ddOpcode == 0x09) // ADD IX, BC
{
mnemonic = "ADD IX, BC";
instructionLength = 2;
}
if (ddOpcode == 0x09) { mnemonic = "ADD IX, BC"; instructionLength = 2; }
else if (ddOpcode == 0x19) { mnemonic = "ADD IX, DE"; instructionLength = 2; }
else if (ddOpcode == 0x29) { mnemonic = "ADD IX, IX"; instructionLength = 2; }
else if (ddOpcode == 0x39) { mnemonic = "ADD IX, SP"; instructionLength = 2; }
else if (ddOpcode == 0x21) // LD IX, nn
{
ushort ixVal = (ushort)(_memoryBus.Read((ushort)(currentPc + 2)) | (_memoryBus.Read((ushort)(currentPc + 3)) << 8));
@@ -892,6 +891,20 @@ namespace Desktop
mnemonic = $"LD IXL, 0x{nValue:X2}";
instructionLength = 3;
}
else if (ddOpcode == 0x34) // INC (IX+d)
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"INC (IX{sign}{offset})";
instructionLength = 3;
}
else if (ddOpcode == 0x35) // DEC (IX+d)
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"DEC (IX{sign}{offset})";
instructionLength = 3;
}
else if (ddOpcode == 0x36) // LD (IX+d), n
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -936,11 +949,26 @@ namespace Desktop
mnemonic = $"LD H, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x67) // LD IXH, A
{
mnemonic = "LD IXH, A";
instructionLength = 2;
}
else if (ddOpcode == 0x68) // LD IXL, B
{
mnemonic = "LD IXL, B";
instructionLength = 2;
}
else if (ddOpcode == 0x69) // LD IXL, C
{
mnemonic = "LD IXL, C";
instructionLength = 2;
}
else if (ddOpcode == 0x6A) // LD IXL, D
{
mnemonic = "LD IXL, D";
instructionLength = 2;
}
else if (ddOpcode == 0x6E) // LD L, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -948,6 +976,20 @@ namespace Desktop
mnemonic = $"LD L, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x72) // LD (IX+d), D
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"LD (IX{sign}{offset}), D";
instructionLength = 3;
}
else if (ddOpcode == 0x73) // LD (IX+d), E
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"LD (IX{sign}{offset}), E";
instructionLength = 3;
}
else if (ddOpcode == 0x74) // LD (IX+d), H
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -973,6 +1015,11 @@ namespace Desktop
instructionLength = 3;
}
else if (ddOpcode == 0x7C) // LD A, IXH
{
mnemonic = "LD A, IXH";
instructionLength = 2;
}
else if (ddOpcode == 0x7E) // LD A, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -980,6 +1027,35 @@ namespace Desktop
mnemonic = $"LD A, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x86)
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"ADD A, (IX{sign}{offset})";
instructionLength = 3;
}
else if (ddOpcode == 0x96)
{
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = offset >= 0 ? "+" : "";
mnemonic = $"SUB (IX{sign}{offset})";
instructionLength = 3;
}
else if (ddOpcode == 0xCB)
{
// DD CB instructions are 4 bytes long!
sbyte offset = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
cbOp = _memoryBus.Read((ushort)(currentPc + 3));
int operation = cbOp >> 6;
int bitIndex = (cbOp >> 3) & 0x07;
string sign = offset >= 0 ? "+" : "";
if (operation == 1) mnemonic = $"BIT {bitIndex}, (IX{sign}{offset})";
else mnemonic = $"DD CB (IX{sign}{offset}) {cbOp:X2}"; // Fallback
instructionLength = 4;
}
else if (ddOpcode == 0xBE) // CP (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -1081,6 +1157,7 @@ namespace Desktop
mnemonic = $"LD DE, (0x{addr5B:X4})";
instructionLength = 4;
break;
case 0x5E: mnemonic = "IM 2"; instructionLength = 2; 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;