Ejemplo n.º 1
0
        private void hitBreakpoint(String eventType, int number, int address)
        {
            int relAddr = address - m_screenAddress;
            int y       = relAddr / 40;
            int x       = relAddr % 40;

            int[]     pixels = new int[8 * 8];
            Int32Rect rect   = new Int32Rect(x * 8, y * 8, 8, 8);

            m_wb.CopyPixels(rect, pixels, 8 * 4, 0);
            for (int dy = 0; dy < 8; dy++)
            {
                for (int dx = 0; dx < 8; dx++)
                {
                    int value = pixels[dy * 8 + dx];
                    value = (int)(value ^ 0xFFFFFFFF);
                    pixels[dy * 8 + dx] = value;
                }
            }
            m_wb.WritePixels(rect, pixels, 8 * 4, 0);
            canvas.Source = null;
            canvas.Source = m_wb;

            if (autorunCB.IsChecked ?? true)
            {
                VICECOMManager vcom = VICECOMManager.getVICEComManager();
                vcom.addTextCommand("x", CommandStruct.eMode.DoCommandOnly, null, null, null);
            }
        }
Ejemplo n.º 2
0
        private void show_diss_post_registers()
        {
            ShowSrcDissStruct sms = show_diss_common();

            if (sms == null)
            {
                SetSourceView("Source not found for this address ");
                if (mIsAPUMode)
                {
                    sms = new ShowSrcDissStruct()
                    {
                        endNext = m_registerSet.GetPC() + 0x10
                        ,
                        startPrev = m_registerSet.GetPC()
                    };
                }
                else
                {
                    sms = new ShowSrcDissStruct()
                    {
                        endNext = m_registerSet.GetPC() + 0x20
                        ,
                        startPrev = m_registerSet.GetPC()
                    };
                }
            }
            sms.displayDissCallback = new CommandStruct.CS_TextDelegate(show_diss_get_post_dissasem);
            string         command = "d " + sms.startPrev.ToString("X") + " " + m_registerSet.GetPC().ToString("X");
            VICECOMManager vcom    = VICECOMManager.getVICEComManager();

            vcom.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(show_src_diss_get_pre_dissasem), sms, this.Dispatcher);
        }
Ejemplo n.º 3
0
        private void dispatchCommand(string command)
        {
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            if (command.IndexOf("!memmapzap") == 0)
            {
                vcom.addTextCommand("memmapzap", CommandStruct.eMode.DoCommandThenExit, null, null, this.Dispatcher);
            }
            else if (command.IndexOf("!memmapshow") == 0)
            {
                vcom.addTextCommand("memmapshow", CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(memmapshow_callback), null, this.Dispatcher);
            }
            else if (command.IndexOf("!domem") == 0)
            {
                //vcom.addBinaryMemCommand(0, 0xFFFF, full_mem_dump, null, this.Dispatcher);
            }
            else if (command.IndexOf("!sm") == 0)
            {
                get_registers_callmeback(new NoArgDelegate(show_src_diss_post_registers));
            }
            else if (command.IndexOf("!s") == 0)
            {
                get_registers_callmeback(new NoArgDelegate(show_src_post_registers));
            }
            else if (command.IndexOf("!d") == 0)
            {
                get_registers_callmeback(new NoArgDelegate(show_diss_post_registers));
            }
            else if (command.IndexOf("!breaklist") == 0)
            {
                vcom.addTextCommand("break", CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(breaklist_callback), null, this.Dispatcher);
            }
            else if (command.IndexOf("break") == 0 || command.IndexOf("watch") == 0)
            {
                vcom.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(break_callback), null, this.Dispatcher);
            }
            else if (command.StartsWith("quit"))
            {
                vcom.addTextCommand("quit", CommandStruct.eMode.DoCommandFireCallback, new CommandStruct.CS_TextDelegate(quit_callback), null, this.Dispatcher);
            }
            else
            {
                // Any other commands get here
                //bool silent = false;
                if (command.IndexOf('!') == 0)
                {
                    command = command.Substring(1);
                    //silent = true;
                }

                if (command.IndexOf("x") != 0)
                {
                    vcom.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(command_just_show_reply), null, this.Dispatcher);
                }
                else
                {
                    vcom.addTextCommand(command, CommandStruct.eMode.DoCommandOnly, null, null, this.Dispatcher);
                }
            }
        }
Ejemplo n.º 4
0
        private void drawScreen()
        {
            //first we need to get the RAM upto date
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("bank ram", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            vcom.addBinaryMemCommand(m_screenAddress, m_screenAddress + 0x400, new CommandStruct.CS_BinaryDelegate(got_screen), null, this.Dispatcher);
        }
Ejemplo n.º 5
0
 public static VICECOMManager getVICEComManager()
 {
     if (g_vicecommanager == null)
     {
         g_vicecommanager = new VICECOMManager();
     }
     return(g_vicecommanager);
 }
Ejemplo n.º 6
0
        public void removeBreakpoint(int number)
        {
            VICECOMManager vc      = VICECOMManager.getVICEComManager();
            string         command = "del " + number;

            vc.addTextCommand(command, CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            mBreakPointToDispatch.Remove(number);
        }
Ejemplo n.º 7
0
        private void handleDisplayChars()
        {
            getStartAddress();
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("bank ram", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            vcom.addBinaryMemCommand(m_startAddress, m_startAddress + 0x2000, new CommandStruct.CS_BinaryDelegate(got_ram), null, this.Dispatcher);
            vcom.addTextCommand("bank cpu", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
        }
Ejemplo n.º 8
0
        public void addBreakPointAndNotifyMe(int startAddress, int endAddress, BreakPointEventDelegate me, Dispatcher dispatcher, IBreakpointReturn owner)
        {
            VICECOMManager vc      = VICECOMManager.getVICEComManager();
            string         command = string.Format("break {0:X4} {1:X4}", startAddress, endAddress);

            vc.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, bpd_addBreak, new CallBackStruct {
                me = me, owner = owner
            }, dispatcher);
        }
Ejemplo n.º 9
0
        private void got_screen(byte[] data, object none)
        {
            C64RAM ram = C64RAM.getInstace();

            ram.injectBinaryData(m_screenAddress, data);
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addBinaryMemCommand(m_screenAddress, m_charAddress + 0x800, new CommandStruct.CS_BinaryDelegate(got_char), null, this.Dispatcher);
        }
Ejemplo n.º 10
0
        private void show_src_diss_get_pre_dissasem(string reply, object userData)
        {
            ShowSrcDissStruct sms = userData as ShowSrcDissStruct;

            sms.disassemblyBefore = reply;
            string         command = "d " + m_registerSet.GetPC().ToString("X") + " " + sms.endNext.ToString("X");
            VICECOMManager vcom    = VICECOMManager.getVICEComManager();

            vcom.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, sms.displayDissCallback, sms, this.Dispatcher);
        }
Ejemplo n.º 11
0
        private void got_char(byte[] data, object none)
        {
            C64RAM ram = C64RAM.getInstace();

            ram.injectBinaryData(m_screenAddress, data);
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("bank cpu", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            renderScreen();
        }
Ejemplo n.º 12
0
        private void handleDisplaySprites(int startAddress, int bank)
        {
            m_startAddress = startAddress;
            m_startBank    = bank;

            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("bank ram", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            vcom.addBinaryMemCommand(m_startAddress, m_startAddress + 0x3fff, new CommandStruct.CS_BinaryDelegate(got_ram), null, this.Dispatcher);
            vcom.addTextCommand("bank cpu", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
        }
Ejemplo n.º 13
0
        private void getButton_Click(object sender, RoutedEventArgs e)
        {
            VICECOMManager vcom = VICECOMManager.getVICEComManager();
            int            count;

            if (!Int32.TryParse(mCount.Text, out count))
            {
                count = 500;
            }
            vcom.addTextCommand("chis " + count.ToString(), CommandStruct.eMode.DoCommandReturnResults, chis_gotData, null, this.Dispatcher);
        }
Ejemplo n.º 14
0
        private void DispatchNextCommand(string command)
        {
            if (command.StartsWith("vice:"))
            {
                string viceCommand = null;
                string destString  = null;
                if (command.Contains(">>"))
                {
                    int pipeIndex = command.IndexOf(">>");
                    viceCommand = command.Substring(5, pipeIndex - 5).Trim();
                    destString  = command.Substring(pipeIndex + 2).Trim();
                }
                else
                {
                    viceCommand = command.Substring(5);
                }
                mResults.Text += "executing vice command " + viceCommand + "\n";
                VICECOMManager vcom = VICECOMManager.getVICEComManager();
                vcom.addTextCommand(viceCommand, CommandStruct.eMode.DoCommandReturnResults, sp_gotData, destString, this.Dispatcher);
            }
            else if (command.StartsWith("host:"))
            {
                string hostCommand = command.Substring(5).Trim();
                int    fileNameEnd = hostCommand.IndexOf(' ');

                string filename = hostCommand.Substring(0, fileNameEnd);
                string param    = hostCommand.Substring(fileNameEnd);

                mResults.Text += "executing host command " + filename + "with params " + param + "\n";

                var proc = new Process
                {
                    StartInfo = new ProcessStartInfo
                    {
                        FileName               = filename,
                        Arguments              = param,
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true,
                        CreateNoWindow         = true
                    }
                };
                proc.Start();
                while (!proc.StandardOutput.EndOfStream)
                {
                    mResults.Text += proc.StandardOutput.ReadLine() + "\n";
                }
                while (!proc.StandardError.EndOfStream)
                {
                    mResults.Text += proc.StandardOutput.ReadLine() + "\n";
                }
                DispatchNextCommand();
            }
        }
Ejemplo n.º 15
0
        private void got_new_value(byte[] data, object obj)
        {
            WatchObject wo = obj as WatchObject;

            wo.m_value  = data[0];
            DataContext = null;
            DataContext = this;
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("x", CommandStruct.eMode.DoCommandOnly, null, null, null);
        }
Ejemplo n.º 16
0
 private void hitBreakpoint(String eventType, int number, int address)
 {
     try
     {
         WatchObject    obj  = m_breakpointToWatchMap[number];
         VICECOMManager vcom = VICECOMManager.getVICEComManager();
         vcom.addBinaryMemCommand(obj.m_address, obj.m_address + 0x0100, new CommandStruct.CS_BinaryDelegate(got_new_value), obj, this.Dispatcher);
     }
     catch (Exception)
     {
         VICECOMManager vcom = VICECOMManager.getVICEComManager();
         vcom.addTextCommand("x", CommandStruct.eMode.DoCommandOnly, null, null, null);
     }
 }
Ejemplo n.º 17
0
        public void updateC64(MainWindow mw)
        {
            VICECOMManager vcom    = VICECOMManager.getVICEComManager();
            string         text    = mTextBox.Text;
            int            value   = 0;
            string         command = "";

            switch (mType)
            {
            default:
            case eDisplayType.Decimal:
                if (Int32.TryParse(text, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
                {
                    command = String.Format(">{0:X04} {1:X02}", mAddress, value);
                }

                mTextBox.Text = String.Format("{0:d}", value);
                break;

            case eDisplayType.Hex:
                switch (mWidth)
                {
                default:
                case eWidth.Byte:
                    if (Int32.TryParse(text, System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
                    {
                        command = String.Format(">{0:X04} {1:X02}", mAddress, value);
                    }
                    break;

                case eWidth.Word:
                    if (Int32.TryParse(text, System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
                    {
                        command = String.Format(">{0:X04} {1:X02} {2:X02}", mAddress, value & 0xFF, (value & 0xFF00) / 256);
                    }
                    break;
                }
                break;
            }
            if (command.Length > 0)
            {
                vcom.addTextCommand(command, CommandStruct.eMode.DoCommandThrowAwayResults, null, null, mw.Dispatcher);
            }
        }
Ejemplo n.º 18
0
        public void addWatchPointAndNotifyMe(int startAddress, int endAddress, BreakPointEventDelegate me, Dispatcher dispatcher, bool load, bool store, IBreakpointReturn owner)
        {
            VICECOMManager vc  = VICECOMManager.getVICEComManager();
            string         pre = String.Empty;

            if (load)
            {
                pre += "load ";
            }
            if (store)
            {
                pre += "store ";
            }
            string command = string.Format("watch {0:s} {1:X4} {2:X4}", pre, startAddress, endAddress);

            vc.addTextCommand(command, CommandStruct.eMode.DoCommandReturnResults, bpd_addBreak, new CallBackStruct {
                me = me, owner = owner
            }, dispatcher);
        }
Ejemplo n.º 19
0
        private void handleDisplayBitmap()
        {
            m_startAddress = Convert.ToInt32(startBox.Text, 16);
            // m_startBank = bank;

            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            if (ram0Rad.IsChecked ?? true)
            {
                vcom.addTextCommand("bank ram", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            }
            else if (ram1Rad.IsChecked ?? true)
            {
                vcom.addTextCommand("bank ram1", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            }
            else
            {
                vcom.addTextCommand("bank vdc", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
            }
            vcom.addBinaryMemCommand(m_startAddress, m_startAddress + 0x2000, new CommandStruct.CS_BinaryDelegate(got_ram), null, this.Dispatcher);
            vcom.addTextCommand("bank cpu", CommandStruct.eMode.DoCommandThrowAwayResults, null, null, null);
        }
Ejemplo n.º 20
0
        public MainWindow()
        {
            InitializeComponent();
            //install the error callback before we do anything in case something connects to VICE
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.setErrorCallback(new VICECOMManager.OneArgDelegate(SetSourceView), this.Dispatcher);
            vcom.setVICEmsgCallback(new VICECOMManager.OneArgDelegate(GotMsgFromVice));
            m_registerSet = new RegisterSet6510();
            m_memDump     = new C64MemDump();
            m_memDump.SetRegisterSet(m_registerSet);

            //this must be BEFORE we parse the PDB Data
            mAssertList = new ObservableCollection <AssertDataSource>();
            string[] commandLineArgs = Environment.GetCommandLineArgs();
            if (commandLineArgs.Length == 1)
            {
                m_readerAndDispaly = new AcmePDBRandD();
                //System.Environment.Exit(1);
            }
            else if (commandLineArgs[1].EndsWith(".json"))
            {
                m_readerAndDispaly = new FunctionJSONRAndD();
            }
            else
            {
                m_readerAndDispaly = new AcmePDBRandD();
            }
            m_readerAndDispaly.SetCodeWindowControl(mTextBox);
            m_readerAndDispaly.SetLabelsWindowControl(mLabelsBox);
            m_readerAndDispaly.SetRegisterSet(m_registerSet);
            m_readerAndDispaly.SetMemDump(m_memDump);

            mBreakPoints = new List <BreakPointDataSource>();
            mBreakPointDisplay.ItemsSource = mBreakPoints;

            VICIIRenderer.initRenderer(); //load charsets


            m_readerAndDispaly.CreatePDBFromARGS(commandLineArgs, this);

            //			mCommands.Add("r");
            //			mCommands.Add("m 0000 ffff");
            //			mCommands.Add("x");
            //			mCommands.Add("!s");
            //			mCommands.Add("!sm");

            dispatchCommand("!breaklist");

            HandleCodeView();

            /*AssertDataSource AD = new AssertDataSource();
             * AD.Enable = true;
             * AD.Address = 0x810;
             * AD.Label = "Test";
             * AD.Condition = "@io:$d020 != $00";
             * AD.Msg = "This is a test";
             * AD.Number = 1;
             * mAssertList.Add(AD);*/

            AssertDataGrid.ItemsSource = mAssertList;
        }
Ejemplo n.º 21
0
        private void get_registers_callmeback(NoArgDelegate callme)
        {
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addTextCommand("r", CommandStruct.eMode.DoCommandReturnResults, new CommandStruct.CS_TextDelegate(get_registers_callback), callme, this.Dispatcher);
        }
Ejemplo n.º 22
0
        public void RefreshDump(Dispatcher dispatch)
        {
            VICECOMManager vcom = VICECOMManager.getVICEComManager();

            vcom.addBinaryMemCommand(0, 0xFFFF, full_mem_dump, null, dispatch);
        }