Esempio n. 1
0
        public void ResetCPU(bool ResetMemory)
        {
            CPU.Halt();

            gpu.Refresh();

            // This fontset is loaded just in case the kernel doesn't provide one.
            gpu.LoadFontSet("Foenix", @"Resources\Bm437_PhoenixEGA_8x8.bin", 0, CharacterSet.CharTypeCodes.ASCII_PET, CharacterSet.SizeCodes.Size8x8);

            if (Configuration.Current.StartUpHexFile.EndsWith(".fnxml", true, null))
            {
                FoeniXmlFile fnxml = new FoeniXmlFile(MemoryManager, Resources, CPUWindow.Instance.breakpoints);
                fnxml.Load(Configuration.Current.StartUpHexFile);
            }
            else
            {
                Configuration.Current.StartUpHexFile = HexFile.Load(MemoryManager, Configuration.Current.StartUpHexFile);
                if (Configuration.Current.StartUpHexFile != null)
                {
                    if (ResetMemory)
                    {
                        lstFile = new ListFile(Configuration.Current.StartUpHexFile);
                    }
                    else
                    {
                        // TODO: We should really ensure that there are no duplicated PC in the list
                        ListFile tempList = new ListFile(Configuration.Current.StartUpHexFile);
                        lstFile.Lines.InsertRange(0, tempList.Lines);
                    }
                }
            }

            // If the reset vector is not set in Bank 0, but it is set in Bank 18, then copy bank 18 into bank 0.
            if (MemoryManager.ReadLong(0xFFE0) == 0 && MemoryManager.ReadLong(0x18_FFE0) != 0)
            //if (MemoryManager.ReadLong(0xFFFC) == 0 && MemoryManager.ReadLong(0x18_FFFC) != 0)
            {
                MemoryManager.Copy(0x180000, MemoryMap.RAM_START, MemoryMap.PAGE_SIZE);
                // See if lines of code exist in the 0x18_0000 to 0x18_FFFF block
                List <DebugLine> copiedLines = new List <DebugLine>();
                if (lstFile.Lines.Count > 0)
                {
                    List <DebugLine> tempLines = new List <DebugLine>();
                    foreach (DebugLine line in lstFile.Lines)
                    {
                        if (line.PC >= 0x18_0000 && line.PC < 0x19_0000)
                        {
                            DebugLine dl = (DebugLine)line.Clone();
                            dl.PC -= 0x18_0000;
                            copiedLines.Add(dl);
                        }
                    }
                }
                if (copiedLines.Count > 0)
                {
                    lstFile.Lines.InsertRange(0, copiedLines);
                }
            }
            CPU.Reset();
        }
Esempio n. 2
0
        private void SaveWatchListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Pick the file to create
            SaveFileDialog dialog = new SaveFileDialog
            {
                Title           = "Save Watch List File",
                CheckPathExists = true,
                Filter          = "Foenix Watch List File| *.wlxml"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                FoeniXmlFile xmlFile = new FoeniXmlFile(kernel, null);
                xmlFile.WriteWatches(dialog.FileName);
            }
        }
Esempio n. 3
0
        /*
         * Export all memory content to an XML file.
         */
        private void SaveProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Pick the file to create
            SaveFileDialog dialog = new SaveFileDialog
            {
                Title           = "Save Project File",
                CheckPathExists = true,
                Filter          = "Foenix Project File| *.fnxml"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                FoeniXmlFile fnxml = new FoeniXmlFile(kernel, ResChecker);
                fnxml.Write(dialog.FileName, true);
            }
        }
Esempio n. 4
0
        private void LoadWatchListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                Title           = "Load Watch List File",
                Filter          = "Foenix Watch List File|*.wlxml",
                CheckFileExists = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                FoeniXmlFile xmlFile = new FoeniXmlFile(kernel, null);
                xmlFile.ReadWatches(dialog.FileName);
                watchWindow.SetKernel(kernel);
            }
        }
Esempio n. 5
0
        /*
         * Export all memory content to an XML file.
         */
        private void SaveProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Pick the file to create
            SaveFileDialog dialog = new SaveFileDialog
            {
                Title           = "Save Project File",
                CheckPathExists = true,
                Filter          = "Foenix Project File| *.fnxml"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                FoeniXmlFile fnxml = new FoeniXmlFile(system.MemoryManager, ResChecker, CPUWindow.Instance.breakpoints);
                fnxml.Write(dialog.FileName, true);
            }
        }
Esempio n. 6
0
        // return true if the CPU was reset and the program was loaded
        public bool ResetCPU(string kernelFilename)
        {
            if (CPU != null)
            {
                CPU.DebugPause = true;
                //CPU.Halt();
            }

            if (kernelFilename != null)
            {
                LoadedKernel = kernelFilename;
            }

            // If the reset vector is not set in Bank 0, but it is set in Bank 18, the copy bank 18 into bank 0.
            int BasePageAddress = 0x18_0000;

            if (boardVersion == BoardVersion.RevC)
            {
                BasePageAddress = 0x38_0000;
            }

            if (LoadedKernel.EndsWith(".fnxml", true, null))
            {
                this.ResetMemory();
                FoeniXmlFile fnxml = new FoeniXmlFile(this, Resources);
                fnxml.Load(LoadedKernel);
                boardVersion = fnxml.Version;
            }
            else
            {
                LoadedKernel = HexFile.Load(MemMgr.RAM, LoadedKernel, BasePageAddress, out _, out _);
                if (LoadedKernel != null)
                {
                    if (lstFile == null)
                    {
                        lstFile = new ListFile(LoadedKernel);
                    }
                    else
                    {
                        // TODO: This results in lines of code to be shown in incorrect order - Fix
                        ListFile tempList = new ListFile(LoadedKernel);
                        foreach (DebugLine line in tempList.Lines.Values)
                        {
                            if (lstFile.Lines.ContainsKey(line.PC))
                            {
                                lstFile.Lines.Remove(line.PC);
                            }
                            lstFile.Lines.Add(line.PC, line);
                            for (int i = 1; i < line.commandLength; i++)
                            {
                                if (lstFile.Lines.ContainsKey(line.PC + i))
                                {
                                    lstFile.Lines.Remove(line.PC + i);
                                }
                            }
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }

            // See if lines of code exist in the 0x18_0000 to 0x18_FFFF block for RevB or 0x38_0000 to 0x38_FFFF block for Rev C
            List <DebugLine> copiedLines = new List <DebugLine>();

            if (lstFile.Lines.Count > 0)
            {
                foreach (DebugLine line in lstFile.Lines.Values)
                {
                    if (line != null && line.PC >= BasePageAddress && line.PC < BasePageAddress + 0x1_0000)
                    {
                        DebugLine dl = (DebugLine)line.Clone();
                        dl.PC -= BasePageAddress;
                        copiedLines.Add(dl);
                    }
                }
            }
            if (copiedLines.Count > 0)
            {
                foreach (DebugLine line in copiedLines)
                {
                    if (lstFile.Lines.ContainsKey(line.PC))
                    {
                        lstFile.Lines.Remove(line.PC);
                    }
                    lstFile.Lines.Add(line.PC, line);
                }
            }
            CPU.Reset();
            return(true);
        }