示例#1
0
        /// <summary>
        /// Configures the assembler-specific format items.
        /// </summary>
        private void SetFormatConfigValues(ref Formatter.FormatConfig config)
        {
            config.mSuppressImpliedAcc = true;

            config.mOperandWrapLen               = 64;
            config.mForceDirectOpcodeSuffix      = "+1";
            config.mForceAbsOpcodeSuffix         = "+2";
            config.mForceLongOpcodeSuffix        = "+3";
            config.mForceDirectOperandPrefix     = string.Empty;
            config.mForceAbsOperandPrefix        = string.Empty;
            config.mForceLongOperandPrefix       = string.Empty;
            config.mLocalVariableLabelPrefix     = ".";
            config.mEndOfLineCommentDelimiter    = ";";
            config.mFullLineCommentDelimiterBase = ";";
            config.mBoxLineCommentDelimiter      = ";";
            config.mNonUniqueLabelPrefix         = "@";
            config.mCommaSeparatedDense          = false;
            config.mExpressionMode               = Formatter.FormatConfig.ExpressionMode.Common;

            Formatter.DelimiterSet charSet = new Formatter.DelimiterSet();
            charSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM);
            charSet.Set(CharEncoding.Encoding.HighAscii,
                        new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80"));
            config.mCharDelimiters = charSet;
        }
示例#2
0
        // IGenerator
        public GenerationResults GenerateSource(BackgroundWorker worker)
        {
            List <string> pathNames = new List <string>(1);

            string fileName = mFileNameBase + ASM_FILE_SUFFIX;
            string pathName = Path.Combine(mWorkDirectory, fileName);

            pathNames.Add(pathName);

            Formatter.FormatConfig config = new Formatter.FormatConfig();
            GenCommon.ConfigureFormatterFromSettings(Settings, ref config);
            SetFormatConfigValues(ref config);

            // Configure delimiters for single-character operands.
            Formatter.DelimiterSet charDelimSet = new Formatter.DelimiterSet();
            charDelimSet.Set(CharEncoding.Encoding.C64Petscii, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.C64ScreenCode, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.HighAscii,
                             new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80"));

            config.mCharDelimiters = charDelimSet;

            SourceFormatter = new Formatter(config);

            string msg = string.Format(Res.Strings.PROGRESS_GENERATING_FMT, pathName);

            worker.ReportProgress(0, msg);

            mLocalizer                        = new LabelLocalizer(Project);
            mLocalizer.LocalPrefix            = "_";
            mLocalizer.QuirkNoOpcodeMnemonics = true;
            mLocalizer.Analyze();

            bool   needLongAddress = Project.FileDataLength > 65536 + (mHasPrgHeader ? 2 : 0);
            string extraOptions    = string.Empty +
                                     (needLongAddress ? AsmTass64.LONG_ADDRESS : string.Empty) +
                                     (mHasPrgHeader ? string.Empty : AsmTass64.NOSTART);

            mPcDepth     = 0;
            mFirstIsOpen = true;

            // Use UTF-8 encoding, without a byte-order mark.
            using (StreamWriter sw = new StreamWriter(pathName, false, new UTF8Encoding(false))) {
                mOutStream = sw;

                if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false))
                {
                    OutputLine(SourceFormatter.FullLineCommentDelimiter +
                               string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
                                             "64tass", mAsmVersion, AsmTass64.BASE_OPTIONS + extraOptions));
                }

                GenCommon.Generate(this, sw, worker);
            }
            mOutStream = null;

            return(new GenerationResults(pathNames, extraOptions));
        }
示例#3
0
        // IGenerator
        public List <string> GenerateSource(BackgroundWorker worker)
        {
            List <string> pathNames = new List <string>(1);

            string fileName = mFileNameBase + ASM_FILE_SUFFIX;
            string pathName = Path.Combine(mWorkDirectory, fileName);

            pathNames.Add(pathName);

            Formatter.FormatConfig config = new Formatter.FormatConfig();
            GenCommon.ConfigureFormatterFromSettings(Settings, ref config);
            SetFormatConfigValues(ref config);

            // Configure delimiters for single-character operands.
            Formatter.DelimiterSet charDelimSet = new Formatter.DelimiterSet();
            charDelimSet.Set(CharEncoding.Encoding.C64Petscii, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.C64ScreenCode, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM);
            charDelimSet.Set(CharEncoding.Encoding.HighAscii,
                             new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80"));

            config.mCharDelimiters = charDelimSet;

            SourceFormatter = new Formatter(config);

            string msg = string.Format(Res.Strings.PROGRESS_GENERATING_FMT, pathName);

            worker.ReportProgress(0, msg);

            mLocalizer                        = new LabelLocalizer(Project);
            mLocalizer.LocalPrefix            = "_";
            mLocalizer.QuirkNoOpcodeMnemonics = true;
            mLocalizer.Analyze();

            // Use UTF-8 encoding, without a byte-order mark.
            using (StreamWriter sw = new StreamWriter(pathName, false, new UTF8Encoding(false))) {
                mOutStream = sw;

                if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false))
                {
                    OutputLine(SourceFormatter.FullLineCommentDelimiter +
                               string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
                                             "64tass", V1_53, AsmTass64.OPTIONS));
                }

                GenCommon.Generate(this, sw, worker);

                if (mNeedHereOp)
                {
                    OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(HERE_PSEUDO_OP),
                               string.Empty, string.Empty);
                }
            }
            mOutStream = null;

            return(pathNames);
        }
示例#4
0
        /// <summary>
        /// Configures the assembler-specific format items.
        /// </summary>
        private void SetFormatConfigValues(ref Formatter.FormatConfig config)
        {
            config.mForceDirectOpcodeSuffix      = string.Empty;
            config.mForceAbsOpcodeSuffix         = ":";
            config.mForceLongOpcodeSuffix        = "l";
            config.mForceDirectOperandPrefix     = string.Empty;
            config.mForceAbsOperandPrefix        = string.Empty;
            config.mForceLongOperandPrefix       = string.Empty;
            config.mLocalVariableLablePrefix     = "]";
            config.mEndOfLineCommentDelimiter    = ";";
            config.mFullLineCommentDelimiterBase = ";";
            config.mBoxLineCommentDelimiter      = string.Empty;
            config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Merlin;

            Formatter.DelimiterSet charSet = new Formatter.DelimiterSet();
            charSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM);
            charSet.Set(CharEncoding.Encoding.HighAscii, Formatter.DOUBLE_QUOTE_DELIM);
            config.mCharDelimiters = charSet;
        }
示例#5
0
文件: AsmCc65.cs 项目: X65/6502bench
        /// <summary>
        /// Configures the assembler-specific format items.
        /// </summary>
        private void SetFormatConfigValues(ref Formatter.FormatConfig config)
        {
            config.mForceDirectOpcodeSuffix      = string.Empty;
            config.mForceAbsOpcodeSuffix         = string.Empty;
            config.mForceLongOpcodeSuffix        = string.Empty;
            config.mForceDirectOperandPrefix     = "z:"; // zero
            config.mForceAbsOperandPrefix        = "a:"; // absolute
            config.mForceLongOperandPrefix       = "f:"; // far
            config.mEndOfLineCommentDelimiter    = ";";
            config.mFullLineCommentDelimiterBase = ";";
            config.mBoxLineCommentDelimiter      = ";";
            config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Cc65;

            Formatter.DelimiterSet charSet = new Formatter.DelimiterSet();
            charSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM);
            charSet.Set(CharEncoding.Encoding.HighAscii,
                        new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80"));
            config.mCharDelimiters = charSet;
        }