Fixed fast and slow tape loading and play_stop tape

This commit is contained in:
2026-04-29 14:33:39 +01:00
parent 8ef5e1f023
commit 142db4d004
5 changed files with 100 additions and 53 deletions

View File

@@ -88,6 +88,7 @@ namespace Desktop
private void UpdateMemoryView()
{
int count = 40;
// Try to parse the hex string the user typed in
if (!ushort.TryParse(txtMemoryStart.Text, System.Globalization.NumberStyles.HexNumber, null, out ushort startAddress))
{
@@ -98,7 +99,7 @@ namespace Desktop
StringBuilder sb = new StringBuilder();
// Read 100 bytes (or roughly 6 lines of 16 bytes)
for (int line = 0; line < 7; line++)
for (int line = 0; line < count; line++)
{
ushort currentAddr = (ushort)(startAddress + (line * 16));
@@ -246,8 +247,8 @@ namespace Desktop
instructionLength = 2;
break;
case 0x17: // RLA
mnemonic = "RLA";
instructionLength = 1;
mnemonic = "RLA";
instructionLength = 1;
break;
case 0x18:
sbyte dUnconditional = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
@@ -266,7 +267,8 @@ namespace Desktop
mnemonic = $"LD E, 0x{val1E:X2}";
instructionLength = 2;
break;
case 0x1F: mnemonic = $"RRA";
case 0x1F:
mnemonic = $"RRA";
break;
case 0x20:
sbyte jrOffset = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
@@ -295,8 +297,8 @@ namespace Desktop
instructionLength = 2;
break;
case 0x27: // DAA
mnemonic = "DAA";
instructionLength = 1;
mnemonic = "DAA";
instructionLength = 1;
break;
case 0x28:
sbyte jrZOffset = (sbyte)_memoryBus.Read((ushort)(currentPc + 1));
@@ -462,10 +464,10 @@ namespace Desktop
case 0x8D:
case 0x8E:
case 0x8F:
string[] registers = { "B", "C", "D", "E", "H", "L", "(HL)", "A" };
mnemonic = $"ADC A, {registers[opcode - 0x88]}";
instructionLength = 1;
break;
string[] registers = { "B", "C", "D", "E", "H", "L", "(HL)", "A" };
mnemonic = $"ADC A, {registers[opcode - 0x88]}";
instructionLength = 1;
break;
// --- SUB r ---
case 0x90: mnemonic = "SUB B"; break;
case 0x91: mnemonic = "SUB C"; break;
@@ -524,7 +526,7 @@ namespace Desktop
case 0xBC: mnemonic = "CP H"; break;
case 0xBD: mnemonic = "CP L"; break;
case 0xBE: mnemonic = "CP (HL)"; break;
case 0xBF: mnemonic = "CP A"; break;
case 0xBF: mnemonic = "CP A"; break;
case 0xC1: mnemonic = "POP BC"; break;
case 0xC2:
case 0xCA:
@@ -690,9 +692,9 @@ namespace Desktop
mnemonic = "RET C";
break;
case 0xDB: // IN A, (n)
n = _memoryBus.Read((ushort)(currentPc + 1));
mnemonic = $"IN A, (0x{n:X2})";
instructionLength = 2;
n = _memoryBus.Read((ushort)(currentPc + 1));
mnemonic = $"IN A, (0x{n:X2})";
instructionLength = 2;
break;
case 0xDD:
{