public Debugger(ref DCPU CPU)
{
InitializeComponent();
if (KnownCode == null)
KnownCode = new Dictionary<ushort, string>();
if (KnownLabels == null)
KnownLabels = new Dictionary<ushort, string>();
InterruptBreakDevices = new List<bool>();
FixKeyConfig();
KeyPreview = true;
this.CPU = CPU;
this.CPU.BreakpointHit += this.CPU_BreakpointHit;
this.CPU.InvalidInstruction += CpuOnInvalidInstruction;
rawMemoryDisplay.CPU = this.CPU;
stackDisplay.CPU = this.CPU;
disassemblyDisplay1.CPU = this.CPU;
Watches = new List<string>();
foreach (Device d in CPU.Devices)
{
listBoxConnectedDevices.Items.Add(d.FriendlyName);
InterruptBreakDevices.Add(false);
d.InterruptFired += OnDeviceInterrupt;
}
// Load device controllers
DeviceControllers = new List<Type>();
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{
var types = asm.GetTypes().Where(t => typeof(DeviceController).IsAssignableFrom(t) && t.IsAbstract == false);
foreach (var type in types)
{
DeviceControllers.Add(type);
}
}
}