Got Chuckie Egg TAP to load to the title screen!

This commit is contained in:
2026-04-18 21:57:25 +01:00
parent 7bc85a485b
commit 717c431b9c
3 changed files with 136 additions and 195 deletions

View File

@@ -385,6 +385,10 @@ namespace Desktop
mnemonic = $"LD D, 0x{dImm:X2}";
instructionLength = 2;
break;
case 0x17: // RLA
mnemonic = "RLA";
instructionLength = 1;
break;
case 0x18:
sbyte dUnconditional = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
// Calculate the target address based on the PC *after* this 2-byte instruction
@@ -753,12 +757,11 @@ namespace Desktop
case 0xCB:
cbOp = _memoryBus.Read((ushort)(currentPc + 1));
// --- THE MISSING MATH EXTRACTION ---
opGroup = cbOp >> 6; // 00 = Shift, 01 = BIT, 10 = RES, 11 = SET
targetBit = (cbOp >> 3) & 0x07; // Extracts a number 0-7
regIdx = cbOp & 0x07; // Extracts register index 0-7
// Map the 0-7 index directly to the Z80 register names
// Map the 0-7 index directly to the Z80 register names
targetReg = regNames[regIdx];
if (opGroup == 0) // Shift/Rotate Group (0x00 to 0x3F)
@@ -779,13 +782,9 @@ namespace Desktop
{
mnemonic = $"SET {targetBit}, {targetReg}";
}
else if (opGroup == 7) // SRL Group (0x38 to 0x3F)
{
mnemonic = $"SET {targetBit}, {targetReg}";
}
else
{
mnemonic = $"EXT UNKNOWN (ED {cbOp:X2})";
mnemonic = $"CB UNKNOWN (CB {cbOp:X2})";
}
instructionLength = 2;
break;
@@ -841,6 +840,18 @@ namespace Desktop
mnemonic = $"LD IX, 0x{ixVal:X4}";
instructionLength = 4;
}
else if (ddOpcode == 0x22) // LD (nn), IX
{
ushort nn = (ushort)(_memoryBus.Read((ushort)(currentPc + 2)) | (_memoryBus.Read((ushort)(currentPc + 3)) << 8));
mnemonic = $"LD (0x{nn:X4}), IX";
instructionLength = 4;
}
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 == 0x36) // LD (IX+d), n
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -850,6 +861,20 @@ namespace Desktop
mnemonic = $"LD (IX{sign}{d}), 0x{n:X2}";
instructionLength = 4;
}
else if (ddOpcode == 0x46) // LD B, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = d >= 0 ? "+" : "";
mnemonic = $"LD B, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x4E) // LD C, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = d >= 0 ? "+" : "";
mnemonic = $"LD C, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x56) // LD D, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
@@ -864,6 +889,13 @@ namespace Desktop
mnemonic = $"LD E, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x66) // LD H, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
string sign = d >= 0 ? "+" : "";
mnemonic = $"LD H, (IX{sign}{d})";
instructionLength = 3;
}
else if (ddOpcode == 0x6E) // LD L, (IX+d)
{
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));