Implemented many more OpCodes
This commit is contained in:
@@ -117,6 +117,30 @@ namespace Desktop
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
private void btnReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 1. Safely stop the emulator if it is currently in a Run loop
|
||||
if (_isRunning)
|
||||
{
|
||||
_isRunning = false;
|
||||
btnRun.Text = "Run";
|
||||
}
|
||||
|
||||
// 2. Power cycle the CPU
|
||||
_cpu.Reset();
|
||||
|
||||
// Note: A true hard reset also wipes the RAM.
|
||||
// If you add a RAM clear method to your MemoryBus later, call it here!
|
||||
_memoryBus.ClearRam(); //To Do
|
||||
|
||||
// 3. Clear the UI tracking lists
|
||||
lstDisassembly.Items.Clear();
|
||||
lstStack.Items.Clear();
|
||||
|
||||
// 4. Force a full UI refresh to show the clean slate
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
@@ -253,6 +277,11 @@ namespace Desktop
|
||||
mnemonic = $"LD DE, 0x{deHigh:X2}{deLow:X2}";
|
||||
instructionLength = 3;
|
||||
break;
|
||||
case 0x16:
|
||||
byte dImm = _memoryBus.Read((ushort)(currentPc + 1));
|
||||
mnemonic = $"LD D, 0x{dImm:X2}";
|
||||
instructionLength = 2;
|
||||
break;
|
||||
case 0x19:
|
||||
mnemonic = "ADD HL, DE";
|
||||
break;
|
||||
@@ -321,6 +350,9 @@ namespace Desktop
|
||||
case 0x47:
|
||||
mnemonic = "LD B, A";
|
||||
break;
|
||||
case 0x5F:
|
||||
mnemonic = "LD E, A";
|
||||
break;
|
||||
case 0x62:
|
||||
mnemonic = "LD H, D";
|
||||
break;
|
||||
@@ -330,6 +362,9 @@ namespace Desktop
|
||||
case 0x77:
|
||||
mnemonic = "LD (HL), A";
|
||||
break;
|
||||
case 0x91:
|
||||
mnemonic = "SUB C";
|
||||
break;
|
||||
case 0xA7:
|
||||
mnemonic = "AND A";
|
||||
break;
|
||||
@@ -346,6 +381,9 @@ namespace Desktop
|
||||
mnemonic = $"JP 0x{jpHigh:X2}{jpLow:X2}";
|
||||
instructionLength = 3;
|
||||
break;
|
||||
case 0xC9:
|
||||
mnemonic = "RET";
|
||||
break;
|
||||
case 0xCD:
|
||||
ushort callDest = (ushort)(_memoryBus.Read((ushort)(currentPc + 1)) | (_memoryBus.Read((ushort)(currentPc + 2)) << 8));
|
||||
mnemonic = $"CALL 0x{callDest:X4}";
|
||||
@@ -435,6 +473,14 @@ namespace Desktop
|
||||
mnemonic = $"DEC (IY{sign}{d})";
|
||||
instructionLength = 3;
|
||||
}
|
||||
else if (fdOpcode == 0x36) // LD (IY+d), n
|
||||
{
|
||||
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
|
||||
byte n = _memoryBus.Read((ushort)(currentPc + 3));
|
||||
string sign = d >= 0 ? "+" : "";
|
||||
mnemonic = $"LD (IY{sign}{d}), 0x{n:X2}";
|
||||
instructionLength = 4;
|
||||
}
|
||||
else if (fdOpcode == 0xCB) // FD CB prefix
|
||||
{
|
||||
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
|
||||
@@ -454,6 +500,13 @@ namespace Desktop
|
||||
}
|
||||
instructionLength = 4;
|
||||
}
|
||||
else if (fdOpcode == 0x71) // LD (IY+d), C
|
||||
{
|
||||
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
|
||||
string sign = d >= 0 ? "+" : "";
|
||||
mnemonic = $"LD (IY{sign}{d}), C";
|
||||
instructionLength = 3;
|
||||
}
|
||||
else if (fdOpcode == 0x75) // LD (IY+d), L
|
||||
{
|
||||
sbyte d = (sbyte)_memoryBus.Read((ushort)(currentPc + 2));
|
||||
|
||||
Reference in New Issue
Block a user