Exemplo n.º 1
0
        //
        private void onExecutionStopped(object sender, EventArgs e)
        {
            Dispatcher.Invoke(new Action(() => { vm.DisassembledOpcodes.Clear(); }));

            ushort length = 0xFFFE;
            IntPtr memoryValuesPtr = Interop.getMemoryRange(0x0000, length);
            byte[] result = new byte[length + 1];
            Marshal.Copy(memoryValuesPtr, result, 0, length);

            Disassembly disassembly = new Disassembly(result);
            disassembly.Begin((ushort)(vm.Processor.ProgramCounter - 0x100));

            while (disassembly.NextInstructionAddress < (ushort)vm.Processor.ProgramCounter + 0x100)
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    vm.DisassembledOpcodes.Add(disassembly.ToDisassembledOpcode());
                }));
                disassembly.Next();
            }

            Dispatcher.Invoke(new Action(() =>
            {
                UpdateDisassemblySelection(vm.Processor.ProgramCounter);
            }));

            lbDisassembly.Dispatcher.Invoke(new Action(() => { enableReadoutControls(); }));
            lbDisassembly.Dispatcher.Invoke(new Action(() => { tbDebugConsole.Text += "Breakpoint hit.\r\n"; }));
        }
Exemplo n.º 2
0
        private void btnLoadBinary_Click(object sender, RoutedEventArgs e)
        {
            Interop.loadBinary(monitorRomPath, 0xFF00);
            Interop.loadBinary(basicRomPath, 0xE000);
            videoRom = File.ReadAllBytes(characterRomPath);
            decodeGraphics();

            Interop.resetProcessor();
            vm.Processor.UpdateProperties(Interop.getProcessorStatus());

            ushort length = 0xFFFE;
            IntPtr memoryValuesPtr = Interop.getMemoryRange(0x0000, length);
            byte[] result = new byte[length+1];
            Marshal.Copy(memoryValuesPtr, result, 0, length);

            Disassembly disassembly = new Disassembly(result);
            disassembly.Begin(0xFF00);

            while (disassembly.NextInstructionAddress < 0xFFFE)
            {
                vm.DisassembledOpcodes.Add(disassembly.ToDisassembledOpcode());
                disassembly.Next();
            }

            btnRun.IsEnabled = true;
            btnSingleStep.IsEnabled = true;
        }