From 31203bc854656ff92844364903de9abee9daea8b Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 7 Mar 2012 22:48:11 +0000 Subject: Safe-keeping commit. Currently debugging emulation using FUSE tests. --- .../TestMachine.cs | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'native') diff --git a/native/Noddybox.Emulation.EightBit.Z80.Test/TestMachine.cs b/native/Noddybox.Emulation.EightBit.Z80.Test/TestMachine.cs index a876826..d21e810 100644 --- a/native/Noddybox.Emulation.EightBit.Z80.Test/TestMachine.cs +++ b/native/Noddybox.Emulation.EightBit.Z80.Test/TestMachine.cs @@ -56,25 +56,25 @@ namespace Noddybox.Emulation.EightBit.Z80.Test byte IMemory.Read(ushort address) { - Output(ConsoleColor.Green, ConsoleColor.Black, "Reading {0:X2} from {1:X4}", mem[address], address); + // Output(ConsoleColor.Green, ConsoleColor.Black, "Reading {0:X2} from {1:X4}", mem[address], address); return mem[address]; } void IMemory.Write(ushort address, byte value) { - Output(ConsoleColor.Red, ConsoleColor.Black, "Writing {0:X2} to {1:X4}", value, address); + // Output(ConsoleColor.Red, ConsoleColor.Black, "Writing {0:X2} to {1:X4}", value, address); mem[address] = value; } byte IDevice.Read(ushort device) { - Output(ConsoleColor.Green, ConsoleColor.DarkGray, "Reading 00 from device {1:X4}", device); + // Output(ConsoleColor.Green, ConsoleColor.DarkGray, "Reading 00 from device {1:X4}", device); return 0; } void IDevice.Write(ushort device, byte value) { - Output(ConsoleColor.Red, ConsoleColor.DarkGray, "Writing {0:X2} to device {1:X4}", value, device); + // Output(ConsoleColor.Red, ConsoleColor.DarkGray, "Writing {0:X2} to device {1:X4}", value, device); } public bool Run(string name, Queue input, Queue expected) @@ -110,6 +110,8 @@ namespace Noddybox.Emulation.EightBit.Z80.Test z80.IM_Register = line.Dequeue().low; z80.HaltLine = (line.Dequeue().reg != 0); + Output(ConsoleColor.Gray, ConsoleColor.Black, z80.ToString()); + int cyclesToRun = Convert.ToInt32(line.Dequeue().reg.ToString("X")); while(input.Count > 0) @@ -118,9 +120,8 @@ namespace Noddybox.Emulation.EightBit.Z80.Test if (line.Count > 1) { - ushort start; ushort addr = line.Dequeue().reg; - start = addr; + ushort start = addr; foreach (Register16 b in line) { @@ -131,26 +132,24 @@ namespace Noddybox.Emulation.EightBit.Z80.Test { string a, b, c; start = disassembler.Disassemble(start, out a, out b, out c); - Output(ConsoleColor.Yellow, ConsoleColor.Blue, "{0}: {1} ; {2}", a, b, c); + Output(ConsoleColor.Yellow, ConsoleColor.Blue, "{0}: {1}", a, b); } } } - if (Debugger.IsAttached && name == "09") - { - Debugger.Break(); - } - while (clock.Ticks < cyclesToRun) { z80.Step(); } + Output(ConsoleColor.White, ConsoleColor.Black, z80.ToString()); + bool ok = true; while(expected.Peek().StartsWith(" ")) { - Output(ConsoleColor.DarkGray, ConsoleColor.Black, "Not yet handled - {0}", expected.Dequeue()); + // Output(ConsoleColor.DarkGray, ConsoleColor.Black, "Not yet handled - {0}", expected.Dequeue()); + expected.Dequeue(); } line = Decode(expected.Dequeue()); -- cgit v1.2.3