Exemplo n.º 1
0
        private bool PrepareNewProject(string dataPathName, SystemDef sysDef)
        {
            DisasmProject proj = new DisasmProject();

            mDataPathName    = dataPathName;
            mProjectPathName = string.Empty;
            byte[] fileData = null;
            try {
                fileData = LoadDataFile(dataPathName);
            } catch (Exception ex) {
                Debug.WriteLine("PrepareNewProject exception: " + ex);
                string message = Res.Strings.OPEN_DATA_FAIL_CAPTION;
                string caption = Res.Strings.OPEN_DATA_FAIL_MESSAGE + ": " + ex.Message;
                MessageBox.Show(caption, message, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return(false);
            }
            proj.UseMainAppDomainForPlugins = mUseMainAppDomainForPlugins;
            proj.Initialize(fileData.Length);
            proj.PrepForNew(fileData, Path.GetFileName(dataPathName));

            proj.LongComments.Add(DisplayListGen.Line.HEADER_COMMENT_OFFSET,
                                  new MultiLineComment("6502bench SourceGen v" + App.ProgramVersion));

            // The system definition provides a set of defaults that can be overridden.
            // We pull everything of interest out and then discard the object.
            proj.ApplySystemDef(sysDef);

            mProject = proj;

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the default load address.
        /// </summary>
        /// <param name="sysDef">SystemDef instance.</param>
        /// <returns>Specified load address, or 0x1000 if nothing defined.</returns>
        public static int GetLoadAddress(SystemDef sysDef)
        {
            Dictionary <string, string> parms = sysDef.Parameters;
            int retVal = 0x1000;

            if (parms.TryGetValue(LOAD_ADDRESS, out string valueStr))
            {
                valueStr = valueStr.Trim();
                if (Number.TryParseInt(valueStr, out int parseVal, out int unused))
                {
                    retVal = parseVal;
                }
                else
                {
                    Debug.WriteLine("WARNING: bad value for " + LOAD_ADDRESS + ": " + valueStr);
                }
            }