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));

View File

@@ -84,7 +84,7 @@ namespace Desktop
// The pure Core logic processes the bytes
_cpu._tapManager.LoadTapData(tapBytes);
MessageBox.Show("Tape inserted! Type LOAD \"\" and press Enter.", "Tape Deck");
//MessageBox.Show("Tape inserted! Type LOAD \"\" and press Enter.", "Tape Deck");
}
}
}
@@ -198,16 +198,14 @@ namespace Desktop
{
switch (key)
{
//1:6 -
//Row 0: CAPS_SHIFT, Z, X, C, V
//Row 0:
case Keys.ShiftKey: UpdateMatrix(0, 0, isPressed); break;
case Keys.Z: UpdateMatrix(0, 1, isPressed); break;
case Keys.X: UpdateMatrix(0, 2, isPressed); break;
case Keys.C: UpdateMatrix(0, 3, isPressed); break;
case Keys.V: UpdateMatrix(0, 4, isPressed); break;
// Row 1: A, S, D, F, G
// Row 1
case Keys.A: UpdateMatrix(1, 0, isPressed); break;
case Keys.S: UpdateMatrix(1, 1, isPressed); break;
case Keys.D: UpdateMatrix(1, 2, isPressed); break;
@@ -242,14 +240,14 @@ namespace Desktop
case Keys.U: UpdateMatrix(5, 3, isPressed); break;
case Keys.Y: UpdateMatrix(5, 4, isPressed); break;
// Row 6: ENTER, L, K, J, H
// Row 6
case Keys.Enter: UpdateMatrix(6, 0, isPressed); break;
case Keys.L: UpdateMatrix(6, 1, isPressed); break;
case Keys.K: UpdateMatrix(6, 2, isPressed); break;
case Keys.J: UpdateMatrix(6, 3, isPressed); break;
case Keys.H: UpdateMatrix(6, 4, isPressed); break;
// Row 7: SPACE, SYM SHIFT, M, N, B
// Row 7
case Keys.Space: UpdateMatrix(7, 0, isPressed); break;
case Keys.ControlKey: UpdateMatrix(7, 1, isPressed); break; // Symbol Shift
case Keys.M: UpdateMatrix(7, 2, isPressed); break;